X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.core%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fcore%2Fcomponents%2FBitDisplay.java;h=af2fbc00bf11dc18c0bc26c536927b441df6c4c1;hb=ecc651406020231ff0ebc8d1bfc6f916693f69c6;hp=268d1572403d13bd9e98d66c7025a895aee71980;hpb=67c1d352795802dae0c045cedeed82c883819d4e;p=Mograsim.git diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BitDisplay.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BitDisplay.java index 268d1572..af2fbc00 100644 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BitDisplay.java +++ b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BitDisplay.java @@ -1,51 +1,51 @@ -package net.mograsim.logic.core.components; - -import java.util.List; - -import net.mograsim.logic.core.timeline.Timeline; -import net.mograsim.logic.core.types.Bit; -import net.mograsim.logic.core.types.BitVector; -import net.mograsim.logic.core.wires.Wire.ReadEnd; -import net.mograsim.logic.core.wires.Wire.ReadWriteEnd; - -public class BitDisplay extends BasicComponent -{ - private final ReadEnd in; - private BitVector displayedValue; - - public BitDisplay(Timeline timeline, ReadEnd in) - { - super(timeline, 1); - this.in = in; - in.addObserver(this); - compute(); - } - - @Override - protected void compute() - { - displayedValue = in.getValues(); - } - - public BitVector getDisplayedValue() - { - return displayedValue; - } - - public boolean isDisplaying(Bit... values) - { - return displayedValue.equals(BitVector.of(values)); - } - - @Override - public List getAllInputs() - { - return List.of(in); - } - - @Override - public List getAllOutputs() - { - return List.of(); - } -} +package net.mograsim.logic.core.components; + +import java.util.List; + +import net.mograsim.logic.core.timeline.Timeline; +import net.mograsim.logic.core.types.Bit; +import net.mograsim.logic.core.types.BitVector; +import net.mograsim.logic.core.wires.Wire.ReadEnd; +import net.mograsim.logic.core.wires.Wire.ReadWriteEnd; + +public class BitDisplay extends BasicComponent +{ + private final ReadEnd in; + private BitVector displayedValue; + + public BitDisplay(Timeline timeline, ReadEnd in) + { + super(timeline, 1); + this.in = in; + in.registerObserver(this); + compute(); + } + + @Override + protected void compute() + { + displayedValue = in.getValues(); + } + + public BitVector getDisplayedValue() + { + return displayedValue; + } + + public boolean isDisplaying(Bit... values) + { + return displayedValue.equals(BitVector.of(values)); + } + + @Override + public List getAllInputs() + { + return List.of(in); + } + + @Override + public List getAllOutputs() + { + return List.of(); + } +}