Added DeserializedSubmodelComponent Editor project
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUImux1_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.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 GUImux1_4 extends SimpleRectangularSubmodelComponent
12 {
13         public GUImux1_4(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUImux1_4");
16                 setSubmodelScale(.4);
17                 setInputPins("S0", "I0_1", "I0_2", "I0_3", "I0_4", "I1_1", "I1_2", "I1_3", "I1_4");
18                 setOutputPins("Y1", "Y2", "Y3", "Y4");
19                 initSubmodelComponents();
20         }
21
22         @SuppressWarnings("unused")
23         private void initSubmodelComponents()
24         {
25                 Pin S0 = getSubmodelPin("S0");
26                 Pin I0_1 = getSubmodelPin("I0_1");
27                 Pin I0_2 = getSubmodelPin("I0_2");
28                 Pin I0_3 = getSubmodelPin("I0_3");
29                 Pin I0_4 = getSubmodelPin("I0_4");
30                 Pin I1_1 = getSubmodelPin("I1_1");
31                 Pin I1_2 = getSubmodelPin("I1_2");
32                 Pin I1_3 = getSubmodelPin("I1_3");
33                 Pin I1_4 = getSubmodelPin("I1_4");
34                 Pin Y1 = getSubmodelPin("Y1");
35                 Pin Y2 = getSubmodelPin("Y2");
36                 Pin Y3 = getSubmodelPin("Y3");
37                 Pin Y4 = getSubmodelPin("Y4");
38
39                 GUImux1 mux1 = new GUImux1(submodelModifiable);
40                 GUImux1 mux2 = new GUImux1(submodelModifiable);
41                 GUImux1 mux3 = new GUImux1(submodelModifiable);
42                 GUImux1 mux4 = new GUImux1(submodelModifiable);
43
44                 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
45                 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
46                 WireCrossPoint cp3 = new WireCrossPoint(submodelModifiable, 1);
47
48                 mux1.moveTo(30, 7.5);
49                 mux2.moveTo(30, 42.5);
50                 mux3.moveTo(30, 77.5);
51                 mux4.moveTo(30, 112.5);
52                 cp1.moveCenterTo(25, 12.5);
53                 cp2.moveCenterTo(25, 47.5);
54                 cp3.moveCenterTo(25, 82.5);
55
56                 new GUIWire(submodelModifiable, S0, cp1, new Point[0]);
57                 new GUIWire(submodelModifiable, cp1, mux1.getPin("S0"), new Point[0]);
58                 new GUIWire(submodelModifiable, I0_1, mux1.getPin("I0"), new Point(5, 37.5), new Point(5, 22.5));
59                 new GUIWire(submodelModifiable, I1_1, mux1.getPin("I1"), new Point(10, 137.5), new Point(10, 32.5));
60                 new GUIWire(submodelModifiable, mux1.getPin("Y"), Y1, new Point[0]);
61                 new GUIWire(submodelModifiable, cp1, cp2, new Point[0]);
62                 new GUIWire(submodelModifiable, cp2, mux2.getPin("S0"), new Point[0]);
63                 new GUIWire(submodelModifiable, I0_2, mux2.getPin("I0"), new Point(5, 62.5), new Point(5, 57.5));
64                 new GUIWire(submodelModifiable, I1_2, mux2.getPin("I1"), new Point(15, 162.5), new Point(15, 67.5));
65                 new GUIWire(submodelModifiable, mux2.getPin("Y"), Y2);
66                 new GUIWire(submodelModifiable, cp2, cp3, new Point[0]);
67                 new GUIWire(submodelModifiable, cp3, mux3.getPin("S0"), new Point[0]);
68                 new GUIWire(submodelModifiable, I0_3, mux3.getPin("I0"), new Point(5, 87.5), new Point(5, 92.5));
69                 new GUIWire(submodelModifiable, I1_3, mux3.getPin("I1"), new Point(20, 187.5), new Point(20, 102.5));
70                 new GUIWire(submodelModifiable, mux3.getPin("Y"), Y3);
71                 new GUIWire(submodelModifiable, cp3, mux4.getPin("S0"), new Point(25, 117.5));
72                 new GUIWire(submodelModifiable, I0_4, mux4.getPin("I0"), new Point(5, 112.5), new Point(5, 127.5));
73                 new GUIWire(submodelModifiable, I1_4, mux4.getPin("I1"), new Point(25, 212.5), new Point(25, 137.5));
74                 new GUIWire(submodelModifiable, mux4.getPin("Y"), Y4);
75
76         }
77
78         static
79         {
80                 IndirectGUIComponentCreator.setComponentProvider(GUImux1_4.class.getCanonicalName(), (m, p) -> new GUImux1_4(m));
81         }
82 }