Merge logic of origin into logic
[Mograsim.git] / era.mi / src / era / mi / logic / components / gates / NotGate.java
index f81ba92..6829dc3 100644 (file)
@@ -1,45 +1,49 @@
 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.WireArrayInput;
+import era.mi.logic.wires.Wire.WireEnd;
 
-public class NotGate extends BasicComponent {
-       private WireArray in, out;
-       private WireArrayInput outI;
+public class NotGate extends BasicComponent
+{
+       private WireEnd in;
+       private WireEnd out;
 
-       public NotGate(int processTime, WireArray in, WireArray out) {
+       public NotGate(int processTime, WireEnd in, WireEnd out)
+       {
                super(processTime);
                this.in = in;
                in.addObserver(this);
                this.out = out;
-               outI = out.createInput();
        }
 
-       public void compute() {
-               outI.feedSignals(Util.not(in.getValues()));
+       @Override
+       protected void compute()
+       {
+               out.feedSignals(Util.not(in.getValues()));
        }
 
-       public WireArray getIn() {
+       public WireEnd getIn()
+       {
                return in;
        }
 
-       public WireArray getOut() {
+       public WireEnd getOut()
+       {
                return out;
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
-               return Collections.unmodifiableList(Arrays.asList(in));
+       public List<WireEnd> getAllInputs()
+       {
+               return List.of(in);
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
-               return Collections.unmodifiableList(Arrays.asList(out));
+       public List<WireEnd> getAllOutputs()
+       {
+               return List.of(out);
        }
 }