Pins are now accessed via name, not index
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / am2901 / GUIAm2901SourceDecode.java
index 374f3e1..21e01aa 100644 (file)
@@ -22,14 +22,14 @@ public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
        @SuppressWarnings("unused") // for GUIWires being created
        private void initSubmodelComponents()
        {
-               Pin I2 = getInputSubmodelPins().get(0);
-               Pin I1 = getInputSubmodelPins().get(1);
-               Pin I0 = getInputSubmodelPins().get(2);
-               Pin SQ = getOutputSubmodelPins().get(0);
-               Pin RA = getOutputSubmodelPins().get(1);
-               Pin SB = getOutputSubmodelPins().get(2);
-               Pin SA = getOutputSubmodelPins().get(3);
-               Pin RD = getOutputSubmodelPins().get(4);
+               Pin I2 = getSubmodelPin("I2");
+               Pin I1 = getSubmodelPin("I1");
+               Pin I0 = getSubmodelPin("I0");
+               Pin SQ = getSubmodelPin("SQ");
+               Pin RA = getSubmodelPin("RA");
+               Pin SB = getSubmodelPin("SB");
+               Pin SA = getSubmodelPin("SA");
+               Pin RD = getSubmodelPin("RD");
 
                GUINandGate notI2 = new GUINandGate(submodelModifiable, 1);
                GUINandGate notI1 = new GUINandGate(submodelModifiable, 1);
@@ -97,56 +97,56 @@ public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent
                cpNand35.moveCenterTo(95, 180);
 
                new GUIWire(submodelModifiable, I2, cpI21, new Point[0]);
-               new GUIWire(submodelModifiable, cpI21, nand21.getInputPins().get(0), new Point(5, 5), new Point(35, 5), new Point(35, 15));
+               new GUIWire(submodelModifiable, cpI21, nand21.getPin("A"), new Point(5, 5), new Point(35, 5), new Point(35, 15));
                new GUIWire(submodelModifiable, cpI21, cpI22, new Point[0]);
-               new GUIWire(submodelModifiable, cpI22, notI2.getInputPins().get(0), new Point(7.5, 15));
-               new GUIWire(submodelModifiable, cpI22, notI2.getInputPins().get(1), new Point(7.5, 25));
+               new GUIWire(submodelModifiable, cpI22, notI2.getPin("A"), new Point(7.5, 15));
+               new GUIWire(submodelModifiable, cpI22, notI2.getPin("B"), new Point(7.5, 25));
                new GUIWire(submodelModifiable, cpI21, cpI23, new Point[0]);
-               new GUIWire(submodelModifiable, cpI23, nand24.getInputPins().get(1), new Point[0]);
-               new GUIWire(submodelModifiable, cpI23, nand35.getInputPins().get(1), new Point(5, 195), new Point(65, 195), new Point(65, 185));
+               new GUIWire(submodelModifiable, cpI23, nand24.getPin("B"), new Point[0]);
+               new GUIWire(submodelModifiable, cpI23, nand35.getPin("B"), new Point(5, 195), new Point(65, 195), new Point(65, 185));
                new GUIWire(submodelModifiable, I1, cpI1, new Point[0]);
-               new GUIWire(submodelModifiable, cpI1, notI1.getInputPins().get(0), new Point(7.5, 55));
-               new GUIWire(submodelModifiable, cpI1, notI1.getInputPins().get(1), new Point(7.5, 65));
+               new GUIWire(submodelModifiable, cpI1, notI1.getPin("A"), new Point(7.5, 55));
+               new GUIWire(submodelModifiable, cpI1, notI1.getPin("B"), new Point(7.5, 65));
                new GUIWire(submodelModifiable, I0, cpI01, new Point[0]);
-               new GUIWire(submodelModifiable, cpI01, notI0.getInputPins().get(0), new Point(7.5, 95));
+               new GUIWire(submodelModifiable, cpI01, notI0.getPin("A"), new Point(7.5, 95));
                new GUIWire(submodelModifiable, cpI01, cpI02, new Point[0]);
-               new GUIWire(submodelModifiable, cpI02, notI0.getInputPins().get(1), new Point[0]);
-               new GUIWire(submodelModifiable, cpI02, nand23.getInputPins().get(1), new Point(7.5, 112.5), new Point(32.5, 112.5),
+               new GUIWire(submodelModifiable, cpI02, notI0.getPin("B"), new Point[0]);
+               new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5),
                                new Point(32.5, 105));
