Implemented GUIandor414
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIandor414.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.SubmodelComponent;
6 import net.mograsim.logic.ui.model.wires.GUIWire;
7 import net.mograsim.logic.ui.model.wires.Pin;
8
9 public class GUIandor414 extends SubmodelComponent
10 {
11         private final Pin pinC1;
12         private final Pin pinC2;
13         private final Pin pinC3;
14         private final Pin pinC4;
15         private final Pin pinA1;
16         private final Pin pinA2;
17         private final Pin pinA3;
18         private final Pin pinA4;
19         private final Pin pinB;
20         private final Pin pinY1;
21         private final Pin pinY2;
22         private final Pin pinY3;
23         private final Pin pinY4;
24
25         public GUIandor414(ViewModelModifiable model)
26         {
27                 super(model, "GUIandor414");
28                 setSize(50, 90);
29                 setSubmodelScale(.4);
30
31                 Pin C1 = addSubmodelInterface(1, 0, 5);
32                 Pin C2 = addSubmodelInterface(1, 0, 15);
33                 Pin C3 = addSubmodelInterface(1, 0, 25);
34                 Pin C4 = addSubmodelInterface(1, 0, 35);
35                 Pin A1 = addSubmodelInterface(1, 0, 45);
36                 Pin A2 = addSubmodelInterface(1, 0, 55);
37                 Pin A3 = addSubmodelInterface(1, 0, 65);
38                 Pin A4 = addSubmodelInterface(1, 0, 75);
39                 Pin B = addSubmodelInterface(1, 0, 85);
40                 Pin Y1 = addSubmodelInterface(1, 50, 5);
41                 Pin Y2 = addSubmodelInterface(1, 50, 15);
42                 Pin Y3 = addSubmodelInterface(1, 50, 25);
43                 Pin Y4 = addSubmodelInterface(1, 50, 35);
44
45                 this.pinC1 = getSupermodelPin(C1);
46                 this.pinC2 = getSupermodelPin(C2);
47                 this.pinC3 = getSupermodelPin(C3);
48                 this.pinC4 = getSupermodelPin(C4);
49                 this.pinA1 = getSupermodelPin(A1);
50                 this.pinA2 = getSupermodelPin(A2);
51                 this.pinA3 = getSupermodelPin(A3);
52                 this.pinA4 = getSupermodelPin(A4);
53                 this.pinB = getSupermodelPin(B);
54                 this.pinY1 = getSupermodelPin(Y1);
55                 this.pinY2 = getSupermodelPin(Y2);
56                 this.pinY3 = getSupermodelPin(Y3);
57                 this.pinY4 = getSupermodelPin(Y4);
58
59                 initSubmodelComponents(C1, C2, C3, C4, A1, A2, A3, A4, B, Y1, Y2, Y3, Y4);
60         }
61
62         @SuppressWarnings("unused") // for GUIWires being created
63         private void initSubmodelComponents(Pin C1, Pin C2, Pin C3, Pin C4, Pin A1, Pin A2, Pin A3, Pin A4, Pin B, Pin Y1, Pin Y2, Pin Y3,
64                         Pin Y4)
65         {
66                 GUIand41 and = new GUIand41(submodelModifiable);
67                 GUIor_4 or = new GUIor_4(submodelModifiable);
68
69                 and.moveTo(15, 137.5);
70                 or.moveTo(55, 97.5);
71
72                 new GUIWire(submodelModifiable, A1, and.getPinA1(), new Point(10, 112.5), new Point(10, 142.5));
73                 new GUIWire(submodelModifiable, A2, and.getPinA2(), new Point(5, 137.5), new Point(5, 152.5));
74                 new GUIWire(submodelModifiable, A3, and.getPinA3());
75                 new GUIWire(submodelModifiable, A4, and.getPinA4(), new Point(5, 187.5), new Point(5, 172.5));
76                 new GUIWire(submodelModifiable, B, and.getPinB(), new Point(10, 212.5), new Point(10, 187.5));
77                 new GUIWire(submodelModifiable, C1, or.getPinA1(), new Point(50, 12.5), new Point(50, 102.5));
78                 new GUIWire(submodelModifiable, C2, or.getPinA2(), new Point(45, 37.5), new Point(45, 112.5));
79                 new GUIWire(submodelModifiable, C3, or.getPinA3(), new Point(40, 62.5), new Point(40, 122.5));
80                 new GUIWire(submodelModifiable, C4, or.getPinA4(), new Point(35, 87.5), new Point(35, 132.5));
81                 new GUIWire(submodelModifiable, and.getPinY1(), or.getPinB1());
82                 new GUIWire(submodelModifiable, and.getPinY2(), or.getPinB2());
83                 new GUIWire(submodelModifiable, and.getPinY3(), or.getPinB3());
84                 new GUIWire(submodelModifiable, and.getPinY4(), or.getPinB4());
85                 new GUIWire(submodelModifiable, or.getPinY1(), Y1, new Point(100, 102.5), new Point(100, 12.5));
86                 new GUIWire(submodelModifiable, or.getPinY2(), Y2, new Point(105, 112.5), new Point(105, 37.5));
87                 new GUIWire(submodelModifiable, or.getPinY3(), Y3, new Point(110, 122.5), new Point(110, 62.5));
88                 new GUIWire(submodelModifiable, or.getPinY4(), Y4, new Point(115, 132.5), new Point(115, 87.5));
89         }
90
91         public Pin getPinC1()
92         {
93                 return pinC1;
94         }
95
96         public Pin getPinC2()
97         {
98                 return pinC2;
99         }
100
101         public Pin getPinC3()
102         {
103                 return pinC3;
104         }
105
106         public Pin getPinC4()
107         {
108                 return pinC4;
109         }
110
111         public Pin getPinA1()
112         {
113                 return pinA1;
114         }
115
116         public Pin getPinA2()
117         {
118                 return pinA2;
119         }
120
121         public Pin getPinA3()
122         {
123                 return pinA3;
124         }
125
126         public Pin getPinA4()
127         {
128                 return pinA4;
129         }
130
131         public Pin getPinB()
132         {
133                 return pinB;
134         }
135
136         public Pin getPinY1()
137         {
138                 return pinY1;
139         }
140
141         public Pin getPinY2()
142         {
143                 return pinY2;
144         }
145
146         public Pin getPinY3()
147         {
148                 return pinY3;
149         }
150
151         public Pin getPinY4()
152         {
153                 return pinY4;
154         }
155
156 }