From: Daniel Kirschten Date: Tue, 11 Jun 2019 20:12:05 +0000 (+0200) Subject: Implemented GUIxor X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=6074b5904dc7a1c2e4ba37976f37b8b4ad524de5;p=Mograsim.git Implemented GUIxor --- diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java new file mode 100644 index 00000000..da3410bf --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java @@ -0,0 +1,59 @@ +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.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 GUIxor extends SimpleRectangularSubmodelComponent +{ + public GUIxor(ViewModelModifiable model) + { + super(model, 1, "GUIxor"); + setSubmodelScale(.4); + setInputCount(2); + setOutputCount(1); + 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); + + GUINandGate nandAB = new GUINandGate(submodelModifiable, 1); + GUINandGate nandYA = new GUINandGate(submodelModifiable, 1); + GUINandGate nandYB = new GUINandGate(submodelModifiable, 1); + GUINandGate nandY = new GUINandGate(submodelModifiable, 1); + + WireCrossPoint cpA = new WireCrossPoint(submodelModifiable, 1); + WireCrossPoint cpB = new WireCrossPoint(submodelModifiable, 1); + WireCrossPoint cpAB = new WireCrossPoint(submodelModifiable, 1); + + nandAB.moveTo(7.5, 15); + nandYA.moveTo(35, 2.5); + nandYB.moveTo(35, 27.5); + nandY.moveTo(62.5, 15); + cpA.moveCenterTo(5, 12.5); + cpB.moveCenterTo(5, 37.5); + cpAB.moveCenterTo(30, 25); + + new GUIWire(submodelModifiable, A, cpA, new Point[0]); + new GUIWire(submodelModifiable, B, cpB, new Point[0]); + new GUIWire(submodelModifiable, cpA, nandAB.getInputPins().get(0), new Point(5, 20)); + new GUIWire(submodelModifiable, cpB, nandAB.getInputPins().get(1), new Point(5, 30)); + new GUIWire(submodelModifiable, nandAB.getOutputPin(), cpAB.getPin()); + new GUIWire(submodelModifiable, cpAB.getPin(), nandYA.getInputPins().get(1), new Point(30, 17.5)); + new GUIWire(submodelModifiable, cpAB.getPin(), nandYB.getInputPins().get(0), new Point(30, 32.5)); + new GUIWire(submodelModifiable, cpA.getPin(), nandYA.getInputPins().get(0), new Point(5, 7.5)); + new GUIWire(submodelModifiable, cpB.getPin(), nandYB.getInputPins().get(1), new Point(5, 42.5)); + new GUIWire(submodelModifiable, nandYA.getOutputPin(), nandY.getInputPins().get(0)); + new GUIWire(submodelModifiable, nandYB.getOutputPin(), nandY.getInputPins().get(1)); + new GUIWire(submodelModifiable, nandY.getOutputPin(), Y); + } +} \ No newline at end of file