1 package net.mograsim.logic.ui.model.components.mi.nandbased;
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.SubmodelComponent;
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;
11 public class GUIand extends SubmodelComponent
13 private final Pin pinA;
14 private final Pin pinB;
15 private final Pin pinY;
17 public GUIand(ViewModelModifiable model)
19 super(model, "GUIand");
23 Pin A = addSubmodelInterface(1, 0, 5);
24 Pin B = addSubmodelInterface(1, 0, 20);
25 Pin Y = addSubmodelInterface(1, 35, 12.5);
27 this.pinA = getSupermodelPin(A);
28 this.pinB = getSupermodelPin(B);
29 this.pinY = getSupermodelPin(Y);
31 initSubmodelComponents(A, B, Y);
34 @SuppressWarnings("unused") // for GUIWires being created
35 private void initSubmodelComponents(Pin A, Pin B, Pin Y)
37 GUINandGate nand = new GUINandGate(submodelModifiable, 1);
38 GUINandGate not = new GUINandGate(submodelModifiable, 1);
40 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
42 nand.moveTo(20, 21.25);
43 not.moveTo(50, 21.25);
44 cp1.moveTo(45, 31.25);
46 new GUIWire(submodelModifiable, A, nand.getInputPins().get(0), new Point(10, 12.5), new Point(10, 26.25));
47 new GUIWire(submodelModifiable, B, nand.getInputPins().get(1), new Point(10, 50), new Point(10, 36.25));
48 new GUIWire(submodelModifiable, nand.getOutputPin(), cp1);
49 new GUIWire(submodelModifiable, cp1, not.getInputPins().get(0), new Point(45, 26.25));
50 new GUIWire(submodelModifiable, cp1, not.getInputPins().get(1), new Point(45, 36.25));
51 new GUIWire(submodelModifiable, not.getOutputPin(), Y);