Updated to new SWTHelper version
[Mograsim.git] / net.mograsim.logic.ui.am2900 / 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.submodels.SimpleRectangularSubmodelComponent;
6 import net.mograsim.logic.ui.model.wires.GUIWire;
7 import net.mograsim.logic.ui.model.wires.Pin;
8 import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
9
10 public class GUIandor414 extends SimpleRectangularSubmodelComponent
11 {
12         public GUIandor414(ViewModelModifiable model)
13         {
14                 this(model, null);
15         }
16
17         public GUIandor414(ViewModelModifiable model, String name)
18         {
19                 super(model, 1, "GUIandor414", name);
20                 setSubmodelScale(.4);
21                 setInputPins("C1", "C2", "C3", "C4", "A1", "A2", "A3", "A4", "B");
22                 setOutputPins("Y1", "Y2", "Y3", "Y4");
23                 initSubmodelComponents();
24         }
25
26         @SuppressWarnings("unused") // for GUIWires being created
27         private void initSubmodelComponents()
28         {
29                 Pin C1 = getSubmodelPin("C1");
30                 Pin C2 = getSubmodelPin("C2");
31                 Pin C3 = getSubmodelPin("C3");
32                 Pin C4 = getSubmodelPin("C4");
33                 Pin A1 = getSubmodelPin("A1");
34                 Pin A2 = getSubmodelPin("A2");
35                 Pin A3 = getSubmodelPin("A3");
36                 Pin A4 = getSubmodelPin("A4");
37                 Pin B = getSubmodelPin("B");
38                 Pin Y1 = getSubmodelPin("Y1");
39                 Pin Y2 = getSubmodelPin("Y2");
40                 Pin Y3 = getSubmodelPin("Y3");
41                 Pin Y4 = getSubmodelPin("Y4");
42
43                 GUIand41 and = new GUIand41(submodelModifiable);
44                 GUIor_4 or = new GUIor_4(submodelModifiable);
45
46                 and.moveTo(15, 137.5);
47                 or.moveTo(35, 37.5);
48
49                 new GUIWire(submodelModifiable, A1, and.getPin("A1"), new Point(10, 112.5), new Point(10, 142.5));
50                 new GUIWire(submodelModifiable, A2, and.getPin("A2"), new Point(5, 137.5), new Point(5, 152.5));
51                 new GUIWire(submodelModifiable, A3, and.getPin("A3"), new Point[0]);
52                 new GUIWire(submodelModifiable, A4, and.getPin("A4"), new Point(5, 187.5), new Point(5, 172.5));
53                 new GUIWire(submodelModifiable, B, and.getPin("B"), new Point(10, 212.5), new Point(10, 182.5));
54                 new GUIWire(submodelModifiable, C1, or.getPin("A1"), new Point(10, 12.5), new Point(10, 42.5));
55                 new GUIWire(submodelModifiable, C2, or.getPin("A2"), new Point(5, 37.5), new Point(5, 52.5));
56                 new GUIWire(submodelModifiable, C3, or.getPin("A3"), new Point[0]);
57                 new GUIWire(submodelModifiable, C4, or.getPin("A4"), new Point(5, 87.5), new Point(5, 72.5));
58                 new GUIWire(submodelModifiable, and.getPin("Y1"), or.getPin("B1"), new Point(70, 142.5), new Point(70, 120), new Point(30, 120),
59                                 new Point(30, 82.5));
60                 new GUIWire(submodelModifiable, and.getPin("Y2"), or.getPin("B2"), new Point(65, 152.5), new Point(65, 125), new Point(25, 125),
61                                 new Point(25, 92.5));
62                 new GUIWire(submodelModifiable, and.getPin("Y3"), or.getPin("B3"), new Point(60, 162.5), new Point(60, 130), new Point(20, 130),
63                                 new Point(20, 102.5));
64                 new GUIWire(submodelModifiable, and.getPin("Y4"), or.getPin("B4"), new Point(55, 172.5), new Point(55, 135), new Point(15, 135),
65                                 new Point(15, 112.5));
66                 new GUIWire(submodelModifiable, or.getPin("Y1"), Y1, new Point(75, 42.5), new Point(75, 12.5));
67                 new GUIWire(submodelModifiable, or.getPin("Y2"), Y2, new Point(80, 52.5), new Point(80, 37.5));
68                 new GUIWire(submodelModifiable, or.getPin("Y3"), Y3, new Point[0]);
69                 new GUIWire(submodelModifiable, or.getPin("Y4"), Y4, new Point(80, 72.5), new Point(80, 87.5));
70         }
71
72         static
73         {
74                 IndirectGUIComponentCreator.setComponentSupplier(GUIandor414.class.getCanonicalName(), (m, p, n) -> new GUIandor414(m, n));
75         }
76 }