Exchanged all Bit[] by BitVector, tests work
[Mograsim.git] / era.mi / src / era / mi / logic / components / gates / NotGate.java
index 1aba6b8..7baf606 100644 (file)
@@ -1,37 +1,48 @@
-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;\r
+\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.BasicComponent;\r
+import era.mi.logic.wires.Wire.WireEnd;\r
+\r
+public class NotGate extends BasicComponent\r
+{\r
+       private WireEnd in;\r
+       private WireEnd out;\r
+\r
+       public NotGate(int processTime, WireEnd in, WireEnd out)\r
+       {\r
+               super(processTime);\r
+               this.in = in;\r
+               in.addObserver(this);\r
+               this.out = out;\r
+       }\r
+\r
+       @Override\r
+       protected void compute()\r
+       {\r
+               out.feedSignals(in.getValues().not());\r
+       }\r
+\r
+       public WireEnd getIn()\r
+       {\r
+               return in;\r
+       }\r
+\r
+       public WireEnd getOut()\r
+       {\r
+               return out;\r
+       }\r
+\r
+       @Override\r
+       public List<WireEnd> getAllInputs()\r
+       {\r
+               return List.of(in);\r
+       }\r
+\r
+       @Override\r
+       public List<WireEnd> getAllOutputs()\r
+       {\r
+               return List.of(out);\r
+       }\r
+}\r