X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2FGUIandor414.java;h=e8a6415dbad151882bc3f58229cf09e9710b7615;hb=8bfb0835123a28531f2256cdea2cf872f9a21ef0;hp=d00c22b482ef6e8ac47b6fbfe368e172f67e5229;hpb=db49bc3573ccbfa4afc025101dba4f1c30c54672;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java index d00c22b4..e8a6415d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java @@ -2,155 +2,64 @@ 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.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; -public class GUIandor414 extends SubmodelComponent +public class GUIandor414 extends SimpleRectangularSubmodelComponent { - private final Pin pinC1; - private final Pin pinC2; - private final Pin pinC3; - private final Pin pinC4; - private final Pin pinA1; - private final Pin pinA2; - private final Pin pinA3; - private final Pin pinA4; - private final Pin pinB; - private final Pin pinY1; - private final Pin pinY2; - private final Pin pinY3; - private final Pin pinY4; - public GUIandor414(ViewModelModifiable model) { - super(model, "GUIandor414"); - setSize(50, 90); + super(model, 1, "GUIandor414"); setSubmodelScale(.4); - - Pin C1 = addSubmodelInterface(1, 0, 5); - Pin C2 = addSubmodelInterface(1, 0, 15); - Pin C3 = addSubmodelInterface(1, 0, 25); - Pin C4 = addSubmodelInterface(1, 0, 35); - Pin A1 = addSubmodelInterface(1, 0, 45); - Pin A2 = addSubmodelInterface(1, 0, 55); - Pin A3 = addSubmodelInterface(1, 0, 65); - Pin A4 = addSubmodelInterface(1, 0, 75); - Pin B = addSubmodelInterface(1, 0, 85); - Pin Y1 = addSubmodelInterface(1, 50, 5); - Pin Y2 = addSubmodelInterface(1, 50, 15); - Pin Y3 = addSubmodelInterface(1, 50, 25); - Pin Y4 = addSubmodelInterface(1, 50, 35); - - this.pinC1 = getSupermodelPin(C1); - this.pinC2 = getSupermodelPin(C2); - this.pinC3 = getSupermodelPin(C3); - this.pinC4 = getSupermodelPin(C4); - this.pinA1 = getSupermodelPin(A1); - this.pinA2 = getSupermodelPin(A2); - this.pinA3 = getSupermodelPin(A3); - this.pinA4 = getSupermodelPin(A4); - this.pinB = getSupermodelPin(B); - this.pinY1 = getSupermodelPin(Y1); - this.pinY2 = getSupermodelPin(Y2); - this.pinY3 = getSupermodelPin(Y3); - this.pinY4 = getSupermodelPin(Y4); - - initSubmodelComponents(C1, C2, C3, C4, A1, A2, A3, A4, B, Y1, Y2, Y3, Y4); + setInputCount(9); + setOutputCount(4); + initSubmodelComponents(); } @SuppressWarnings("unused") // for GUIWires being created - private void initSubmodelComponents(Pin C1, Pin C2, Pin C3, Pin C4, Pin A1, Pin A2, Pin A3, Pin A4, Pin B, Pin Y1, Pin Y2, Pin Y3, - Pin Y4) + private void initSubmodelComponents() { + Pin C1 = getInputSubmodelPins().get(0); + Pin C2 = getInputSubmodelPins().get(1); + Pin C3 = getInputSubmodelPins().get(2); + Pin C4 = getInputSubmodelPins().get(3); + Pin A1 = getInputSubmodelPins().get(4); + Pin A2 = getInputSubmodelPins().get(5); + Pin A3 = getInputSubmodelPins().get(6); + Pin A4 = getInputSubmodelPins().get(7); + Pin B = getInputSubmodelPins().get(8); + Pin Y1 = getOutputSubmodelPins().get(0); + Pin Y2 = getOutputSubmodelPins().get(1); + Pin Y3 = getOutputSubmodelPins().get(2); + Pin Y4 = getOutputSubmodelPins().get(3); + GUIand41 and = new GUIand41(submodelModifiable); GUIor_4 or = new GUIor_4(submodelModifiable); and.moveTo(15, 137.5); - or.moveTo(55, 97.5); - - new GUIWire(submodelModifiable, A1, and.getPinA1(), new Point(10, 112.5), new Point(10, 142.5)); - new GUIWire(submodelModifiable, A2, and.getPinA2(), new Point(5, 137.5), new Point(5, 152.5)); - new GUIWire(submodelModifiable, A3, and.getPinA3()); - new GUIWire(submodelModifiable, A4, and.getPinA4(), new Point(5, 187.5), new Point(5, 172.5)); - new GUIWire(submodelModifiable, B, and.getPinB(), new Point(10, 212.5), new Point(10, 187.5)); - new GUIWire(submodelModifiable, C1, or.getPinA1(), new Point(50, 12.5), new Point(50, 102.5)); - new GUIWire(submodelModifiable, C2, or.getPinA2(), new Point(45, 37.5), new Point(45, 112.5)); - new GUIWire(submodelModifiable, C3, or.getPinA3(), new Point(40, 62.5), new Point(40, 122.5)); - new GUIWire(submodelModifiable, C4, or.getPinA4(), new Point(35, 87.5), new Point(35, 132.5)); - new GUIWire(submodelModifiable, and.getPinY1(), or.getPinB1()); - new GUIWire(submodelModifiable, and.getPinY2(), or.getPinB2()); - new GUIWire(submodelModifiable, and.getPinY3(), or.getPinB3()); - new GUIWire(submodelModifiable, and.getPinY4(), or.getPinB4()); - new GUIWire(submodelModifiable, or.getPinY1(), Y1, new Point(100, 102.5), new Point(100, 12.5)); - new GUIWire(submodelModifiable, or.getPinY2(), Y2, new Point(105, 112.5), new Point(105, 37.5)); - new GUIWire(submodelModifiable, or.getPinY3(), Y3, new Point(110, 122.5), new Point(110, 62.5)); - new GUIWire(submodelModifiable, or.getPinY4(), Y4, new Point(115, 132.5), new Point(115, 87.5)); - } - - public Pin getPinC1() - { - return pinC1; - } - - public Pin getPinC2() - { - return pinC2; - } - - public Pin getPinC3() - { - return pinC3; - } - - public Pin getPinC4() - { - return pinC4; - } - - public Pin getPinA1() - { - return pinA1; - } - - public Pin getPinA2() - { - return pinA2; - } - - public Pin getPinA3() - { - return pinA3; - } - - public Pin getPinA4() - { - return pinA4; - } - - public Pin getPinB() - { - return pinB; + or.moveTo(35, 37.5); + + new GUIWire(submodelModifiable, A1, and.getInputPins().get(0), new Point(10, 112.5), new Point(10, 142.5)); + new GUIWire(submodelModifiable, A2, and.getInputPins().get(1), new Point(5, 137.5), new Point(5, 152.5)); + new GUIWire(submodelModifiable, A3, and.getInputPins().get(2), new Point[0]); + new GUIWire(submodelModifiable, A4, and.getInputPins().get(3), new Point(5, 187.5), new Point(5, 172.5)); + new GUIWire(submodelModifiable, B, and.getInputPins().get(4), new Point(10, 212.5), new Point(10, 182.5)); + new GUIWire(submodelModifiable, C1, or.getInputPins().get(0), new Point(10, 12.5), new Point(10, 42.5)); + new GUIWire(submodelModifiable, C2, or.getInputPins().get(1), new Point(5, 37.5), new Point(5, 52.5)); + new GUIWire(submodelModifiable, C3, or.getInputPins().get(2), new Point[0]); + new GUIWire(submodelModifiable, C4, or.getInputPins().get(3), new Point(5, 87.5), new Point(5, 72.5)); + new GUIWire(submodelModifiable, and.getOutputPins().get(0), or.getInputPins().get(4), new Point(70, 142.5), new Point(70, 120), + new Point(30, 120), new Point(30, 82.5)); + new GUIWire(submodelModifiable, and.getOutputPins().get(1), or.getInputPins().get(5), new Point(65, 152.5), new Point(65, 125), + new Point(25, 125), new Point(25, 92.5)); + new GUIWire(submodelModifiable, and.getOutputPins().get(2), or.getInputPins().get(6), new Point(60, 162.5), new Point(60, 130), + new Point(20, 130), new Point(20, 102.5)); + new GUIWire(submodelModifiable, and.getOutputPins().get(3), or.getInputPins().get(7), new Point(55, 172.5), new Point(55, 135), + new Point(15, 135), new Point(15, 112.5)); + new GUIWire(submodelModifiable, or.getOutputPins().get(0), Y1, new Point(75, 42.5), new Point(75, 12.5)); + new GUIWire(submodelModifiable, or.getOutputPins().get(1), Y2, new Point(80, 52.5), new Point(80, 37.5)); + new GUIWire(submodelModifiable, or.getOutputPins().get(2), Y3, new Point[0]); + new GUIWire(submodelModifiable, or.getOutputPins().get(3), Y4, new Point(80, 72.5), new Point(80, 87.5)); } - - public Pin getPinY1() - { - return pinY1; - } - - public Pin getPinY2() - { - return pinY2; - } - - public Pin getPinY3() - { - return pinY3; - } - - public Pin getPinY4() - { - return pinY4; - } - } \ No newline at end of file