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.SimpleRectangularSubmodelComponent;
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 SimpleRectangularSubmodelComponent
13 public GUI_rsLatch(ViewModelModifiable model)
15 super(model, 1, "_rsLatch");
17 setInputPins("_S", "_R");
18 setOutputPins("Q", "_Q");
19 initSubmodelComponents();
22 @SuppressWarnings("unused") // for GUIWires being created
23 private void initSubmodelComponents()
25 Pin _S = getSubmodelPin("_S");
26 Pin _R = getSubmodelPin("_R");
27 Pin Q = getSubmodelPin("Q");
28 Pin _Q = getSubmodelPin("_Q");
30 GUINandGate nand1 = new GUINandGate(submodelModifiable, 1);
31 GUINandGate nand2 = new GUINandGate(submodelModifiable, 1);
33 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
34 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
36 nand1.moveTo(10, 7.5);
37 nand2.moveTo(40, 12.5);
38 cp1.moveCenterTo(35, 17.5);
39 cp2.moveCenterTo(65, 37.5);
41 new GUIWire(submodelModifiable, _S, nand1.getPin("A"), new Point[0]);
42 new GUIWire(submodelModifiable, _R, nand2.getPin("B"), new Point(35, 37.5), new Point(35, 27.5));
43 new GUIWire(submodelModifiable, nand1.getPin("Y"), cp1, new Point[0]);
44 new GUIWire(submodelModifiable, nand2.getPin("Y"), cp2, new Point(65, 22.5));
45 new GUIWire(submodelModifiable, cp1, nand2.getPin("A"), new Point[0]);
46 new GUIWire(submodelModifiable, cp2, nand1.getPin("B"), new Point(65, 42.5), new Point(5, 42.5), new Point(5, 22.5));
47 new GUIWire(submodelModifiable, cp1, Q, new Point(35, 17.5), new Point(35, 7.5), new Point(65, 7.5), new Point(65, 12.5));
48 new GUIWire(submodelModifiable, cp2, _Q, new Point[0]);