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