1 package net.mograsim.logic.model.model.components.mi.nandbased;
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.model.model.ViewModelModifiable;
5 import net.mograsim.logic.model.model.components.atomic.GUINandGate;
6 import net.mograsim.logic.model.model.components.submodels.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.model.model.wires.GUIWire;
8 import net.mograsim.logic.model.model.wires.Pin;
9 import net.mograsim.logic.model.model.wires.WireCrossPoint;
10 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
12 public class GUInot4 extends SimpleRectangularSubmodelComponent
14 public GUInot4(ViewModelModifiable model)
19 public GUInot4(ViewModelModifiable model, String name)
21 super(model, 1, "GUInot4", name);
23 setInputPins("A1", "A2", "A3", "A4");
24 setOutputPins("Y1", "Y2", "Y3", "Y4");
25 initSubmodelComponents();
28 @SuppressWarnings("unused") // for GUIWires being created
29 private void initSubmodelComponents()
31 Pin A1 = getSubmodelPin("A1");
32 Pin A2 = getSubmodelPin("A2");
33 Pin A3 = getSubmodelPin("A3");
34 Pin A4 = getSubmodelPin("A4");
35 Pin Y1 = getSubmodelPin("Y1");
36 Pin Y2 = getSubmodelPin("Y2");
37 Pin Y3 = getSubmodelPin("Y3");
38 Pin Y4 = getSubmodelPin("Y4");
40 GUINandGate nand1 = new GUINandGate(submodelModifiable, 1);
41 GUINandGate nand2 = new GUINandGate(submodelModifiable, 1);
42 GUINandGate nand3 = new GUINandGate(submodelModifiable, 1);
43 GUINandGate nand4 = new GUINandGate(submodelModifiable, 1);
45 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
46 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
47 WireCrossPoint cp3 = new WireCrossPoint(submodelModifiable, 1);
48 WireCrossPoint cp4 = new WireCrossPoint(submodelModifiable, 1);
50 nand1.moveTo(30, 2.5);
51 nand2.moveTo(30, 27.5);
52 nand3.moveTo(30, 52.5);
53 nand4.moveTo(30, 77.5);
54 cp1.moveCenterTo(15, 12.5);
55 cp2.moveCenterTo(15, 37.5);
56 cp3.moveCenterTo(15, 62.5);
57 cp4.moveCenterTo(15, 87.5);
59 new GUIWire(submodelModifiable, A1, cp1, new Point[0]);
60 new GUIWire(submodelModifiable, A2, cp2, new Point[0]);
61 new GUIWire(submodelModifiable, A3, cp3, new Point[0]);
62 new GUIWire(submodelModifiable, A4, cp4, new Point[0]);
63 new GUIWire(submodelModifiable, cp1, nand1.getPin("A"), new Point(15, 7.5));
64 new GUIWire(submodelModifiable, cp2, nand2.getPin("A"), new Point(15, 32.5));
65 new GUIWire(submodelModifiable, cp3, nand3.getPin("A"), new Point(15, 57.5));
66 new GUIWire(submodelModifiable, cp4, nand4.getPin("A"), new Point(15, 82.5));
67 new GUIWire(submodelModifiable, cp1, nand1.getPin("B"), new Point(15, 17.5));
68 new GUIWire(submodelModifiable, cp2, nand2.getPin("B"), new Point(15, 42.5));
69 new GUIWire(submodelModifiable, cp3, nand3.getPin("B"), new Point(15, 67.5));
70 new GUIWire(submodelModifiable, cp4, nand4.getPin("B"), new Point(15, 92.5));
71 new GUIWire(submodelModifiable, nand1.getPin("Y"), Y1, new Point[0]);
72 new GUIWire(submodelModifiable, nand2.getPin("Y"), Y2, new Point[0]);
73 new GUIWire(submodelModifiable, nand3.getPin("Y"), Y3, new Point[0]);
74 new GUIWire(submodelModifiable, nand4.getPin("Y"), Y4, new Point[0]);
79 IndirectGUIComponentCreator.setComponentSupplier(GUInot4.class.getCanonicalName(), (m, p, n) -> new GUInot4(m, n));