Did some clean up
[Mograsim.git] / era.mi / src / era / mi / logic / components / TriStateBuffer.java
index c21c476..f672a2d 100644 (file)
@@ -1,49 +1,50 @@
-package era.mi.logic.components;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import era.mi.logic.Bit;
-import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
-
-public class TriStateBuffer extends BasicComponent{
-       WireArray in, enable;
-       WireArrayInput outI;
-       
-       public TriStateBuffer(int processTime, WireArray in, WireArray out, WireArray enable) {
-               super(processTime);
-               if(in.length != out.length)
-                       throw new IllegalArgumentException("Tri-state output must have the same amount of bits as the input. Input: " + in.length + " Output: " + out.length);
-               if(enable.length != 1)
-                       throw new IllegalArgumentException("Tri-state enable must have exactly one bit, not " + enable.length + ".");
-               this.in = in;
-               in.addObserver(this);
-               this.enable = enable;
-               enable.addObserver(this);
-               outI = out.createInput();
-       }
-       
-       @Override
-       protected void compute()
-       {
-               if(enable.getValue() == Bit.ONE)
-                       outI.feedSignals(in.getValues());
-               else
-                       outI.clearSignals();
-       }
-
-       @Override
-       public List<WireArray> getAllInputs()
-       {
-               return Collections.unmodifiableList(Arrays.asList(in, enable));
-       }
-
-       @Override
-       public List<WireArray> getAllOutputs()
-       {
-               return Collections.unmodifiableList(Arrays.asList(outI.owner));
-       }
-
-}
+package era.mi.logic.components;\r
+\r
+import java.util.List;\r
+\r
+import era.mi.logic.Bit;\r
+import era.mi.logic.wires.WireArray;\r
+import era.mi.logic.wires.WireArray.WireArrayEnd;\r
+\r
+public class TriStateBuffer extends BasicComponent\r
+{\r
+       WireArray in, enable;\r
+       WireArrayEnd outI;\r
+\r
+       public TriStateBuffer(int processTime, WireArray in, WireArray out, WireArray enable)\r
+       {\r
+               super(processTime);\r
+               if (in.length != out.length)\r
+                       throw new IllegalArgumentException(\r
+                                       "Tri-state output must have the same amount of bits as the input. Input: " + in.length + " Output: " + out.length);\r
+               if (enable.length != 1)\r
+                       throw new IllegalArgumentException("Tri-state enable must have exactly one bit, not " + enable.length + ".");\r
+               this.in = in;\r
+               in.addObserver(this);\r
+               this.enable = enable;\r
+               enable.addObserver(this);\r
+               outI = out.createInput();\r
+       }\r
+\r
+       @Override\r
+       protected void compute()\r
+       {\r
+               if (enable.getValue() == Bit.ONE)\r
+                       outI.feedSignals(in.getValues());\r
+               else\r
+                       outI.clearSignals();\r
+       }\r
+\r
+       @Override\r
+       public List<WireArray> getAllInputs()\r
+       {\r
+               return List.of(in, enable);\r
+       }\r
+\r
+       @Override\r
+       public List<WireArray> getAllOutputs()\r
+       {\r
+               return List.of(outI.owner);\r
+       }\r
+\r
+}\r