X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fexamples%2FJsonExample.java;h=9596a6934cd2b2de2be3ff199dcfcca12f834e7b;hb=19ee1a7fdb06a1df65cd7df78fed935124496707;hp=82b2c8c477359442d0cd19001a6d81f90232556c;hpb=82cc1d386820c179be331790fa3c1fae22bada76;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/JsonExample.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/JsonExample.java index 82b2c8c4..9596a693 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/JsonExample.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/examples/JsonExample.java @@ -9,9 +9,9 @@ import net.mograsim.logic.ui.model.components.GUICustomComponentCreator; import net.mograsim.logic.ui.model.components.GUIManualSwitch; import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent; import net.mograsim.logic.ui.model.components.SubmodelComponent; +import net.mograsim.logic.ui.model.components.SubmodelComponentParams; import net.mograsim.logic.ui.model.components.mi.nandbased.GUIfulladder; import net.mograsim.logic.ui.model.components.mi.nandbased.GUIhalfadder; -import net.mograsim.logic.ui.model.components.params.SubmodelComponentParams; import net.mograsim.logic.ui.model.wires.GUIWire; public class JsonExample @@ -26,8 +26,8 @@ public class JsonExample protected TestComponent(ViewModelModifiable model) { super(model, 1, "Test"); - setInputCount(1); setSubmodelScale(.4); + setInputPins("Input pin #0"); GUICustomComponentCreator.create(submodelModifiable, "HalfAdder.json"); } } @@ -76,7 +76,8 @@ public class JsonExample e.printStackTrace(); } - SimpleRectangularSubmodelComponent adder = new GUIfulladder(model); + SimpleRectangularSubmodelComponent adder = (SimpleRectangularSubmodelComponent) GUICustomComponentCreator.create(model, + "FullAdder.json"); GUIManualSwitch swA = new GUIManualSwitch(model); swA.moveTo(0, 0); @@ -91,12 +92,12 @@ public class JsonExample GUIBitDisplay bdZ = new GUIBitDisplay(model); bdZ.moveTo(90, 30); - new GUIWire(model, swA.getOutputPin(), adder.getInputPins().get(0)); - new GUIWire(model, swB.getOutputPin(), adder.getInputPins().get(1)); - new GUIWire(model, swC.getOutputPin(), adder.getInputPins().get(2)); + new GUIWire(model, swA.getOutputPin(), adder.getPin("A")); + new GUIWire(model, swB.getOutputPin(), adder.getPin("B")); + new GUIWire(model, swC.getOutputPin(), adder.getPin("C")); - new GUIWire(model, adder.getOutputPins().get(0), bdY.getInputPin()); - new GUIWire(model, adder.getOutputPins().get(1), bdZ.getInputPin()); + new GUIWire(model, adder.getPin("Y"), bdY.getInputPin()); + new GUIWire(model, adder.getPin("Z"), bdZ.getInputPin()); SubmodelComponent adder2 = GUICustomComponentCreator.create(model, pC, ""); @@ -113,11 +114,11 @@ public class JsonExample bdZ = new GUIBitDisplay(model); bdZ.moveTo(90, 85); - new GUIWire(model, swA.getOutputPin(), adder2.getPins().get(0)); - new GUIWire(model, swB.getOutputPin(), adder2.getPins().get(1)); - new GUIWire(model, swC.getOutputPin(), adder2.getPins().get(2)); + new GUIWire(model, swA.getOutputPin(), adder.getPin("A")); + new GUIWire(model, swB.getOutputPin(), adder.getPin("B")); + new GUIWire(model, swC.getOutputPin(), adder.getPin("C")); - new GUIWire(model, adder2.getPins().get(3), bdY.getInputPin()); - new GUIWire(model, adder2.getPins().get(4), bdZ.getInputPin()); + new GUIWire(model, adder.getPin("Y"), bdY.getInputPin()); + new GUIWire(model, adder.getPin("Z"), bdZ.getInputPin()); } } \ No newline at end of file