-               new GUIWire(submodelModifiable, notI2.getOutputPin(), cpNotI2, new Point(32.5, 20));
-               new GUIWire(submodelModifiable, cpNotI2, nand22.getInputPins().get(0), new Point[0]);
-               new GUIWire(submodelModifiable, cpNotI2, nand23.getInputPins().get(0), new Point(32.5, 95));
-               new GUIWire(submodelModifiable, notI1.getOutputPin(), cpNotI11, new Point[0]);
-               new GUIWire(submodelModifiable, cpNotI11, nand21.getInputPins().get(1), new Point(35, 25));
+               new GUIWire(submodelModifiable, notI2.getPin("Y"), cpNotI2, new Point(32.5, 20));
+               new GUIWire(submodelModifiable, cpNotI2, nand22.getPin("A"), new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI2, nand23.getPin("A"), new Point(32.5, 95));
+               new GUIWire(submodelModifiable, notI1.getPin("Y"), cpNotI11, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI11, nand21.getPin("B"), new Point(35, 25));
                new GUIWire(submodelModifiable, cpNotI11, cpNotI12, new Point[0]);
-               new GUIWire(submodelModifiable, cpNotI12, nand22.getInputPins().get(1), new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI12, nand22.getPin("B"), new Point[0]);
                new GUIWire(submodelModifiable, cpNotI12, cpNotI13, new Point[0]);
