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=2da80aecab82618f7f251bf549c8e25e1e6d5181;hpb=fc7ba04c16f22364b2cdded6bc0c1e17c0939e46;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 2da80aec..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; @@ -25,8 +26,7 @@ public class SubmodelComponentTestbench 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++) {