Added DeserializedSubmodelComponent Editor project
[Mograsim.git] / net.mograsim.logic.ui.am2900 / 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.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.model.wires.WireCrossPoint;
9 import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
10
11 public class GUIand41 extends SimpleRectangularSubmodelComponent
12 {
13         public GUIand41(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUIand41");
16                 setSubmodelScale(.4);
17                 setInputPins("A1", "A2", "A3", "A4", "B");
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 = getSubmodelPin("A1");
26                 Pin A2 = getSubmodelPin("A2");
27                 Pin A3 = getSubmodelPin("A3");
28                 Pin A4 = getSubmodelPin("A4");
29                 Pin B = getSubmodelPin("B");
30                 Pin Y1 = getSubmodelPin("Y1");
31                 Pin Y2 = getSubmodelPin("Y2");
32                 Pin Y3 = getSubmodelPin("Y3");
33                 Pin Y4 = getSubmodelPin("Y4");
34
35                 GUIand and1 = new GUIand(submodelModifiable);
36                 GUIand and2 = new GUIand(submodelModifiable);
37                 GUIand and3 = new GUIand(submodelModifiable);
38                 GUIand and4 = new GUIand(submodelModifiable);
39
40                 WireCrossPoint cpB2 = new WireCrossPoint(submodelModifiable, 1);
41                 WireCrossPoint cpB3 = new WireCrossPoint(submodelModifiable, 1);
42                 WireCrossPoint cpB4 = new WireCrossPoint(submodelModifiable, 1);
43
44                 and1.moveTo(30, 7.5);
45                 and2.moveTo(30, 32.5);
46                 and3.moveTo(30, 57.5);
47                 and4.moveTo(30, 82.5);
48                 cpB2.moveCenterTo(25, 47.5);
49                 cpB3.moveCenterTo(25, 72.5);
50                 cpB4.moveCenterTo(25, 97.5);
51
52                 new GUIWire(submodelModifiable, A1, and1.getPin("A"), new Point[0]);
53                 new GUIWire(submodelModifiable, A2, and2.getPin("A"), new Point[0]);
54                 new GUIWire(submodelModifiable, A3, and3.getPin("A"), new Point[0]);
55                 new GUIWire(submodelModifiable, A4, and4.getPin("A"), new Point[0]);
56                 new GUIWire(submodelModifiable, B, cpB4, new Point(25, 112.5));
57                 new GUIWire(submodelModifiable, cpB4, and4.getPin("B"), new Point[0]);
58                 new GUIWire(submodelModifiable, cpB4, cpB3, new Point[0]);
59                 new GUIWire(submodelModifiable, cpB3, and3.getPin("B"), new Point[0]);
60                 new GUIWire(submodelModifiable, cpB3, cpB2, new Point[0]);
61                 new GUIWire(submodelModifiable, cpB2, and2.getPin("B"), new Point[0]);
62                 new GUIWire(submodelModifiable, cpB2, and1.getPin("B"), new Point(25, 22.5));
63                 new GUIWire(submodelModifiable, and1.getPin("Y"), Y1, new Point[0]);
64                 new GUIWire(submodelModifiable, and2.getPin("Y"), Y2, new Point[0]);
65                 new GUIWire(submodelModifiable, and3.getPin("Y"), Y3, new Point[0]);
66                 new GUIWire(submodelModifiable, and4.getPin("Y"), Y4, new Point[0]);
67         }
68
69         static
70         {
71                 IndirectGUIComponentCreator.setComponentProvider(GUIand41.class.getCanonicalName(), (m, p) -> new GUIand41(m));
72         }
73 }