1074ab2819b93d1e612d57eedc6a47811fe4e272
[Mograsim.git] / net.mograsim.logic.model.am2900 / src / net / mograsim / logic / model / model / components / mi / nandbased / GUIand41.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 GUIand41 extends SimpleRectangularSubmodelComponent
12 {
13         public GUIand41(ViewModelModifiable model)
14         {
15                 this(model, null);
16         }
17
18         public GUIand41(ViewModelModifiable model, String name)
19         {
20                 super(model, 1, "GUIand41", name);
21                 setSubmodelScale(.4);
22                 setInputPins("A1", "A2", "A3", "A4", "B");
23                 setOutputPins("Y1", "Y2", "Y3", "Y4");
24                 initSubmodelComponents();
25         }
26
27         @SuppressWarnings("unused") // for GUIWires being created
28         private void initSubmodelComponents()
29         {
30                 Pin A1 = getSubmodelPin("A1");
31                 Pin A2 = getSubmodelPin("A2");
32                 Pin A3 = getSubmodelPin("A3");
33                 Pin A4 = getSubmodelPin("A4");
34                 Pin B = getSubmodelPin("B");
35                 Pin Y1 = getSubmodelPin("Y1");
36                 Pin Y2 = getSubmodelPin("Y2");
37                 Pin Y3 = getSubmodelPin("Y3");
38                 Pin Y4 = getSubmodelPin("Y4");
39
40                 GUIand and1 = new GUIand(submodelModifiable);
41                 GUIand and2 = new GUIand(submodelModifiable);
42                 GUIand and3 = new GUIand(submodelModifiable);
43                 GUIand and4 = new GUIand(submodelModifiable);
44
45                 WireCrossPoint cpB2 = new WireCrossPoint(submodelModifiable, 1);
46                 WireCrossPoint cpB3 = new WireCrossPoint(submodelModifiable, 1);
47                 WireCrossPoint cpB4 = new WireCrossPoint(submodelModifiable, 1);
48
49                 and1.moveTo(30, 7.5);
50                 and2.moveTo(30, 32.5);
51                 and3.moveTo(30, 57.5);
52                 and4.moveTo(30, 82.5);
53                 cpB2.moveCenterTo(25, 47.5);
54                 cpB3.moveCenterTo(25, 72.5);
55                 cpB4.moveCenterTo(25, 97.5);
56
57                 new GUIWire(submodelModifiable, A1, and1.getPin("A"), new Point[0]);
58                 new GUIWire(submodelModifiable, A2, and2.getPin("A"), new Point[0]);
59                 new GUIWire(submodelModifiable, A3, and3.getPin("A"), new Point[0]);
60                 new GUIWire(submodelModifiable, A4, and4.getPin("A"), new Point[0]);
61                 new GUIWire(submodelModifiable, B, cpB4, new Point(25, 112.5));
62                 new GUIWire(submodelModifiable, cpB4, and4.getPin("B"), new Point[0]);
63                 new GUIWire(submodelModifiable, cpB4, cpB3, new Point[0]);
64                 new GUIWire(submodelModifiable, cpB3, and3.getPin("B"), new Point[0]);
65                 new GUIWire(submodelModifiable, cpB3, cpB2, new Point[0]);
66                 new GUIWire(submodelModifiable, cpB2, and2.getPin("B"), new Point[0]);
67                 new GUIWire(submodelModifiable, cpB2, and1.getPin("B"), new Point(25, 22.5));
68                 new GUIWire(submodelModifiable, and1.getPin("Y"), Y1, new Point[0]);
69                 new GUIWire(submodelModifiable, and2.getPin("Y"), Y2, new Point[0]);
70                 new GUIWire(submodelModifiable, and3.getPin("Y"), Y3, new Point[0]);
71                 new GUIWire(submodelModifiable, and4.getPin("Y"), Y4, new Point[0]);
72         }
73
74         static
75         {
76                 IndirectGUIComponentCreator.setComponentSupplier(GUIand41.class.getCanonicalName(), (m, p, n) -> new GUIand41(m, n));
77         }
78 }