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 public GUI_rsLatch(ViewModelModifiable model)
15 super(model, "_rsLatch");
18 initSubmodelComponents();
21 @SuppressWarnings("unused") // for GUIWires being created
22 private void initSubmodelComponents()
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 GUINandGate nand1 = new GUINandGate(submodelModifiable, 1);
31 GUINandGate nand2 = new GUINandGate(submodelModifiable, 1);
34 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
36 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
39 new GUIWire(submodelModifiable, _S, nand1.getInputPins().get(0));
40 new GUIWire(submodelModifiable, _R, nand2.getInputPins().get(1));
41 new GUIWire(submodelModifiable, nand1.getOutputPin(), cp1.getPin());
42 new GUIWire(submodelModifiable, nand2.getOutputPin(), cp2.getPin());
43 new GUIWire(submodelModifiable, cp1.getPin(), nand2.getInputPins().get(0), new Point(120, 50), new Point(60, 75),
45 new GUIWire(submodelModifiable, cp2.getPin(), nand1.getInputPins().get(1), new Point(120, 75), new Point(60, 50),
47 new GUIWire(submodelModifiable, cp1.getPin(), Q, new Point(150, 30), new Point(150, 25));
48 new GUIWire(submodelModifiable, cp2.getPin(), _Q, new Point(150, 95), new Point(150, 100));