Renamed mograsim to net.mograsim
[Mograsim.git] / era.mi / src / mograsim / logic / core / components / Splitter.java
diff --git a/era.mi/src/mograsim/logic/core/components/Splitter.java b/era.mi/src/mograsim/logic/core/components/Splitter.java
deleted file mode 100644 (file)
index 3474952..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-package mograsim.logic.core.components;
-
-import java.util.List;
-
-import mograsim.logic.core.timeline.Timeline;
-import mograsim.logic.core.types.BitVector;
-import mograsim.logic.core.wires.WireObserver;
-import mograsim.logic.core.wires.Wire.ReadEnd;
-import mograsim.logic.core.wires.Wire.ReadWriteEnd;
-
-public class Splitter extends Component implements WireObserver
-{
-       private ReadEnd input;
-       private ReadWriteEnd[] outputs;
-
-       public Splitter(Timeline timeline, ReadEnd input, ReadWriteEnd... outputs)
-       {
-               super(timeline);
-               this.input = input;
-               this.outputs = outputs;
-               input.addObserver(this);
-               int length = 0;
-               for (ReadEnd out : outputs)
-                       length += out.length();
-
-               if (input.length() != length)
-                       throw new IllegalArgumentException(
-                                       "The input of splitting one into n WireArrays must have length = a1.length() + a2.length() + ... + an.length().");
-       }
-
-       protected void compute()
-       {
-               BitVector inputBits = input.getValues();
-               int startIndex = 0;
-               for (int i = 0; i < outputs.length; i++)
-               {
-                       outputs[i].feedSignals(inputBits.subVector(startIndex, startIndex + outputs[i].length()));
-                       startIndex += outputs[i].length();
-               }
-       }
-
-       @Override
-       public void update(ReadEnd initiator, BitVector oldValues)
-       {
-               compute();
-       }
-
-       @Override
-       public List<ReadEnd> getAllInputs()
-       {
-               return List.of(input);
-       }
-
-       @Override
-       public List<ReadWriteEnd> getAllOutputs()
-       {
-               return List.of(outputs);
-       }
-}