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