X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Fcomponents%2Fgates%2FNotGate.java;h=79c7f3e159a0b65bf664cf3e443dabebf4828d67;hb=7d3d8dd3ff0e8362195ed5bbbc7ec4bc9a9b2475;hp=1aba6b8643fe4b33a3e579c37e7f2969f142c0fc;hpb=4c8fb641dc21efe699f457dcd48fc3cf3660740d;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/components/gates/NotGate.java b/era.mi/src/era/mi/logic/components/gates/NotGate.java index 1aba6b86..79c7f3e1 100644 --- a/era.mi/src/era/mi/logic/components/gates/NotGate.java +++ b/era.mi/src/era/mi/logic/components/gates/NotGate.java @@ -1,37 +1,52 @@ -package era.mi.logic.components.gates; - -import era.mi.logic.Util; -import era.mi.logic.components.BasicComponent; -import era.mi.logic.wires.WireArray; -import era.mi.logic.wires.WireArray.WireArrayInput; - -public class NotGate extends BasicComponent -{ - private WireArray in, out; - private WireArrayInput outI; - - - public NotGate(int processTime, WireArray in, WireArray out) - { - super(processTime); - this.in = in; - in.addObserver(this); - this.out = out; - outI = out.createInput(); - } - - public void compute() - { - outI.feedSignals(Util.not(in.getValues())); - } - - public WireArray getIn() - { - return in; - } - - public WireArray getOut() - { - return out; - } -} +package era.mi.logic.components.gates; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import era.mi.logic.Util; +import era.mi.logic.components.BasicComponent; +import era.mi.logic.wires.WireArray; +import era.mi.logic.wires.WireArray.WireArrayEnd; + +public class NotGate extends BasicComponent +{ + private WireArray in, out; + private WireArrayEnd outI; + + public NotGate(int processTime, WireArray in, WireArray out) + { + super(processTime); + this.in = in; + in.addObserver(this); + this.out = out; + outI = out.createInput(); + } + + public void compute() + { + outI.feedSignals(Util.not(in.getValues())); + } + + public WireArray getIn() + { + return in; + } + + public WireArray getOut() + { + return out; + } + + @Override + public List getAllInputs() + { + return Collections.unmodifiableList(Arrays.asList(in)); + } + + @Override + public List getAllOutputs() + { + return Collections.unmodifiableList(Arrays.asList(out)); + } +}