X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fexamples%2FSubmodelComponentTestbench.java;h=27e3d166c503e5a5e464ef9e3207ac12c155efb6;hb=a7bca432c2b7127da12edde9e3e301d5c4c59ab7;hp=e55819a9fb8b3588063716c95759f31050c93931;hpb=a47c9b1f38bbb6d2f5a3c482f3b09d1f42270401;p=Mograsim.git diff --git a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/SubmodelComponentTestbench.java b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/SubmodelComponentTestbench.java index e55819a9..27e3d166 100644 --- a/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/SubmodelComponentTestbench.java +++ b/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/examples/SubmodelComponentTestbench.java @@ -1,6 +1,7 @@ package net.mograsim.logic.model.examples; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import net.mograsim.logic.model.SimpleLogicUIStandalone; @@ -22,11 +23,10 @@ public class SubmodelComponentTestbench @SuppressWarnings("unused") // for GUIWires being created public static void createTestbench(ViewModelModifiable model) { - GUIComponent comp = IndirectGUIComponentCreator.createComponent(model, "file:components/am2901/GUIAm2901.json", "Am2901"); + GUIComponent comp = IndirectGUIComponentCreator.createComponent(model, "GUIAm2901", "Am2901"); // guess which pins are outputs and which are inputs - // TODO this code exists three times... but it seems too "hacky" to put it in a helper class - // TODO sort pins correctly - use Y coordinate + // TODO this code exists four times... but it seems too "hacky" to put it in a helper class List inputPinNames = new ArrayList<>(); List outputPinNames = new ArrayList<>(); for (Pin p : comp.getPins().values()) @@ -35,6 +35,9 @@ public class SubmodelComponentTestbench else outputPinNames.add(p.name); + inputPinNames.sort(Comparator.comparing(comp::getPin, Comparator.comparing(Pin::getRelY))); + outputPinNames.sort(Comparator.comparing(comp::getPin, Comparator.comparing(Pin::getRelY))); + comp.moveTo(100, 0); for (int i = 0; i < inputPinNames.size(); i++) {