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