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.serializing.IndirectGUIComponentCreator;
11 public class GUIfulladder extends SimpleRectangularSubmodelComponent
13 public GUIfulladder(ViewModelModifiable model)
18 public GUIfulladder(ViewModelModifiable model, String name)
20 super(model, 1, "GUIfulladder", name);
22 setInputPins("A", "B", "C");
23 setOutputPins("Y", "Z");
24 initSubmodelComponents();
27 @SuppressWarnings("unused") // for GUIWires being created
28 private void initSubmodelComponents()
30 Pin A = getSubmodelPin("A");
31 Pin B = getSubmodelPin("B");
32 Pin C = getSubmodelPin("C");
33 Pin Y = getSubmodelPin("Y");
34 Pin Z = getSubmodelPin("Z");
36 GUIhalfadder halfBC = new GUIhalfadder(submodelModifiable);
37 GUIhalfadder halfAY = new GUIhalfadder(submodelModifiable);
38 GUINandGate nandZ = new GUINandGate(submodelModifiable, 1);
40 halfAY.moveTo(45, 7.5);
42 nandZ.moveTo(57.5, 40);
44 new GUIWire(submodelModifiable, A, halfAY.getPin("A"), new Point[0]);
45 new GUIWire(submodelModifiable, B, halfBC.getPin("A"));
46 new GUIWire(submodelModifiable, C, halfBC.getPin("B"));
47 new GUIWire(submodelModifiable, halfBC.getPin("Y"), halfAY.getPin("B"));
48 new GUIWire(submodelModifiable, halfBC.getPin("_Z"), nandZ.getPin("B"), new Point[0]);
49 new GUIWire(submodelModifiable, halfAY.getPin("Y"), Y, new Point[0]);
50 new GUIWire(submodelModifiable, halfAY.getPin("_Z"), nandZ.getPin("A"), new Point(82.5, 22.5), new Point(82.5, 35),
51 new Point(52.5, 35), new Point(52.5, 45));
52 new GUIWire(submodelModifiable, nandZ.getPin("Y"), Z);
57 IndirectGUIComponentCreator.setComponentSupplier(GUIfulladder.class.getCanonicalName(), (m, p, n) -> new GUIfulladder(m, n));