9da8c8c55bcdd16a9e86717d6102c501c944b720
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIor_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 GUIor_4 extends SimpleRectangularSubmodelComponent
12 {
13         public GUIor_4(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUIor_4");
16                 setSubmodelScale(.4);
17                 setInputPins("A1", "A2", "A3", "A4", "B1", "B2", "B3", "B4");
18                 setOutputPins("Y1", "Y2", "Y3", "Y4");
19                 initSubmodelComponents();
20         }
21
22         @SuppressWarnings("unused") // for GUIWires being created
23         private void initSubmodelComponents()
24         {
25                 Pin A1 = getInputSubmodelPins().get(0);
26                 Pin A2 = getInputSubmodelPins().get(1);
27                 Pin A3 = getInputSubmodelPins().get(2);
28                 Pin A4 = getInputSubmodelPins().get(3);
29                 Pin B1 = getInputSubmodelPins().get(4);
30                 Pin B2 = getInputSubmodelPins().get(5);
31                 Pin B3 = getInputSubmodelPins().get(6);
32                 Pin B4 = getInputSubmodelPins().get(7);
33                 Pin Y1 = getOutputSubmodelPins().get(0);
34                 Pin Y2 = getOutputSubmodelPins().get(1);
35                 Pin Y3 = getOutputSubmodelPins().get(2);
36                 Pin Y4 = getOutputSubmodelPins().get(3);
37
38                 GUINandGate notA1 = new GUINandGate(submodelModifiable, 1);
39                 GUINandGate notA2 = new GUINandGate(submodelModifiable, 1);
40                 GUINandGate notA3 = new GUINandGate(submodelModifiable, 1);
41                 GUINandGate notA4 = new GUINandGate(submodelModifiable, 1);
42                 GUINandGate notB1 = new GUINandGate(submodelModifiable, 1);
43                 GUINandGate notB2 = new GUINandGate(submodelModifiable, 1);
44                 GUINandGate notB3 = new GUINandGate(submodelModifiable, 1);
45                 GUINandGate notB4 = new GUINandGate(submodelModifiable, 1);
46                 GUINandGate nandY1 = new GUINandGate(submodelModifiable, 1);
47                 GUINandGate nandY2 = new GUINandGate(submodelModifiable, 1);
48                 GUINandGate nandY3 = new GUINandGate(submodelModifiable, 1);
49                 GUINandGate nandY4 = new GUINandGate(submodelModifiable, 1);
50
51                 WireCrossPoint cpA1 = new WireCrossPoint(submodelModifiable, 1);
52                 WireCrossPoint cpA2 = new WireCrossPoint(submodelModifiable, 1);
53                 WireCrossPoint cpA3 = new WireCrossPoint(submodelModifiable, 1);
54                 WireCrossPoint cpA4 = new WireCrossPoint(submodelModifiable, 1);
55                 WireCrossPoint cpB1 = new WireCrossPoint(submodelModifiable, 1);
56                 WireCrossPoint cpB2 = new WireCrossPoint(submodelModifiable, 1);
57                 WireCrossPoint cpB3 = new WireCrossPoint(submodelModifiable, 1);
58                 WireCrossPoint cpB4 = new WireCrossPoint(submodelModifiable, 1);
59
60                 notA1.moveTo(15, 2.5);
61                 notA2.moveTo(15, 27.5);
62                 notA3.moveTo(15, 52.5);
63                 notA4.moveTo(15, 77.5);
64                 notB1.moveTo(15, 102.5);
65                 notB2.moveTo(15, 127.5);
66                 notB3.moveTo(15, 152.5);
67                 notB4.moveTo(15, 177.5);
68                 nandY1.moveTo(65, 2.5);
69                 nandY2.moveTo(65, 27.5);
70                 nandY3.moveTo(65, 52.5);
71                 nandY4.moveTo(65, 77.5);
72                 cpA1.moveCenterTo(7.5, 12.5);
73                 cpA2.moveCenterTo(7.5, 37.5);
74                 cpA3.moveCenterTo(7.5, 62.5);
75                 cpA4.moveCenterTo(7.5, 87.5);
76                 cpB1.moveCenterTo(7.5, 112.5);
77                 cpB2.moveCenterTo(7.5, 137.5);
78                 cpB3.moveCenterTo(7.5, 162.5);
79                 cpB4.moveCenterTo(7.5, 187.5);
80
81                 new GUIWire(submodelModifiable, A1, cpA1, new Point[0]);
82                 new GUIWire(submodelModifiable, A2, cpA2, new Point[0]);
83                 new GUIWire(submodelModifiable, A3, cpA3, new Point[0]);
84                 new GUIWire(submodelModifiable, A4, cpA4, new Point[0]);
85                 new GUIWire(submodelModifiable, B1, cpB1, new Point[0]);
86                 new GUIWire(submodelModifiable, B2, cpB2, new Point[0]);
87                 new GUIWire(submodelModifiable, B3, cpB3, new Point[0]);
88                 new GUIWire(submodelModifiable, B4, cpB4, new Point[0]);
89                 new GUIWire(submodelModifiable, cpA1, notA1.getInputPins().get(0), new Point(7.5, 7.5));
90                 new GUIWire(submodelModifiable, cpA1, notA1.getInputPins().get(1), new Point(7.5, 17.5));
91                 new GUIWire(submodelModifiable, cpA2, notA2.getInputPins().get(0), new Point(7.5, 32.5));
92                 new GUIWire(submodelModifiable, cpA2, notA2.getInputPins().get(1), new Point(7.5, 42.5));
93                 new GUIWire(submodelModifiable, cpA3, notA3.getInputPins().get(0), new Point(7.5, 57.5));
94                 new GUIWire(submodelModifiable, cpA3, notA3.getInputPins().get(1), new Point(7.5, 67.5));
95                 new GUIWire(submodelModifiable, cpA4, notA4.getInputPins().get(0), new Point(7.5, 82.5));
96                 new GUIWire(submodelModifiable, cpA4, notA4.getInputPins().get(1), new Point(7.5, 92.5));
97                 new GUIWire(submodelModifiable, cpB1, notB1.getInputPins().get(0), new Point(7.5, 107.5));
98                 new GUIWire(submodelModifiable, cpB1, notB1.getInputPins().get(1), new Point(7.5, 117.5));
99                 new GUIWire(submodelModifiable, cpB2, notB2.getInputPins().get(0), new Point(7.5, 132.5));
100                 new GUIWire(submodelModifiable, cpB2, notB2.getInputPins().get(1), new Point(7.5, 142.5));
101                 new GUIWire(submodelModifiable, cpB3, notB3.getInputPins().get(0), new Point(7.5, 157.5));
102                 new GUIWire(submodelModifiable, cpB3, notB3.getInputPins().get(1), new Point(7.5, 167.5));
103                 new GUIWire(submodelModifiable, cpB4, notB4.getInputPins().get(0), new Point(7.5, 182.5));
104                 new GUIWire(submodelModifiable, cpB4, notB4.getInputPins().get(1), new Point(7.5, 192.5));
105                 new GUIWire(submodelModifiable, notA1.getOutputPin(), nandY1.getInputPins().get(0), new Point(40, 12.5), new Point(40, 7.5));
106                 new GUIWire(submodelModifiable, notB1.getOutputPin(), nandY1.getInputPins().get(1), new Point(45, 112.5), new Point(45, 17.5));
107                 new GUIWire(submodelModifiable, notA2.getOutputPin(), nandY2.getInputPins().get(0), new Point(40, 37.5), new Point(40, 32.5));
108                 new GUIWire(submodelModifiable, notB2.getOutputPin(), nandY2.getInputPins().get(1), new Point(50, 137.5), new Point(50, 42.5));
109                 new GUIWire(submodelModifiable, notA3.getOutputPin(), nandY3.getInputPins().get(0), new Point(40, 62.5), new Point(40, 57.5));
110                 new GUIWire(submodelModifiable, notB3.getOutputPin(), nandY3.getInputPins().get(1), new Point(55, 162.5), new Point(55, 67.5));
111                 new GUIWire(submodelModifiable, notA4.getOutputPin(), nandY4.getInputPins().get(0), new Point(40, 87.5), new Point(40, 82.5));
112                 new GUIWire(submodelModifiable, notB4.getOutputPin(), nandY4.getInputPins().get(1), new Point(60, 187.5), new Point(60, 92.5));
113                 new GUIWire(submodelModifiable, nandY1.getOutputPin(), Y1, new Point[0]);
114                 new GUIWire(submodelModifiable, nandY2.getOutputPin(), Y2, new Point[0]);
115                 new GUIWire(submodelModifiable, nandY3.getOutputPin(), Y3, new Point[0]);
116                 new GUIWire(submodelModifiable, nandY4.getOutputPin(), Y4, new Point[0]);
117         }
118 }