Made GUIand41 prettier
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIand41.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 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
9
10 public class GUIand41 extends SubmodelComponent
11 {
12         private final Pin pinA1;
13         private final Pin pinA2;
14         private final Pin pinA3;
15         private final Pin pinA4;
16         private final Pin pinB;
17         private final Pin pinY1;
18         private final Pin pinY2;
19         private final Pin pinY3;
20         private final Pin pinY4;
21
22         public GUIand41(ViewModelModifiable model)
23         {
24                 super(model, "GUIand41");
25                 setSize(35, 55);
26                 setSubmodelScale(.4);
27
28                 Pin A1 = addSubmodelInterface(1, 0, 5);
29                 Pin A2 = addSubmodelInterface(1, 0, 15);
30                 Pin A3 = addSubmodelInterface(1, 0, 25);
31                 Pin A4 = addSubmodelInterface(1, 0, 35);
32                 Pin B = addSubmodelInterface(1, 0, 50);
33                 Pin Y1 = addSubmodelInterface(1, 35, 5);
34                 Pin Y2 = addSubmodelInterface(1, 35, 15);
35                 Pin Y3 = addSubmodelInterface(1, 35, 25);
36                 Pin Y4 = addSubmodelInterface(1, 35, 35);
37
38                 this.pinA1 = getSupermodelPin(A1);
39                 this.pinA2 = getSupermodelPin(A2);
40                 this.pinA3 = getSupermodelPin(A3);
41                 this.pinA4 = getSupermodelPin(A4);
42                 this.pinB = getSupermodelPin(B);
43                 this.pinY1 = getSupermodelPin(Y1);
44                 this.pinY2 = getSupermodelPin(Y2);
45                 this.pinY3 = getSupermodelPin(Y3);
46                 this.pinY4 = getSupermodelPin(Y4);
47
48                 initSubmodelComponents(A1, A2, A3, A4, B, Y1, Y2, Y3, Y4);
49         }
50
51         @SuppressWarnings("unused") // for GUIWires being created
52         private void initSubmodelComponents(Pin A1, Pin A2, Pin A3, Pin A4, Pin B, Pin Y1, Pin Y2, Pin Y3, Pin Y4)
53         {
54                 GUIand and1 = new GUIand(submodelModifiable);
55                 GUIand and2 = new GUIand(submodelModifiable);
56                 GUIand and3 = new GUIand(submodelModifiable);
57                 GUIand and4 = new GUIand(submodelModifiable);
58
59                 WireCrossPoint cpB2 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpB3 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpB4 = new WireCrossPoint(submodelModifiable, 1);
62
63                 and1.moveTo(30, 7.5);
64                 and2.moveTo(30, 32.5);
65                 and3.moveTo(30, 57.5);
66                 and4.moveTo(30, 82.5);
67                 cpB2.moveTo(25, 52.5);
68                 cpB3.moveTo(25, 77.5);
69                 cpB4.moveTo(25, 102.5);
70
71                 new GUIWire(submodelModifiable, A1, and1.getPinA());
72                 new GUIWire(submodelModifiable, A2, and2.getPinA());
73                 new GUIWire(submodelModifiable, A3, and3.getPinA());
74                 new GUIWire(submodelModifiable, A4, and4.getPinA());
75                 new GUIWire(submodelModifiable, B, cpB4.getPin(), new Point(25, 125));
76                 new GUIWire(submodelModifiable, cpB4.getPin(), and4.getPinB());
77                 new GUIWire(submodelModifiable, cpB4.getPin(), cpB3.getPin());
78                 new GUIWire(submodelModifiable, cpB3.getPin(), and3.getPinB());
79                 new GUIWire(submodelModifiable, cpB3.getPin(), cpB2.getPin());
80                 new GUIWire(submodelModifiable, cpB2.getPin(), and2.getPinB());
81                 new GUIWire(submodelModifiable, cpB2.getPin(), and1.getPinB(), new Point(25, 27.5));
82                 new GUIWire(submodelModifiable, and1.getPinY(), Y1, new Point(75, 20), new Point(75, 12.5));
83                 new GUIWire(submodelModifiable, and2.getPinY(), Y2, new Point(75, 45), new Point(75, 37.5));
84                 new GUIWire(submodelModifiable, and3.getPinY(), Y3, new Point(75, 70), new Point(75, 62.5));
85                 new GUIWire(submodelModifiable, and4.getPinY(), Y4, new Point(75, 95), new Point(75, 87.5));
86         }
87
88         public Pin getPinA1()
89         {
90                 return pinA1;
91         }
92
93         public Pin getPinA2()
94         {
95                 return pinA2;
96         }
97
98         public Pin getPinA3()
99         {
100                 return pinA3;
101         }
102
103         public Pin getPinA4()
104         {
105                 return pinA4;
106         }
107
108         public Pin getPinB()
109         {
110                 return pinB;
111         }
112
113         public Pin getPinY1()
114         {
115                 return pinY1;
116         }
117
118         public Pin getPinY2()
119         {
120                 return pinY2;
121         }
122
123         public Pin getPinY3()
124         {
125                 return pinY3;
126         }
127
128         public Pin getPinY4()
129         {
130                 return pinY4;
131         }
132 }