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.SubmodelComponent;
6 import net.mograsim.logic.ui.model.wires.GUIWire;
7 import net.mograsim.logic.ui.model.wires.Pin;
8 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
10 public class GUIdlatch4 extends SubmodelComponent
12 private final Pin pinD1;
13 private final Pin pinD2;
14 private final Pin pinD3;
15 private final Pin pinD4;
16 private final Pin pinC;
17 private final Pin pinQ1;
18 private final Pin pinQ2;
19 private final Pin pinQ3;
20 private final Pin pinQ4;
22 public GUIdlatch4(ViewModelModifiable model)
24 super(model, "GUIdlatch4");
28 Pin D1 = addSubmodelInterface(1, 0, 5);
29 Pin D2 = addSubmodelInterface(1, 0, 15);
30 Pin D3 = addSubmodelInterface(1, 0, 25);
31 Pin D4 = addSubmodelInterface(1, 0, 35);
32 Pin C = addSubmodelInterface(1, 0, 50);
33 Pin Q1 = addSubmodelInterface(1, 35, 5);
34 Pin Q2 = addSubmodelInterface(1, 35, 15);
35 Pin Q3 = addSubmodelInterface(1, 35, 25);
36 Pin Q4 = addSubmodelInterface(1, 35, 35);
38 this.pinC = getSupermodelPin(C);
39 this.pinD1 = getSupermodelPin(D1);
40 this.pinD2 = getSupermodelPin(D2);
41 this.pinD3 = getSupermodelPin(D3);
42 this.pinD4 = getSupermodelPin(D4);
43 this.pinQ1 = getSupermodelPin(Q1);
44 this.pinQ2 = getSupermodelPin(Q2);
45 this.pinQ3 = getSupermodelPin(Q3);
46 this.pinQ4 = getSupermodelPin(Q4);
48 initSubmodelComponents(C, D1, D2, D3, D4, Q1, Q2, Q3, Q4);
51 @SuppressWarnings("unused") // for GUIWires being created
52 private void initSubmodelComponents(Pin C, Pin D1, Pin D2, Pin D3, Pin D4, Pin Q1, Pin Q2, Pin Q3, Pin Q4)
54 GUIdlatch dlatch1 = new GUIdlatch(submodelModifiable);
55 GUIdlatch dlatch2 = new GUIdlatch(submodelModifiable);
56 GUIdlatch dlatch3 = new GUIdlatch(submodelModifiable);
57 GUIdlatch dlatch4 = new GUIdlatch(submodelModifiable);
59 WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1);
60 WireCrossPoint cp3 = new WireCrossPoint(submodelModifiable, 1);
61 WireCrossPoint cp4 = new WireCrossPoint(submodelModifiable, 1);
63 dlatch1.moveTo(30, 7.5);
64 dlatch2.moveTo(30, 32.5);
65 dlatch3.moveTo(30, 57.5);
66 dlatch4.moveTo(30, 82.5);
69 cp4.moveTo(15, 102.5);
71 new GUIWire(submodelModifiable, C, cp4, new Point(15, 125));
72 new GUIWire(submodelModifiable, cp4, dlatch4.getPinE());
73 new GUIWire(submodelModifiable, cp4, cp3);
74 new GUIWire(submodelModifiable, cp3, dlatch3.getPinE());
75 new GUIWire(submodelModifiable, cp3, cp2);
76 new GUIWire(submodelModifiable, cp2, dlatch2.getPinE());
77 new GUIWire(submodelModifiable, cp2, dlatch1.getPinE(), new Point(15, 27.5));
78 new GUIWire(submodelModifiable, D1, dlatch1.getPinD());
79 new GUIWire(submodelModifiable, D2, dlatch2.getPinD());
80 new GUIWire(submodelModifiable, D3, dlatch3.getPinD());
81 new GUIWire(submodelModifiable, D4, dlatch4.getPinD());
82 new GUIWire(submodelModifiable, dlatch1.getPinQ(), Q1);
83 new GUIWire(submodelModifiable, dlatch2.getPinQ(), Q2);
84 new GUIWire(submodelModifiable, dlatch3.getPinQ(), Q3);
85 new GUIWire(submodelModifiable, dlatch4.getPinQ(), Q4);
103 public Pin getPinD3()
108 public Pin getPinD4()
113 public Pin getPinQ1()
118 public Pin getPinQ2()
123 public Pin getPinQ3()
128 public Pin getPinQ4()