Completely changed the structure and switched to Eclipse Plugin.
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUInot4.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.GUINandGate;
6 import net.mograsim.logic.ui.model.components.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
11 public class GUInot4 extends SimpleRectangularSubmodelComponent
12 {
13         public GUInot4(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUInot4");
16                 setSubmodelScale(.4);
17                 setInputPins("A1", "A2", "A3", "A4");
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 Y1 = getSubmodelPin("Y1");
30                 Pin Y2 = getSubmodelPin("Y2");
31                 Pin Y3 = getSubmodelPin("Y3");
32                 Pin Y4 = getSubmodelPin("Y4");
33
34                 GUINandGate nand1 = new GUINandGate(submodelModifiable, 1);
35                 GUINandGate nand2 = new GUINandGate(submodelModifiable, 1);
36                 GUINandGate nand3 = new GUINandGate(submodelModifiable, 1);
37                 GUINandGate nand4 = new GUINandGate(submodelModifiable, 1);
38
39                 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
40                 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
41                 WireCrossPoint cp3 = new WireCrossPoint(submodelModifiable, 1);
42                 WireCrossPoint cp4 = new WireCrossPoint(submodelModifiable, 1);
43
44                 nand1.moveTo(30, 2.5);
45                 nand2.moveTo(30, 27.5);
46                 nand3.moveTo(30, 52.5);
47                 nand4.moveTo(30, 77.5);
48                 cp1.moveCenterTo(15, 12.5);
49                 cp2.moveCenterTo(15, 37.5);
50                 cp3.moveCenterTo(15, 62.5);
51                 cp4.moveCenterTo(15, 87.5);
52
53                 new GUIWire(submodelModifiable, A1, cp1, new Point[0]);
54                 new GUIWire(submodelModifiable, A2, cp2, new Point[0]);
55                 new GUIWire(submodelModifiable, A3, cp3, new Point[0]);
56                 new GUIWire(submodelModifiable, A4, cp4, new Point[0]);
57                 new GUIWire(submodelModifiable, cp1, nand1.getPin("A"), new Point(15, 7.5));
58                 new GUIWire(submodelModifiable, cp2, nand2.getPin("A"), new Point(15, 32.5));
59                 new GUIWire(submodelModifiable, cp3, nand3.getPin("A"), new Point(15, 57.5));
60                 new GUIWire(submodelModifiable, cp4, nand4.getPin("A"), new Point(15, 82.5));
61                 new GUIWire(submodelModifiable, cp1, nand1.getPin("B"), new Point(15, 17.5));
62                 new GUIWire(submodelModifiable, cp2, nand2.getPin("B"), new Point(15, 42.5));
63                 new GUIWire(submodelModifiable, cp3, nand3.getPin("B"), new Point(15, 67.5));
64                 new GUIWire(submodelModifiable, cp4, nand4.getPin("B"), new Point(15, 92.5));
65                 new GUIWire(submodelModifiable, nand1.getPin("Y"), Y1, new Point[0]);
66                 new GUIWire(submodelModifiable, nand2.getPin("Y"), Y2, new Point[0]);
67                 new GUIWire(submodelModifiable, nand3.getPin("Y"), Y3, new Point[0]);
68                 new GUIWire(submodelModifiable, nand4.getPin("Y"), Y4, new Point[0]);
69         }
70 }