Added ModelSplitter.getOutputPin(int)
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 13 Dec 2020 02:47:54 +0000 (03:47 +0100)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 14 Jan 2021 14:44:02 +0000 (15:44 +0100)
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelSplitter.java

index 035e359..19ed99e 100644 (file)
@@ -36,6 +36,7 @@ public class ModelSplitter extends ModelComponent
        public final int logicWidth;
        private final OrientationCalculator oc;
        private final Pin inputPin;
+       private final Pin[] outputPins;
 
        private ReadEnd inputEnd;
        private final ReadEnd[] outputEnds;
@@ -55,8 +56,10 @@ public class ModelSplitter extends ModelComponent
                double inLineY = (logicWidth - 1) * heightPerPin / 2;
                addPin(this.inputPin = new Pin(model, this, "I", logicWidth, PinUsage.TRISTATE, oc.newX(0, inLineY), oc.newY(0, inLineY)));
                double outputHeight = (logicWidth - 1) * heightPerPin;
+               this.outputPins = new Pin[logicWidth];
                for (int i = 0; i < logicWidth; i++, outputHeight -= 10)
-                       addPin(new Pin(model, this, "O" + i, 1, PinUsage.TRISTATE, oc.newX(width, outputHeight), oc.newY(width, outputHeight)));
+                       addPin(outputPins[i] = new Pin(model, this, "O" + i, 1, PinUsage.TRISTATE, oc.newX(width, outputHeight),
+                                       oc.newY(width, outputHeight)));
                outputEnds = new ReadEnd[logicWidth];
 
                init();
@@ -123,6 +126,11 @@ public class ModelSplitter extends ModelComponent
                return inputPin;
        }
 
+       public Pin getOutputPin(int i)
+       {
+               return outputPins[i];
+       }
+
        /**
         * Used to leave bit order intuitive (MSB left or on top)
         */