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 GUIand extends SimpleRectangularSubmodelComponent
14 public GUIand(ViewModelModifiable model)
19 public GUIand(ViewModelModifiable model, String name)
21 super(model, 1, "GUIand", name);
23 setInputPins("A", "B");
25 initSubmodelComponents();
28 @SuppressWarnings("unused") // for GUIWires being created
29 private void initSubmodelComponents()
31 Pin A = getSubmodelPin("A");
32 Pin B = getSubmodelPin("B");
33 Pin Y = getSubmodelPin("Y");
35 GUINandGate nand = new GUINandGate(submodelModifiable, 1);
36 GUINandGate not = new GUINandGate(submodelModifiable, 1);
38 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
42 cp1.moveCenterTo(45, 25);
44 new GUIWire(submodelModifiable, A, nand.getPin("A"));
45 new GUIWire(submodelModifiable, B, nand.getPin("B"));
46 new GUIWire(submodelModifiable, nand.getPin("Y"), cp1, new Point[0]);
47 new GUIWire(submodelModifiable, cp1, not.getPin("A"), new Point(45, 20));
48 new GUIWire(submodelModifiable, cp1, not.getPin("B"), new Point(45, 30));
49 new GUIWire(submodelModifiable, not.getPin("Y"), Y);
54 IndirectGUIComponentCreator.setComponentSupplier(GUIand.class.getCanonicalName(), (m, p, n) -> new GUIand(m, n));