projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a new symbol renderer: PinNamesSymbolRenderer
[Mograsim.git]
/
net.mograsim.logic.model.am2900
/
src
/
net
/
mograsim
/
logic
/
model
/
examples
/
SubmodelComponentTestbench.java
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
e55819a
..
27e3d16
100644
(file)
--- 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;
package net.mograsim.logic.model.examples;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.List;
import net.mograsim.logic.model.SimpleLogicUIStandalone;
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)
{
@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
// 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<String> inputPinNames = new ArrayList<>();
List<String> outputPinNames = new ArrayList<>();
for (Pin p : comp.getPins().values())
List<String> inputPinNames = new ArrayList<>();
List<String> outputPinNames = new ArrayList<>();
for (Pin p : comp.getPins().values())
@@
-35,6
+35,9
@@
public class SubmodelComponentTestbench
else
outputPinNames.add(p.name);
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++)
{
comp.moveTo(100, 0);
for (int i = 0; i < inputPinNames.size(); i++)
{