-               new GUIWire(submodelModifiable, cpNotI13, nand24.getInputPins().get(0), new Point[0]);
-               new GUIWire(submodelModifiable, cpNotI13, nand25.getInputPins().get(0), new Point(35, 175));
-               new GUIWire(submodelModifiable, notI0.getOutputPin(), cpNotI0, new Point[0]);
-               new GUIWire(submodelModifiable, cpNotI0, nand31.getInputPins().get(1), new Point(37.5, 35), new Point(65, 35), new Point(65, 25));
-               new GUIWire(submodelModifiable, cpNotI0, nand25.getInputPins().get(1), new Point(37.5, 185));
-               new GUIWire(submodelModifiable, nand21.getOutputPin(), nand31.getInputPins().get(0));
-               new GUIWire(submodelModifiable, nand22.getOutputPin(), cpNand22, new Point[0]);
-               new GUIWire(submodelModifiable, cpNand22, nand32.getInputPins().get(0), new Point(65, 55));
-               new GUIWire(submodelModifiable, cpNand22, nand32.getInputPins().get(1), new Point(65, 65));
-               new GUIWire(submodelModifiable, nand23.getOutputPin(), cpNand23, new Point[0]);
-               new GUIWire(submodelModifiable, cpNand23, nand33.getInputPins().get(0), new Point(65, 95));
-               new GUIWire(submodelModifiable, cpNand23, nand33.getInputPins().get(1), new Point(65, 105));
-               new GUIWire(submodelModifiable, nand24.getOutputPin(), cpNand24, new Point[0]);
-               new GUIWire(submodelModifiable, cpNand24, nand34.getInputPins().get(0), new Point(65, 135));
-               new GUIWire(submodelModifiable, cpNand24, nand34.getInputPins().get(1), new Point(65, 145));
-               new GUIWire(submodelModifiable, nand25.getOutputPin(), nand35.getInputPins().get(0));
-               new GUIWire(submodelModifiable, nand31.getOutputPin(), cpNand31, new Point[0]);
-               new GUIWire(submodelModifiable, cpNand31, nand41.getInputPins().get(0), new Point(95, 15));
-               new GUIWire(submodelModifiable, cpNand31, nand41.getInputPins().get(1), new Point(95, 25));
-               new GUIWire(submodelModifiable, nand32.getOutputPin(), RA, new Point[0]);
-               new GUIWire(submodelModifiable, nand33.getOutputPin(), SB, new Point[0]);
-               new GUIWire(submodelModifiable, nand34.getOutputPin(), SA, new Point[0]);
-               new GUIWire(submodelModifiable, nand35.getOutputPin(), cpNand35, new Point[0]);
-               new GUIWire(submodelModifiable, cpNand35, nand42.getInputPins().get(0), new Point(95, 175));
-               new GUIWire(submodelModifiable, cpNand35, nand42.getInputPins().get(1), new Point(95, 185));
-               new GUIWire(submodelModifiable, nand41.getOutputPin(), SQ, new Point[0]);
-               new GUIWire(submodelModifiable, nand42.getOutputPin(), RD, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI13, nand24.getPin("A"), new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI13, nand25.getPin("A"), new Point(35, 175));
+               new GUIWire(submodelModifiable, notI0.getPin("Y"), cpNotI0, new Point[0]);
+               new GUIWire(submodelModifiable, cpNotI0, nand31.getPin("B"), new Point(37.5, 35), new Point(65, 35), new Point(65, 25));
+               new GUIWire(submodelModifiable, cpNotI0, nand25.getPin("B"), new Point(37.5, 185));
+               new GUIWire(submodelModifiable, nand21.getPin("Y"), nand31.getPin("A"));
+               new GUIWire(submodelModifiable, nand22.getPin("Y"), cpNand22, new Point[0]);
+               new GUIWire(submodelModifiable, cpNand22, nand32.getPin("A"), new Point(65, 55));
+               new GUIWire(submodelModifiable, cpNand22, nand32.getPin("B"), new Point(65, 65));
+               new GUIWire(submodelModifiable, nand23.getPin("Y"), cpNand23, new Point[0]);
+               new GUIWire(submodelModifiable, cpNand23, nand33.getPin("A"), new Point(65, 95));
+               new GUIWire(submodelModifiable, cpNand23, nand33.getPin("B"), new Point(65, 105));
+               new GUIWire(submodelModifiable, nand24.getPin("Y"), cpNand24, new Point[0]);
+               new GUIWire(submodelModifiable, cpNand24, nand34.getPin("A"), new Point(65, 135));
+               new GUIWire(submodelModifiable, cpNand24, nand34.getPin("B"), new Point(65, 145));
+               new GUIWire(submodelModifiable, nand25.getPin("Y"), nand35.getPin("A"));
+               new GUIWire(submodelModifiable, nand31.getPin("Y"), cpNand31, new Point[0]);
+               new GUIWire(submodelModifiable, cpNand31, nand41.getPin("A"), new Point(95, 15));
+               new GUIWire(submodelModifiable, cpNand31, nand41.getPin("B"), new Point(95, 25));
+               new GUIWire(submodelModifiable, nand32.getPin("Y"), RA, new Point[0]);
+               new GUIWire(submodelModifiable, nand33.getPin("Y"), SB, new Point[0]);
+               new GUIWire(submodelModifiable, nand34.getPin("Y"), SA, new Point[0]);
+               new GUIWire(submodelModifiable, nand35.getPin("Y"), cpNand35, new Point[0]);
+               new GUIWire(submodelModifiable, cpNand35, nand42.getPin("A"), new Point(95, 175));
+               new GUIWire(submodelModifiable, cpNand35, nand42.getPin("B"), new Point(95, 185));
+               new GUIWire(submodelModifiable, nand41.getPin("Y"), SQ, new Point[0]);
+               new GUIWire(submodelModifiable, nand42.getPin("Y"), RD, new Point[0]);
        }
 }
\ No newline at end of file