Changed GUIram2/4's cell order for high level state ID "q"
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / model / components / mi / nandbased / GUIsel3_4.java
1 package net.mograsim.logic.model.model.components.mi.nandbased;
2
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.model.model.ViewModelModifiable;
5 import net.mograsim.logic.model.model.components.atomic.GUINandGate;
6 import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.model.model.wires.GUIWire;
8 import net.mograsim.logic.model.model.wires.Pin;
9 import net.mograsim.logic.model.model.wires.WireCrossPoint;
10 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
11
12 public class GUIsel3_4 extends SimpleRectangularSubmodelComponent
13 {
14         public GUIsel3_4(ViewModelModifiable model)
15         {
16                 this(model, null);
17         }
18
19         public GUIsel3_4(ViewModelModifiable model, String name)
20         {
21                 super(model, 1, "GUIsel3_4", name);
22                 setSubmodelScale(.2);
23                 setInputPins("SA", "SB", "SC", "A1", "A2", "A3", "A4", "B1", "B2", "B3", "B4", "C1", "C2", "C3", "C4");
24                 setOutputPins("Y1", "Y2", "Y3", "Y4");
25                 initSubmodelComponents();
26         }
27
28         @SuppressWarnings("unused") // for GUIWires being created
29         private void initSubmodelComponents()
30         {
31                 Pin SA = getSubmodelPin("SA");
32                 Pin SB = getSubmodelPin("SB");
33                 Pin SC = getSubmodelPin("SC");
34                 Pin A1 = getSubmodelPin("A1");
35                 Pin A2 = getSubmodelPin("A2");
36                 Pin A3 = getSubmodelPin("A3");
37                 Pin A4 = getSubmodelPin("A4");
38                 Pin B1 = getSubmodelPin("B1");
39                 Pin B2 = getSubmodelPin("B2");
40                 Pin B3 = getSubmodelPin("B3");
41                 Pin B4 = getSubmodelPin("B4");
42                 Pin C1 = getSubmodelPin("C1");
43                 Pin C2 = getSubmodelPin("C2");
44                 Pin C3 = getSubmodelPin("C3");
45                 Pin C4 = getSubmodelPin("C4");
46                 Pin Y1 = getSubmodelPin("Y1");
47                 Pin Y2 = getSubmodelPin("Y2");
48                 Pin Y3 = getSubmodelPin("Y3");
49                 Pin Y4 = getSubmodelPin("Y4");
50
51                 GUIsel2_4 sel2_4 = new GUIsel2_4(submodelModifiable);
52                 GUInot4 not4 = new GUInot4(submodelModifiable);
53                 GUINandGate nandC1 = new GUINandGate(submodelModifiable, 1);
54                 GUINandGate nandC2 = new GUINandGate(submodelModifiable, 1);
55                 GUINandGate nandC3 = new GUINandGate(submodelModifiable, 1);
56                 GUINandGate nandC4 = new GUINandGate(submodelModifiable, 1);
57                 GUINandGate nandY1 = new GUINandGate(submodelModifiable, 1);
58                 GUINandGate nandY2 = new GUINandGate(submodelModifiable, 1);
59                 GUINandGate nandY3 = new GUINandGate(submodelModifiable, 1);
60                 GUINandGate nandY4 = new GUINandGate(submodelModifiable, 1);
61
62                 WireCrossPoint cpSC1 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cpSC2 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cpSC3 = new WireCrossPoint(submodelModifiable, 1);
65
66                 sel2_4.moveTo(35, 250);
67                 not4.moveTo(75, 250);
68                 nandC1.moveTo(50, 570);
69                 nandC2.moveTo(50, 620);
70                 nandC3.moveTo(50, 670);
71                 nandC4.moveTo(50, 720);
72                 nandY1.moveTo(152.5, 15);
73                 nandY2.moveTo(152.5, 65);
74                 nandY3.moveTo(152.5, 115);
75                 nandY4.moveTo(152.5, 165);
76                 cpSC1.moveCenterTo(30, 585);
77                 cpSC2.moveCenterTo(30, 635);
78                 cpSC3.moveCenterTo(30, 685);
79
80                 new GUIWire(submodelModifiable, SA, sel2_4.getPin("SA"), new Point(25, 25), new Point(25, 255));
81                 new GUIWire(submodelModifiable, SB, sel2_4.getPin("SB"), new Point(20, 75), new Point(20, 265));
82                 new GUIWire(submodelModifiable, A1, sel2_4.getPin("A1"), new Point(15, 175), new Point(15, 275));
83                 new GUIWire(submodelModifiable, A2, sel2_4.getPin("A2"), new Point(10, 225), new Point(10, 285));
84                 new GUIWire(submodelModifiable, A3, sel2_4.getPin("A3"), new Point(5, 275), new Point(5, 295));
85                 new GUIWire(submodelModifiable, A4, sel2_4.getPin("A4"), new Point(5, 325), new Point(5, 305));
86                 new GUIWire(submodelModifiable, B1, sel2_4.getPin("B1"), new Point(10, 375), new Point(10, 315));
87                 new GUIWire(submodelModifiable, B2, sel2_4.getPin("B2"), new Point(15, 425), new Point(15, 325));
88                 new GUIWire(submodelModifiable, B3, sel2_4.getPin("B3"), new Point(20, 475), new Point(20, 335));
89                 new GUIWire(submodelModifiable, B4, sel2_4.getPin("B4"), new Point(25, 525), new Point(25, 345));
90                 new GUIWire(submodelModifiable, sel2_4.getPin("Y1"), not4.getPin("A1"), new Point[0]);
91                 new GUIWire(submodelModifiable, sel2_4.getPin("Y2"), not4.getPin("A2"), new Point[0]);
92                 new GUIWire(submodelModifiable, sel2_4.getPin("Y3"), not4.getPin("A3"), new Point[0]);
93                 new GUIWire(submodelModifiable, sel2_4.getPin("Y4"), not4.getPin("A4"), new Point[0]);
94                 new GUIWire(submodelModifiable, SC, cpSC1, new Point(30, 125));
95                 new GUIWire(submodelModifiable, cpSC1, nandC1.getPin("B"), new Point[0]);
96                 new GUIWire(submodelModifiable, cpSC1, cpSC2, new Point(30, 125));
97                 new GUIWire(submodelModifiable, cpSC2, nandC2.getPin("B"), new Point[0]);
98                 new GUIWire(submodelModifiable, cpSC2, cpSC3, new Point(30, 125));
99                 new GUIWire(submodelModifiable, cpSC3, nandC3.getPin("B"), new Point[0]);
100                 new GUIWire(submodelModifiable, cpSC3, nandC4.getPin("B"), new Point(30, 735));
101                 new GUIWire(submodelModifiable, C1, nandC1.getPin("A"), new Point[0]);
102                 new GUIWire(submodelModifiable, C2, nandC2.getPin("A"), new Point[0]);
103                 new GUIWire(submodelModifiable, C3, nandC3.getPin("A"), new Point[0]);
104                 new GUIWire(submodelModifiable, C4, nandC4.getPin("A"), new Point[0]);
105                 new GUIWire(submodelModifiable, not4.getPin("Y1"), nandY1.getPin("A"), new Point(115, 255), new Point(115, 20));
106                 new GUIWire(submodelModifiable, not4.getPin("Y2"), nandY2.getPin("A"), new Point(120, 265), new Point(120, 70));
107                 new GUIWire(submodelModifiable, not4.getPin("Y3"), nandY3.getPin("A"), new Point(125, 275), new Point(125, 120));
108                 new GUIWire(submodelModifiable, not4.getPin("Y4"), nandY4.getPin("A"), new Point(130, 285), new Point(130, 170));
109                 new GUIWire(submodelModifiable, nandC1.getPin("Y"), nandY1.getPin("B"), new Point(135, 580), new Point(135, 30));
110                 new GUIWire(submodelModifiable, nandC2.getPin("Y"), nandY2.getPin("B"), new Point(140, 630), new Point(140, 80));
111                 new GUIWire(submodelModifiable, nandC3.getPin("Y"), nandY3.getPin("B"), new Point(145, 680), new Point(145, 130));
112                 new GUIWire(submodelModifiable, nandC4.getPin("Y"), nandY4.getPin("B"), new Point(150, 730), new Point(150, 180));
113                 new GUIWire(submodelModifiable, nandY1.getPin("Y"), Y1, new Point[0]);
114                 new GUIWire(submodelModifiable, nandY2.getPin("Y"), Y2, new Point[0]);
115                 new GUIWire(submodelModifiable, nandY3.getPin("Y"), Y3, new Point[0]);
116                 new GUIWire(submodelModifiable, nandY4.getPin("Y"), Y4, new Point[0]);
117         }
118
119         static
120         {
121                 IndirectGUIComponentCreator.setComponentSupplier(GUIsel3_4.class.getCanonicalName(), (m, p, n) -> new GUIsel3_4(m, n));
122         }
123 }