X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fexamples%2FSubmodelComponentTestbench.java;fp=net.mograsim.logic.model.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fexamples%2FSubmodelComponentTestbench.java;h=2ab42305cbf435c8c98900e398b0d89ea39f5a91;hb=c84bfeca6264b1c02ed500fb0a2f421133b9766f;hp=2da80aecab82618f7f251bf549c8e25e1e6d5181;hpb=d6ca4ff3df924ad32ed325b5fb2c9e1f02e57e3c;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..2ab42305 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; @@ -26,7 +27,6 @@ public class SubmodelComponentTestbench // 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 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++) {