Pins are now accessed via name, not index
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIsel2_4.java
index f20bbb1..b2ba153 100644 (file)
@@ -22,20 +22,20 @@ public class GUIsel2_4 extends SimpleRectangularSubmodelComponent
        @SuppressWarnings("unused") // for GUIWires being created
        private void initSubmodelComponents()
        {
-               Pin SA = getInputSubmodelPins().get(0);
-               Pin SB = getInputSubmodelPins().get(1);
-               Pin A1 = getInputSubmodelPins().get(2);
-               Pin A2 = getInputSubmodelPins().get(3);
-               Pin A3 = getInputSubmodelPins().get(4);
-               Pin A4 = getInputSubmodelPins().get(5);
-               Pin B1 = getInputSubmodelPins().get(6);
-               Pin B2 = getInputSubmodelPins().get(7);
-               Pin B3 = getInputSubmodelPins().get(8);
-               Pin B4 = getInputSubmodelPins().get(9);
-               Pin Y1 = getOutputSubmodelPins().get(0);
-               Pin Y2 = getOutputSubmodelPins().get(1);
-               Pin Y3 = getOutputSubmodelPins().get(2);
-               Pin Y4 = getOutputSubmodelPins().get(3);
+               Pin SA = getSubmodelPin("SA");
+               Pin SB = getSubmodelPin("SB");
+               Pin A1 = getSubmodelPin("A1");
+               Pin A2 = getSubmodelPin("A2");
+               Pin A3 = getSubmodelPin("A3");
+               Pin A4 = getSubmodelPin("A4");
+               Pin B1 = getSubmodelPin("B1");
+               Pin B2 = getSubmodelPin("B2");
+               Pin B3 = getSubmodelPin("B3");
+               Pin B4 = getSubmodelPin("B4");
+               Pin Y1 = getSubmodelPin("Y1");
+               Pin Y2 = getSubmodelPin("Y2");
+               Pin Y3 = getSubmodelPin("Y3");
+               Pin Y4 = getSubmodelPin("Y4");
 
                GUINandGate nandA1 = new GUINandGate(submodelModifiable, 1);
                GUINandGate nandA2 = new GUINandGate(submodelModifiable, 1);
@@ -76,39 +76,39 @@ public class GUIsel2_4 extends SimpleRectangularSubmodelComponent
                cpA3.moveCenterTo(7.5, 117.5);
                cpB3.moveCenterTo(5, 142.5);
 
-               new GUIWire(submodelModifiable, A1, nandA1.getInputPins().get(0), new Point(15, 62.5), new Point(15, 7.5));
-               new GUIWire(submodelModifiable, A2, nandA2.getInputPins().get(0), new Point(17.5, 87.5), new Point(17.5, 57.5));
-               new GUIWire(submodelModifiable, A3, nandA3.getInputPins().get(0), new Point(17.5, 112.5), new Point(17.5, 107.5));
-               new GUIWire(submodelModifiable, A4, nandA4.getInputPins().get(0), new Point(17.5, 137.5), new Point(17.5, 157.5));
-               new GUIWire(submodelModifiable, B1, nandB1.getInputPins().get(0), new Point(10, 162.5), new Point(10, 32.5));
-               new GUIWire(submodelModifiable, B2, nandB2.getInputPins().get(0), new Point(12.5, 187.5), new Point(12.5, 82.5));
-               new GUIWire(submodelModifiable, B3, nandB3.getInputPins().get(0), new Point(15, 212.5), new Point(15, 132.5));
-               new GUIWire(submodelModifiable, B4, nandB4.getInputPins().get(0), new Point(10, 237.5), new Point(10, 182.5));
+               new GUIWire(submodelModifiable, A1, nandA1.getPin("A"), new Point(15, 62.5), new Point(15, 7.5));
+               new GUIWire(submodelModifiable, A2, nandA2.getPin("A"), new Point(17.5, 87.5), new Point(17.5, 57.5));
+               new GUIWire(submodelModifiable, A3, nandA3.getPin("A"), new Point(17.5, 112.5), new Point(17.5, 107.5));
+               new GUIWire(submodelModifiable, A4, nandA4.getPin("A"), new Point(17.5, 137.5), new Point(17.5, 157.5));
+               new GUIWire(submodelModifiable, B1, nandB1.getPin("A"), new Point(10, 162.5), new Point(10, 32.5));
+               new GUIWire(submodelModifiable, B2, nandB2.getPin("A"), new Point(12.5, 187.5), new Point(12.5, 82.5));
+               new GUIWire(submodelModifiable, B3, nandB3.getPin("A"), new Point(15, 212.5), new Point(15, 132.5));
+               new GUIWire(submodelModifiable, B4, nandB4.getPin("A"), new Point(10, 237.5), new Point(10, 182.5));
                new GUIWire(submodelModifiable, SA, cpA1);
                new GUIWire(submodelModifiable, SB, cpB1);
                new GUIWire(submodelModifiable, cpA1, cpA2);
-               new GUIWire(submodelModifiable, cpA1, nandA1.getInputPins().get(1));
+               new GUIWire(submodelModifiable, cpA1, nandA1.getPin("B"));
                new GUIWire(submodelModifiable, cpA2, cpA3);
-               new GUIWire(submodelModifiable, cpA2, nandA2.getInputPins().get(1));
-               new GUIWire(submodelModifiable, cpA3, nandA3.getInputPins().get(1));
-               new GUIWire(submodelModifiable, cpA3, nandA4.getInputPins().get(1), new Point(7.5, 167.5));
+               new GUIWire(submodelModifiable, cpA2, nandA2.getPin("B"));
+               new GUIWire(submodelModifiable, cpA3, nandA3.getPin("B"));
+               new GUIWire(submodelModifiable, cpA3, nandA4.getPin("B"), new Point(7.5, 167.5));
                new GUIWire(submodelModifiable, cpB1, cpB2);
-               new GUIWire(submodelModifiable, cpB1, nandB1.getInputPins().get(1));
+               new GUIWire(submodelModifiable, cpB1, nandB1.getPin("B"));
                new GUIWire(submodelModifiable, cpB2, cpB3);
-               new GUIWire(submodelModifiable, cpB2, nandB2.getInputPins().get(1));
-               new GUIWire(submodelModifiable, cpB3, nandB3.getInputPins().get(1));
-               new GUIWire(submodelModifiable, cpB3, nandB4.getInputPins().get(1), new Point(5, 192.5));
-               new GUIWire(submodelModifiable, nandA1.getOutputPin(), nandY1.getInputPins().get(0), new Point(42.5, 12.5), new Point(42.5, 7.5));
-               new GUIWire(submodelModifiable, nandB1.getOutputPin(), nandY1.getInputPins().get(1), new Point(45, 37.5), new Point(45, 17.5));
-               new GUIWire(submodelModifiable, nandA2.getOutputPin(), nandY2.getInputPins().get(0), new Point(47.5, 62.5), new Point(47.5, 32.5));
-               new GUIWire(submodelModifiable, nandB2.getOutputPin(), nandY2.getInputPins().get(1), new Point(50, 87.5), new Point(50, 42.5));
-               new GUIWire(submodelModifiable, nandA3.getOutputPin(), nandY3.getInputPins().get(0), new Point(52.5, 112.5), new Point(52.5, 57.5));
-               new GUIWire(submodelModifiable, nandB3.getOutputPin(), nandY3.getInputPins().get(1), new Point(55, 137.5), new Point(55, 67.5));
-               new GUIWire(submodelModifiable, nandA4.getOutputPin(), nandY4.getInputPins().get(0), new Point(57.5, 162.5), new Point(57.5, 82.5));
-               new GUIWire(submodelModifiable, nandB4.getOutputPin(), nandY4.getInputPins().get(1), new Point(60, 187.5), new Point(60, 92.5));
-               new GUIWire(submodelModifiable, nandY1.getOutputPin(), Y1, new Point[0]);
-               new GUIWire(submodelModifiable, nandY2.getOutputPin(), Y2, new Point[0]);
-               new GUIWire(submodelModifiable, nandY3.getOutputPin(), Y3, new Point[0]);
-               new GUIWire(submodelModifiable, nandY4.getOutputPin(), Y4, new Point[0]);
+               new GUIWire(submodelModifiable, cpB2, nandB2.getPin("B"));
+               new GUIWire(submodelModifiable, cpB3, nandB3.getPin("B"));
+               new GUIWire(submodelModifiable, cpB3, nandB4.getPin("B"), new Point(5, 192.5));
+               new GUIWire(submodelModifiable, nandA1.getPin("Y"), nandY1.getPin("A"), new Point(42.5, 12.5), new Point(42.5, 7.5));
+               new GUIWire(submodelModifiable, nandB1.getPin("Y"), nandY1.getPin("B"), new Point(45, 37.5), new Point(45, 17.5));
+               new GUIWire(submodelModifiable, nandA2.getPin("Y"), nandY2.getPin("A"), new Point(47.5, 62.5), new Point(47.5, 32.5));
+               new GUIWire(submodelModifiable, nandB2.getPin("Y"), nandY2.getPin("B"), new Point(50, 87.5), new Point(50, 42.5));
+               new GUIWire(submodelModifiable, nandA3.getPin("Y"), nandY3.getPin("A"), new Point(52.5, 112.5), new Point(52.5, 57.5));
+               new GUIWire(submodelModifiable, nandB3.getPin("Y"), nandY3.getPin("B"), new Point(55, 137.5), new Point(55, 67.5));
+               new GUIWire(submodelModifiable, nandA4.getPin("Y"), nandY4.getPin("A"), new Point(57.5, 162.5), new Point(57.5, 82.5));
+               new GUIWire(submodelModifiable, nandB4.getPin("Y"), nandY4.getPin("B"), new Point(60, 187.5), new Point(60, 92.5));
+               new GUIWire(submodelModifiable, nandY1.getPin("Y"), Y1, new Point[0]);
+               new GUIWire(submodelModifiable, nandY2.getPin("Y"), Y2, new Point[0]);
+               new GUIWire(submodelModifiable, nandY3.getPin("Y"), Y3, new Point[0]);
+               new GUIWire(submodelModifiable, nandY4.getPin("Y"), Y4, new Point[0]);
        }
 }
\ No newline at end of file