From 20e9d3d11e5d06c45834c303e48522cbc4bfa98f Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Tue, 4 Jun 2019 07:20:49 +0200 Subject: [PATCH] Implemented GUIand --- .../ui/examples/ModularAm2901Example.java | 4 +- .../model/components/mi/nandbased/GUIand.java | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/ModularAm2901Example.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/ModularAm2901Example.java index 3c731170..b9f5ca00 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/ModularAm2901Example.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/ModularAm2901Example.java @@ -5,7 +5,7 @@ import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIBitDisplay; import net.mograsim.logic.ui.model.components.GUIManualSwitch; import net.mograsim.logic.ui.model.components.SubmodelComponent; -import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIand; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.modeladapter.LogicModelParameters; @@ -22,7 +22,7 @@ public class ModularAm2901Example @SuppressWarnings("unused") // for GUIWires being created public static void createAm2901Example(ViewModelModifiable model) { - SubmodelComponent comp = new GUI_rsLatch(model); + SubmodelComponent comp = new GUIand(model); int inputCount = 2; comp.moveTo(100, 0); 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 new file mode 100644 index 00000000..9cec0cec --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java @@ -0,0 +1,43 @@ +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.wires.GUIWire; +import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.model.wires.WireCrossPoint; + +public class GUIand extends SubmodelComponent +{ + 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); + + GUINandGate nand = new GUINandGate(submodelModifiable, 1); + nand.moveTo(20, 21.25); + GUINandGate not = new GUINandGate(submodelModifiable, 1); + not.moveTo(50, 21.25); + + WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1); + cp1.moveTo(45, 31.25); + + new GUIWire(submodelModifiable, A, nand.getInputPins().get(0), new Point(10, 12.5), new Point(10, 26.25)); + new GUIWire(submodelModifiable, B, nand.getInputPins().get(1), new Point(10, 50), new Point(10, 36.25)); + new GUIWire(submodelModifiable, nand.getOutputPin(), cp1.getPin()); + new GUIWire(submodelModifiable, cp1.getPin(), not.getInputPins().get(0), new Point(45, 26.25)); + new GUIWire(submodelModifiable, cp1.getPin(), not.getInputPins().get(1), new Point(45, 36.25)); + new GUIWire(submodelModifiable, not.getOutputPin(), Y); + } +} \ No newline at end of file -- 2.17.1