Made classes in package "nandbased" usable for JSON
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / am2901 / GUIAm2901DestDecode.java
1 package net.mograsim.logic.ui.model.components.mi.nandbased.am2901;
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.atomic.GUINandGate;
6 import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.ui.model.wires.GUIWire;
8 import net.mograsim.logic.ui.model.wires.Pin;
9 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
10 import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
11
12 public class GUIAm2901DestDecode extends SimpleRectangularSubmodelComponent
13 {
14         public GUIAm2901DestDecode(ViewModelModifiable model)
15         {
16                 super(model, 1, "GUIAm2901DestDecode");
17                 setSubmodelScale(.25);
18                 setInputPins("I8", "I7", "I6");
19                 setOutputPins("NSH", "RSH", "RAMWE", "YF", "LSH", "QWE");
20                 initSubmodelComponents();
21         }
22
23         @SuppressWarnings("unused") // for GUIWires being created
24         private void initSubmodelComponents()
25         {
26                 Pin I8 = getSubmodelPin("I8");
27                 Pin I7 = getSubmodelPin("I7");
28                 Pin I6 = getSubmodelPin("I6");
29                 Pin NSH = getSubmodelPin("NSH");
30                 Pin RSH = getSubmodelPin("RSH");
31                 Pin RAMWE = getSubmodelPin("RAMWE");
32                 Pin YF = getSubmodelPin("YF");
33                 Pin LSH = getSubmodelPin("LSH");
34                 Pin QWE = getSubmodelPin("QWE");
35
36                 GUINandGate notI8 = new GUINandGate(submodelModifiable, 1);
37                 GUINandGate notI7 = new GUINandGate(submodelModifiable, 1);
38                 GUINandGate nandI8I7 = new GUINandGate(submodelModifiable, 1);
39                 GUINandGate notI6 = new GUINandGate(submodelModifiable, 1);
40                 GUINandGate nandRSH = new GUINandGate(submodelModifiable, 1);
41                 GUINandGate nandRAMWE = new GUINandGate(submodelModifiable, 1);
42                 GUINandGate nandI7NotI8 = new GUINandGate(submodelModifiable, 1);
43                 GUINandGate nandLSH = new GUINandGate(submodelModifiable, 1);
44                 GUINandGate notRSH = new GUINandGate(submodelModifiable, 1);
45                 GUINandGate andI7NotI8 = new GUINandGate(submodelModifiable, 1);
46                 GUINandGate nandQWE = new GUINandGate(submodelModifiable, 1);
47                 GUINandGate nandYF = new GUINandGate(submodelModifiable, 1);
48                 GUINandGate notQWE = new GUINandGate(submodelModifiable, 1);
49
50                 WireCrossPoint cpI81 = new WireCrossPoint(submodelModifiable, 1);
51                 WireCrossPoint cpI82 = new WireCrossPoint(submodelModifiable, 1);
52                 WireCrossPoint cpI83 = new WireCrossPoint(submodelModifiable, 1);
53                 WireCrossPoint cpI71 = new WireCrossPoint(submodelModifiable, 1);
54                 WireCrossPoint cpI72 = new WireCrossPoint(submodelModifiable, 1);
55                 WireCrossPoint cpI73 = new WireCrossPoint(submodelModifiable, 1);
56                 WireCrossPoint cpI6 = new WireCrossPoint(submodelModifiable, 1);
57                 WireCrossPoint cpNotI7 = new WireCrossPoint(submodelModifiable, 1);
58                 WireCrossPoint cpNotI81 = new WireCrossPoint(submodelModifiable, 1);
59                 WireCrossPoint cpNotI82 = new WireCrossPoint(submodelModifiable, 1);
60                 WireCrossPoint cpNandI8I7 = new WireCrossPoint(submodelModifiable, 1);
61                 WireCrossPoint cpNotRSH = new WireCrossPoint(submodelModifiable, 1);
62                 WireCrossPoint cpNandI7NotI81 = new WireCrossPoint(submodelModifiable, 1);
63                 WireCrossPoint cpNandI7NotI82 = new WireCrossPoint(submodelModifiable, 1);
64                 WireCrossPoint cpNotI6 = new WireCrossPoint(submodelModifiable, 1);
65                 WireCrossPoint cpNandQWE = new WireCrossPoint(submodelModifiable, 1);
66
67                 notI8.moveTo(15, 10);
68                 notI7.moveTo(15, 50);
69                 nandI8I7.moveTo(15, 90);
70                 notI6.moveTo(15, 150);
71                 nandRSH.moveTo(50, 10);
72                 nandRAMWE.moveTo(50, 50);
73                 nandI7NotI8.moveTo(50, 90);
74                 nandLSH.moveTo(50, 130);
75                 notRSH.moveTo(80, 10);
76                 andI7NotI8.moveTo(80, 90);
77                 nandQWE.moveTo(80, 145);
78                 nandYF.moveTo(110, 105);
79                 notQWE.moveTo(115, 210);
80                 cpI81.moveCenterTo(5, 20);
81                 cpI82.moveCenterTo(5, 15);
82                 cpI83.moveCenterTo(5, 25);
83                 cpI71.moveCenterTo(10, 60);
84                 cpI72.moveCenterTo(10, 65);
85                 cpI73.moveCenterTo(10, 105);
86                 cpI6.moveCenterTo(5, 155);
87                 cpNotI7.moveCenterTo(40, 60);
88                 cpNotI81.moveCenterTo(45, 20);
89                 cpNotI82.moveCenterTo(45, 55);
90                 cpNandI8I7.moveCenterTo(40, 135);
91                 cpNotRSH.moveCenterTo(75, 20);
92                 cpNandI7NotI81.moveCenterTo(75, 100);
93                 cpNandI7NotI82.moveCenterTo(75, 105);
94                 cpNotI6.moveCenterTo(75, 160);
95                 cpNandQWE.moveCenterTo(110, 215);
96
97                 new GUIWire(submodelModifiable, I8, cpI81, new Point[0]);
98                 new GUIWire(submodelModifiable, cpI81, cpI82, new Point[0]);
99                 new GUIWire(submodelModifiable, cpI81, cpI83, new Point[0]);
100                 new GUIWire(submodelModifiable, cpI82, notI8.getPin("A"), new Point[0]);
101                 new GUIWire(submodelModifiable, cpI83, notI8.getPin("B"), new Point[0]);
102                 new GUIWire(submodelModifiable, I7, cpI71, new Point[0]);
103                 new GUIWire(submodelModifiable, cpI71, notI7.getPin("A"), new Point(10, 55));
104                 new GUIWire(submodelModifiable, cpI71, cpI72, new Point[0]);
105                 new GUIWire(submodelModifiable, cpI72, notI7.getPin("B"), new Point[0]);
106                 new GUIWire(submodelModifiable, cpI72, cpI73, new Point[0]);
107                 new GUIWire(submodelModifiable, cpI73, nandI8I7.getPin("B"), new Point[0]);
108                 new GUIWire(submodelModifiable, cpI83, nandI8I7.getPin("A"), new Point(5, 95));
109                 new GUIWire(submodelModifiable, I6, cpI6, new Point(5, 100));
110                 new GUIWire(submodelModifiable, cpI6, notI6.getPin("A"), new Point[0]);
111                 new GUIWire(submodelModifiable, cpI6, notI6.getPin("B"), new Point(5, 165));
112                 new GUIWire(submodelModifiable, cpI82, nandRSH.getPin("A"), new Point(5, 5), new Point(40, 5), new Point(40, 15));
113                 new GUIWire(submodelModifiable, notI7.getPin("Y"), cpNotI7, new Point[0]);
114                 new GUIWire(submodelModifiable, cpNotI7, nandRSH.getPin("B"), new Point(40, 25));
115                 new GUIWire(submodelModifiable, cpNotI7, nandRAMWE.getPin("B"), new Point(40, 65));
116                 new GUIWire(submodelModifiable, notI8.getPin("Y"), cpNotI81, new Point[0]);
117                 new GUIWire(submodelModifiable, cpNotI81, NSH, new Point(45, 5), new Point(135, 5), new Point(135, 20));
118                 new GUIWire(submodelModifiable, cpNotI81, cpNotI82, new Point[0]);
119                 new GUIWire(submodelModifiable, cpNotI82, nandRAMWE.getPin("A"), new Point[0]);
120                 new GUIWire(submodelModifiable, cpNotI82, nandI7NotI8.getPin("A"), new Point(45, 95));
121                 new GUIWire(submodelModifiable, cpI73, nandI7NotI8.getPin("B"), new Point(10, 115), new Point(45, 115), new Point(45, 105));
122                 new GUIWire(submodelModifiable, nandI8I7.getPin("Y"), cpNandI8I7, new Point(40, 100));
123                 new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getPin("A"), new Point[0]);
124                 new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getPin("B"), new Point(40, 145));
125                 new GUIWire(submodelModifiable, nandRSH.getPin("Y"), cpNotRSH, new Point[0]);
126                 new GUIWire(submodelModifiable, cpNotRSH, notRSH.getPin("A"), new Point(75, 15));
127                 new GUIWire(submodelModifiable, cpNotRSH, notRSH.getPin("B"), new Point(75, 25));
128                 new GUIWire(submodelModifiable, nandRAMWE.getPin("Y"), RAMWE, new Point(125, 60), new Point(125, 100));
129                 new GUIWire(submodelModifiable, nandI7NotI8.getPin("Y"), cpNandI7NotI81, new Point[0]);
130                 new GUIWire(submodelModifiable, cpNandI7NotI81, andI7NotI8.getPin("A"), new Point(75, 95));
131                 new GUIWire(submodelModifiable, cpNandI7NotI81, cpNandI7NotI82, new Point[0]);
132                 new GUIWire(submodelModifiable, cpNandI7NotI82, andI7NotI8.getPin("B"), new Point[0]);
133                 new GUIWire(submodelModifiable, nandLSH.getPin("Y"), LSH, new Point(125, 140), new Point(125, 180));
134                 new GUIWire(submodelModifiable, cpNandI7NotI82, nandQWE.getPin("A"), new Point(75, 150));
135                 new GUIWire(submodelModifiable, notI6.getPin("Y"), cpNotI6, new Point[0]);
136                 new GUIWire(submodelModifiable, cpNotI6, nandQWE.getPin("B"), new Point[0]);
137                 new GUIWire(submodelModifiable, notRSH.getPin("Y"), RSH, new Point(130, 20), new Point(130, 60));
138                 new GUIWire(submodelModifiable, andI7NotI8.getPin("Y"), nandYF.getPin("A"));
139                 new GUIWire(submodelModifiable, cpNotI6, nandYF.getPin("B"), new Point(75, 170), new Point(105, 170), new Point(105, 120));
140                 new GUIWire(submodelModifiable, nandQWE.getPin("Y"), cpNandQWE, new Point(110, 155));
141                 new GUIWire(submodelModifiable, cpNandQWE, notQWE.getPin("A"), new Point[0]);
142                 new GUIWire(submodelModifiable, cpNandQWE, notQWE.getPin("B"), new Point(110, 225));
143                 new GUIWire(submodelModifiable, nandYF.getPin("Y"), YF);
144                 new GUIWire(submodelModifiable, notQWE.getPin("Y"), QWE, new Point[0]);
145         }
146
147         static
148         {
149                 IndirectGUIComponentCreator.setComponentProvider(GUIAm2901DestDecode.class.getCanonicalName(),
150                                 (m, p) -> new GUIAm2901DestDecode(m));
151         }
152 }