1 package era.mi.gui.examples;
3 import era.mi.gui.SimpleLogicUIStandalone;
4 import era.mi.gui.model.ViewModel;
5 import era.mi.gui.model.components.GUIManualSwitch;
6 import era.mi.gui.model.components.GUINotGate;
7 import era.mi.gui.model.components.GUIOrGate;
8 import era.mi.gui.model.wires.GUIWire;
9 import era.mi.gui.model.wires.WireCrossPoint;
10 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
12 public class RSLatchExample
14 public static void main(String[] args)
16 SimpleLogicUIStandalone.executeVisualisation(RSLatchExample::createRSLatchExample);
19 public static void createRSLatchExample(ViewModel model)
21 GUIManualSwitch rIn = new GUIManualSwitch(model);
23 GUIManualSwitch sIn = new GUIManualSwitch(model);
26 GUIOrGate or1 = new GUIOrGate(model, 1);
27 or1.moveTo(160, 102.5);
28 new GUIWire(model, rIn.getOutputPin(), or1.getInputPins().get(0));
30 GUIOrGate or2 = new GUIOrGate(model, 1);
31 or2.moveTo(160, 192.5);
32 new GUIWire(model, sIn.getOutputPin(), or2.getInputPins().get(1));
34 GUINotGate not1 = new GUINotGate(model, 1);
35 not1.moveTo(200, 107.5);
36 new GUIWire(model, or1.getOutputPin(), not1.getInputPins().get(0));
38 GUINotGate not2 = new GUINotGate(model, 1);
39 not2.moveTo(200, 197.5);
40 new GUIWire(model, or2.getOutputPin(), not2.getInputPins().get(0));
42 WireCrossPoint p1 = new WireCrossPoint(model, 1);
43 p1.moveTo(250, 112.5);
44 new GUIWire(model, not1.getOutputPin(), p1.getPin());
45 new GUIWire(model, p1.getPin(), or2.getInputPins().get(0), new Point(250, 130), new Point(140, 185), new Point(140, 197.5));
47 WireCrossPoint p2 = new WireCrossPoint(model, 1);
48 p2.moveTo(250, 202.5);
49 new GUIWire(model, not2.getOutputPin(), p2.getPin());
50 new GUIWire(model, p2.getPin(), or1.getInputPins().get(1), new Point(250, 185), new Point(140, 130), new Point(140, 117.5));
52 WireCrossPoint o1 = new WireCrossPoint(model, 1);
53 o1.moveTo(270, 112.5);
54 new GUIWire(model, p1.getPin(), o1.getPin());
56 WireCrossPoint o2 = new WireCrossPoint(model, 1);
57 o2.moveTo(270, 202.5);
58 new GUIWire(model, p2.getPin(), o2.getPin());