added demux; added getAllInputs() and getAllOutputs() for all components
[Mograsim.git] / era.mi / src / era / mi / logic / components / Mux.java
index 0fd7fd4..4e09f92 100644 (file)
@@ -1,5 +1,10 @@
 package era.mi.logic.components;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
 import era.mi.logic.wires.WireArray;
 import era.mi.logic.wires.WireArray.WireArrayInput;
 
@@ -69,4 +74,18 @@ public class Mux extends BasicComponent
                WireArray active = inputs[selectValue];
                outI.feedSignals(active.getValues());
        }
+
+       @Override
+       public List<WireArray> getAllInputs()
+       {
+               ArrayList<WireArray> wires = new ArrayList<WireArray>(Arrays.asList(inputs));
+               wires.add(select);
+               return Collections.unmodifiableList(wires);
+       }
+
+       @Override
+       public List<WireArray> getAllOutputs()
+       {
+               return Collections.unmodifiableList(Arrays.asList(outI.owner));
+       }
 }