X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2FGUI_rsLatch.java;h=e381847696f9e2998575d8ebaf94a18518669225;hb=ae74a6a022756a4cc7ee5b453ad7a68e13832788;hp=510becfaf6a6beca86e69cd30426275170ad3cdb;hpb=3400148c81a0f9713ecb09d9a2c4554a4c4c7d8d;p=Mograsim.git 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 510becfa..e3818476 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 @@ -3,48 +3,48 @@ package net.mograsim.logic.ui.model.components.mi.nandbased; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUINandGate; -import net.mograsim.logic.ui.model.components.SubmodelComponent; +import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; -public class GUI_rsLatch extends SubmodelComponent +public class GUI_rsLatch extends SimpleRectangularSubmodelComponent { public GUI_rsLatch(ViewModelModifiable model) { - super(model, "_rsLatch"); - setSize(35, 25); - setSubmodelScale(.2); + super(model, 1, "_rsLatch"); + setSubmodelScale(.4); + setInputPins("_S", "_R"); + setOutputPins("Q", "_Q"); initSubmodelComponents(); } - @SuppressWarnings("unused") + @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); + Pin _S = getInputSubmodelPins().get(0); + Pin _R = getInputSubmodelPins().get(1); + Pin Q = getOutputSubmodelPins().get(0); + Pin _Q = getOutputSubmodelPins().get(1); GUINandGate nand1 = new GUINandGate(submodelModifiable, 1); - nand1.moveTo(80, 20); GUINandGate nand2 = new GUINandGate(submodelModifiable, 1); - nand2.moveTo(80, 85); WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1); - cp1.moveTo(120, 30); WireCrossPoint cp2 = new WireCrossPoint(submodelModifiable, 1); - cp2.moveTo(120, 95); - new GUIWire(submodelModifiable, _S, nand1.getInputPins().get(0)); - new GUIWire(submodelModifiable, _R, nand2.getInputPins().get(1)); - new GUIWire(submodelModifiable, nand1.getOutputPin(), cp1.getPin()); - new GUIWire(submodelModifiable, nand2.getOutputPin(), cp2.getPin()); - new GUIWire(submodelModifiable, cp1.getPin(), nand2.getInputPins().get(0), new Point(120, 50), new Point(60, 75), - new Point(60, 90)); - new GUIWire(submodelModifiable, cp2.getPin(), nand1.getInputPins().get(1), new Point(120, 75), new Point(60, 50), - new Point(60, 35)); - 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)); + nand1.moveTo(10, 7.5); + nand2.moveTo(40, 12.5); + cp1.moveCenterTo(35, 17.5); + cp2.moveCenterTo(65, 37.5); + + new GUIWire(submodelModifiable, _S, nand1.getInputPins().get(0), new Point[0]); + new GUIWire(submodelModifiable, _R, nand2.getInputPins().get(1), new Point(35, 37.5), new Point(35, 27.5)); + new GUIWire(submodelModifiable, nand1.getOutputPin(), cp1, new Point[0]); + new GUIWire(submodelModifiable, nand2.getOutputPin(), cp2, new Point(65, 22.5)); + new GUIWire(submodelModifiable, cp1, nand2.getInputPins().get(0), new Point[0]); + new GUIWire(submodelModifiable, cp2, nand1.getInputPins().get(1), new Point(65, 42.5), new Point(5, 42.5), new Point(5, 22.5)); + 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)); + new GUIWire(submodelModifiable, cp2, _Q, new Point[0]); } } \ No newline at end of file