X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2FGUIhalfadder.java;h=6d58f98327ac72056bbc400b685cd492346dfc14;hb=19ee1a7fdb06a1df65cd7df78fed935124496707;hp=d183e7743c6a3a9b44c952df86f55015ddf93f4a;hpb=82968fe783684eb9d47e5c5086cfb54d4209c4dc;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java index d183e774..6d58f983 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java @@ -14,18 +14,18 @@ public class GUIhalfadder extends SimpleRectangularSubmodelComponent { super(model, 1, "GUIhalfadder"); setSubmodelScale(.4); - setInputCount(2); - setOutputCount(2); + setInputPins("A", "B"); + setOutputPins("Y", "_Z"); initSubmodelComponents(); } @SuppressWarnings("unused") // for GUIWires being created private void initSubmodelComponents() { - Pin A = getInputSubmodelPins().get(0); - Pin B = getInputSubmodelPins().get(1); - Pin Y = getOutputSubmodelPins().get(0); - Pin _Z = getOutputSubmodelPins().get(1); + Pin A = getSubmodelPin("A"); + Pin B = getSubmodelPin("B"); + Pin Y = getSubmodelPin("Y"); + Pin _Z = getSubmodelPin("_Z"); GUINandGate nand_Z = new GUINandGate(submodelModifiable, 1); GUINandGate nandYA = new GUINandGate(submodelModifiable, 1); @@ -40,22 +40,22 @@ public class GUIhalfadder extends SimpleRectangularSubmodelComponent nandYA.moveTo(40, 2.5); nandYB.moveTo(40, 27.5); nandY.moveTo(65, 2.5); - cpA.moveTo(5, 12.5); - cpB.moveTo(5, 37.5); - cp_Z.moveTo(35, 25); + cpA.moveCenterTo(5, 12.5); + cpB.moveCenterTo(5, 37.5); + cp_Z.moveCenterTo(35, 25); new GUIWire(submodelModifiable, A, cpA, new Point[0]); - new GUIWire(submodelModifiable, cpA, nandYA.getInputPins().get(0), new Point(5, 7.5)); - new GUIWire(submodelModifiable, cpA, nand_Z.getInputPins().get(0), new Point(5, 20)); + new GUIWire(submodelModifiable, cpA, nandYA.getPin("A"), new Point(5, 7.5)); + new GUIWire(submodelModifiable, cpA, nand_Z.getPin("A"), new Point(5, 20)); new GUIWire(submodelModifiable, B, cpB, new Point[0]); - new GUIWire(submodelModifiable, cpB, nandYB.getInputPins().get(1), new Point(5, 42.5)); - new GUIWire(submodelModifiable, cpB, nand_Z.getInputPins().get(1), new Point(5, 30)); - new GUIWire(submodelModifiable, nand_Z.getOutputPin(), cp_Z, new Point[0]); + new GUIWire(submodelModifiable, cpB, nandYB.getPin("B"), new Point(5, 42.5)); + new GUIWire(submodelModifiable, cpB, nand_Z.getPin("B"), new Point(5, 30)); + new GUIWire(submodelModifiable, nand_Z.getPin("Y"), cp_Z, new Point[0]); new GUIWire(submodelModifiable, cp_Z, _Z, new Point(80, 25), new Point(80, 37.5)); - new GUIWire(submodelModifiable, cp_Z, nandYA.getInputPins().get(1), new Point(35, 17.5)); - new GUIWire(submodelModifiable, cp_Z, nandYB.getInputPins().get(0), new Point(35, 32.5)); - new GUIWire(submodelModifiable, nandYA.getOutputPin(), nandY.getInputPins().get(0), new Point(62.5, 12.5), new Point(62.5, 7.5)); - new GUIWire(submodelModifiable, nandYB.getOutputPin(), nandY.getInputPins().get(1), new Point(62.5, 37.5), new Point(62.5, 17.5)); - new GUIWire(submodelModifiable, nandY.getOutputPin(), Y, new Point[0]); + new GUIWire(submodelModifiable, cp_Z, nandYA.getPin("B"), new Point(35, 17.5)); + new GUIWire(submodelModifiable, cp_Z, nandYB.getPin("A"), new Point(35, 32.5)); + new GUIWire(submodelModifiable, nandYA.getPin("Y"), nandY.getPin("A"), new Point(62.5, 12.5), new Point(62.5, 7.5)); + new GUIWire(submodelModifiable, nandYB.getPin("Y"), nandY.getPin("B"), new Point(62.5, 37.5), new Point(62.5, 17.5)); + new GUIWire(submodelModifiable, nandY.getPin("Y"), Y, new Point[0]); } } \ No newline at end of file