X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fexamples%2FSubmodelExample.java;fp=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fexamples%2FSubmodelExample.java;h=3cba4db7d442c9a2de0f5f980642b19bb1946ec4;hb=95d72ebf4ebc8b9aca649d3e604709fa9daaca24;hp=0000000000000000000000000000000000000000;hpb=4dca33ac72b3f476ab069d6627f5e824c4a55a5b;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelExample.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelExample.java new file mode 100644 index 00000000..3cba4db7 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/SubmodelExample.java @@ -0,0 +1,33 @@ +package net.mograsim.logic.ui.examples; + +import net.mograsim.logic.ui.SimpleLogicUIStandalone; +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.TestSubmodelNANDComponent; +import net.mograsim.logic.ui.model.wires.GUIWire; + +public class SubmodelExample +{ + public static void main(String[] args) + { + SimpleLogicUIStandalone.executeVisualisation(SubmodelExample::createSubmodelExample); + } + + @SuppressWarnings("unused") // GUIWires being created + public static void createSubmodelExample(ViewModelModifiable model) + { + GUIManualSwitch swA = new GUIManualSwitch(model); + swA.moveTo(0, 0); + GUIManualSwitch swB = new GUIManualSwitch(model); + swB.moveTo(0, 25); + TestSubmodelNANDComponent nand = new TestSubmodelNANDComponent(model); + nand.moveTo(30, 10); + GUIBitDisplay bdY = new GUIBitDisplay(model); + bdY.moveTo(70, 12.5); + + new GUIWire(model, swA.getOutputPin(), nand.getPins().get(0)); + new GUIWire(model, swB.getOutputPin(), nand.getPins().get(1)); + new GUIWire(model, nand.getPins().get(2), bdY.getInputPin()); + } +} \ No newline at end of file