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 GUI_rsLatch extends SubmodelComponent
13 private final Pin pin_S;
14 private final Pin pin_R;
15 private final Pin pinQ;
16 private final Pin pin_Q;
18 public GUI_rsLatch(ViewModelModifiable model)
20 super(model, "_rsLatch");
24 Pin _S = addSubmodelInterface(1, 0, 5);
25 Pin _R = addSubmodelInterface(1, 0, 20);
26 Pin Q = addSubmodelInterface(1, 35, 5);
27 Pin _Q = addSubmodelInterface(1, 35, 20);
29 this.pin_S = getSupermodelPin(_S);
30 this.pin_R = getSupermodelPin(_R);
31 this.pinQ = getSupermodelPin(Q);
32 this.pin_Q = getSupermodelPin(_Q);
34 initSubmodelComponents(_S, _R, Q, _Q);
37 @SuppressWarnings("unused") // for GUIWires being created
38 private void initSubmodelComponents(Pin _S, Pin _R, Pin Q, Pin _Q)
40 GUINandGate nand1 = new GUINandGate(submodelModifiable, 1);
41 GUINandGate nand2 = new GUINandGate(submodelModifiable, 1);
43 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
44 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
51 new GUIWire(submodelModifiable, _S, nand1.getInputPins().get(0));
52 new GUIWire(submodelModifiable, _R, nand2.getInputPins().get(1));
53 new GUIWire(submodelModifiable, nand1.getOutputPin(), cp1);
54 new GUIWire(submodelModifiable, nand2.getOutputPin(), cp2);
55 new GUIWire(submodelModifiable, cp1, nand2.getInputPins().get(0), new Point(120, 50), new Point(60, 75),
57 new GUIWire(submodelModifiable, cp2, nand1.getInputPins().get(1), new Point(120, 75), new Point(60, 50),
59 new GUIWire(submodelModifiable, cp1, Q, new Point(150, 30), new Point(150, 25));
60 new GUIWire(submodelModifiable, cp2, _Q, new Point(150, 95), new Point(150, 100));