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");
19 initSubmodelComponents();
22 @SuppressWarnings("unused") // for GUIWires being created
23 private void initSubmodelComponents()
25 Pin _S = getInputSubmodelPins().get(0);
26 Pin _R = getInputSubmodelPins().get(1);
27 Pin Q = getOutputSubmodelPins().get(0);
28 Pin _Q = getOutputSubmodelPins().get(1);
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);
41 new GUIWire(submodelModifiable, _S, nand1.getInputPins().get(0), new Point[0]);
42 new GUIWire(submodelModifiable, _R, nand2.getInputPins().get(1), new Point(35, 37.5), new Point(35, 27.5));
43 new GUIWire(submodelModifiable, nand1.getOutputPin(), cp1, new Point[0]);
44 new GUIWire(submodelModifiable, nand2.getOutputPin(), cp2, new Point(65, 22.5));
45 new GUIWire(submodelModifiable, cp1, nand2.getInputPins().get(0), new Point[0]);
46 new GUIWire(submodelModifiable, cp2, nand1.getInputPins().get(1), 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]);