From: Daniel Kirschten Date: Tue, 4 Jun 2019 06:00:50 +0000 (+0200) Subject: Added getter for submodel interface pins in GUIand and GUI_rsLatch X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=5fd86d84a38b322a67f454998f7f1a0e424c90b4;p=Mograsim.git Added getter for submodel interface pins in GUIand and GUI_rsLatch --- diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java index 589bd8fa..26be11ed 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java @@ -10,22 +10,34 @@ import net.mograsim.logic.ui.model.wires.WireCrossPoint; public class GUI_rsLatch extends SubmodelComponent { + private final Pin pin_S; + private final Pin pin_R; + private final Pin pinQ; + private final Pin pin_Q; + public GUI_rsLatch(ViewModelModifiable model) { super(model, "_rsLatch"); setSize(35, 25); setSubmodelScale(.2); - initSubmodelComponents(); - } - @SuppressWarnings("unused") // for GUIWires being created - private void initSubmodelComponents() - { Pin _S = addSubmodelInterface(1, 0, 5); Pin _R = addSubmodelInterface(1, 0, 20); Pin Q = addSubmodelInterface(1, 35, 5); Pin _Q = addSubmodelInterface(1, 35, 20); + this.pin_S = getSupermodelPin(_S); + this.pin_R = getSupermodelPin(_R); + this.pinQ = getSupermodelPin(Q); + this.pin_Q = getSupermodelPin(_Q); + + initSubmodelComponents(_S, _R, Q, _Q); + } + + @SuppressWarnings("unused") // for GUIWires being created + private void initSubmodelComponents(Pin _S, Pin _R, Pin Q, Pin _Q) + { + GUINandGate nand1 = new GUINandGate(submodelModifiable, 1); nand1.moveTo(80, 20); GUINandGate nand2 = new GUINandGate(submodelModifiable, 1); @@ -47,4 +59,24 @@ public class GUI_rsLatch extends SubmodelComponent new GUIWire(submodelModifiable, cp1.getPin(), Q, new Point(150, 30), new Point(150, 25)); new GUIWire(submodelModifiable, cp2.getPin(), _Q, new Point(150, 95), new Point(150, 100)); } + + public Pin getPin_S() + { + return pin_S; + } + + public Pin getPin_R() + { + return pin_R; + } + + public Pin getPinQ() + { + return pinQ; + } + + public Pin getPin_Q() + { + return pin_Q; + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java index 9cec0cec..2d6d3b5f 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java @@ -10,21 +10,30 @@ import net.mograsim.logic.ui.model.wires.WireCrossPoint; public class GUIand extends SubmodelComponent { + private final Pin pinA; + private final Pin pinB; + private final Pin pinY; + public GUIand(ViewModelModifiable model) { super(model, "GUIand"); setSize(35, 25); setSubmodelScale(.4); - initSubmodelComponents(); - } - @SuppressWarnings("unused") // for GUIWires being created - private void initSubmodelComponents() - { Pin A = addSubmodelInterface(1, 0, 5); Pin B = addSubmodelInterface(1, 0, 20); Pin Y = addSubmodelInterface(1, 35, 12.5); + this.pinA = getSupermodelPin(A); + this.pinB = getSupermodelPin(B); + this.pinY = getSupermodelPin(Y); + + initSubmodelComponents(A, B, Y); + } + + @SuppressWarnings("unused") // for GUIWires being created + private void initSubmodelComponents(Pin A, Pin B, Pin Y) + { GUINandGate nand = new GUINandGate(submodelModifiable, 1); nand.moveTo(20, 21.25); GUINandGate not = new GUINandGate(submodelModifiable, 1); @@ -40,4 +49,20 @@ public class GUIand extends SubmodelComponent new GUIWire(submodelModifiable, cp1.getPin(), not.getInputPins().get(1), new Point(45, 36.25)); new GUIWire(submodelModifiable, not.getOutputPin(), Y); } + + public Pin getPinA() + { + return pinA; + } + + public Pin getPinB() + { + return pinB; + } + + public Pin getPinY() + { + return pinY; + } + } \ No newline at end of file