mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 07:48:29 -04:00
improved measurement ordering
This commit is contained in:
parent
423ebf851a
commit
76aab0b31c
@ -5,6 +5,10 @@
|
||||
<visualElement>
|
||||
<elementName>JK_FF</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>valueIsProbe</string>
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>z_0</string>
|
||||
@ -16,6 +20,10 @@
|
||||
<visualElement>
|
||||
<elementName>JK_FF</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>valueIsProbe</string>
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>z_1</string>
|
||||
@ -36,6 +44,21 @@
|
||||
<pos x="440" y="420"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Clock</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>Takt</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Frequency</string>
|
||||
<int>10</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="400" y="340"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>LED</elementName>
|
||||
<elementAttributes>
|
||||
@ -87,17 +110,6 @@
|
||||
<pos x="700" y="380"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Clock</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>Takt</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="400" y="340"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
@ -201,4 +213,12 @@
|
||||
<p2 x="460" y="340"/>
|
||||
</wire>
|
||||
</wires>
|
||||
<measurementOrdering>
|
||||
<string>Takt</string>
|
||||
<string>z_0</string>
|
||||
<string>z_1</string>
|
||||
<string>Rot</string>
|
||||
<string>Gelb</string>
|
||||
<string>Grün</string>
|
||||
</measurementOrdering>
|
||||
</circuit>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
@ -9,7 +10,7 @@
|
||||
<int>3</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="80" y="40"/>
|
||||
<pos x="160" y="80"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
@ -20,13 +21,13 @@
|
||||
<int>3</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="80" y="120"/>
|
||||
<pos x="160" y="240"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Not</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="90" y="90"/>
|
||||
<pos x="180" y="180"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
@ -41,7 +42,7 @@
|
||||
<int>1</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="50" y="50"/>
|
||||
<pos x="100" y="100"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
@ -52,43 +53,43 @@
|
||||
<string>C</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="50" y="90"/>
|
||||
<pos x="100" y="180"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>NOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="130" y="50"/>
|
||||
<pos x="260" y="100"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>NOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="130" y="110"/>
|
||||
<pos x="260" y="220"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="200" y="40"/>
|
||||
<pos x="400" y="80"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="200" y="120"/>
|
||||
<pos x="400" y="240"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>NOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="250" y="50"/>
|
||||
<pos x="500" y="100"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>NOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="250" y="110"/>
|
||||
<pos x="500" y="220"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
@ -99,7 +100,7 @@
|
||||
<string>Q</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="310" y="60"/>
|
||||
<pos x="620" y="120"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
@ -110,7 +111,7 @@
|
||||
<string>~Q</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="310" y="120"/>
|
||||
<pos x="620" y="240"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
@ -125,214 +126,221 @@
|
||||
<int>1</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="50" y="130"/>
|
||||
<pos x="100" y="260"/>
|
||||
<rotate>0</rotate>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="120" y="100"/>
|
||||
<p2 x="180" y="80"/>
|
||||
<p1 x="240" y="200"/>
|
||||
<p2 x="360" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="120" y="80"/>
|
||||
<p2 x="180" y="100"/>
|
||||
<p1 x="240" y="160"/>
|
||||
<p2 x="360" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="80"/>
|
||||
<p2 x="300" y="100"/>
|
||||
<p1 x="480" y="160"/>
|
||||
<p2 x="600" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="100"/>
|
||||
<p2 x="300" y="80"/>
|
||||
<p1 x="480" y="200"/>
|
||||
<p2 x="600" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="160"/>
|
||||
<p1 x="140" y="320"/>
|
||||
<p2 x="480" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="240"/>
|
||||
<p2 x="400" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="240"/>
|
||||
<p2 x="360" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="240"/>
|
||||
<p2 x="160" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="240"/>
|
||||
<p2 x="600" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="600" y="240"/>
|
||||
<p2 x="620" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="80"/>
|
||||
<p2 x="400" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="80"/>
|
||||
<p2 x="160" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="260"/>
|
||||
<p2 x="260" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="260"/>
|
||||
<p2 x="500" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="100" y="260"/>
|
||||
<p2 x="160" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="100" y="100"/>
|
||||
<p2 x="160" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="100"/>
|
||||
<p2 x="260" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="100"/>
|
||||
<p2 x="500" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="100" y="180"/>
|
||||
<p2 x="140" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="180"/>
|
||||
<p2 x="380" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="180"/>
|
||||
<p2 x="180" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="40"/>
|
||||
<p2 x="480" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="120"/>
|
||||
<p2 x="160" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="120"/>
|
||||
<p2 x="360" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="120"/>
|
||||
<p2 x="400" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="120"/>
|
||||
<p2 x="600" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="600" y="120"/>
|
||||
<p2 x="620" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="280"/>
|
||||
<p2 x="400" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="140" y="280"/>
|
||||
<p2 x="160" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="140"/>
|
||||
<p2 x="260" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="140"/>
|
||||
<p2 x="500" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="220"/>
|
||||
<p2 x="260" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="220"/>
|
||||
<p2 x="500" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="40"/>
|
||||
<p2 x="480" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="200"/>
|
||||
<p2 x="480" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="140"/>
|
||||
<p2 x="480" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="220"/>
|
||||
<p2 x="480" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="200"/>
|
||||
<p2 x="240" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="140"/>
|
||||
<p2 x="240" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="110" y="130"/>
|
||||
<p2 x="130" y="130"/>
|
||||
<p1 x="360" y="80"/>
|
||||
<p2 x="360" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="230" y="130"/>
|
||||
<p2 x="250" y="130"/>
|
||||
<p1 x="360" y="200"/>
|
||||
<p2 x="360" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="50" y="130"/>
|
||||
<p2 x="80" y="130"/>
|
||||
<p1 x="360" y="240"/>
|
||||
<p2 x="360" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="50" y="50"/>
|
||||
<p2 x="80" y="50"/>
|
||||
<p1 x="360" y="120"/>
|
||||
<p2 x="360" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="110" y="50"/>
|
||||
<p2 x="130" y="50"/>
|
||||
<p1 x="600" y="200"/>
|
||||
<p2 x="600" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="230" y="50"/>
|
||||
<p2 x="250" y="50"/>
|
||||
<p1 x="600" y="120"/>
|
||||
<p2 x="600" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="20"/>
|
||||
<p2 x="240" y="20"/>
|
||||
<p1 x="140" y="120"/>
|
||||
<p2 x="140" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="120" y="70"/>
|
||||
<p2 x="130" y="70"/>
|
||||
<p1 x="140" y="40"/>
|
||||
<p2 x="140" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="70"/>
|
||||
<p2 x="250" y="70"/>
|
||||
<p1 x="140" y="280"/>
|
||||
<p2 x="140" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="190" y="120"/>
|
||||
<p2 x="200" y="120"/>
|
||||
<p1 x="140" y="180"/>
|
||||
<p2 x="140" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="170" y="120"/>
|
||||
<p2 x="180" y="120"/>
|
||||
<p1 x="380" y="120"/>
|
||||
<p2 x="380" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="120"/>
|
||||
<p2 x="80" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="290" y="120"/>
|
||||
<p2 x="300" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="120"/>
|
||||
<p2 x="310" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="40"/>
|
||||
<p2 x="200" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="40"/>
|
||||
<p2 x="80" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="50" y="90"/>
|
||||
<p2 x="70" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="110" y="90"/>
|
||||
<p2 x="190" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="90"/>
|
||||
<p2 x="90" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="60"/>
|
||||
<p2 x="80" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="170" y="60"/>
|
||||
<p2 x="180" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="190" y="60"/>
|
||||
<p2 x="200" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="290" y="60"/>
|
||||
<p2 x="300" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="60"/>
|
||||
<p2 x="310" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="140"/>
|
||||
<p2 x="200" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="140"/>
|
||||
<p2 x="80" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="120" y="110"/>
|
||||
<p2 x="130" y="110"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="110"/>
|
||||
<p2 x="250" y="110"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="20"/>
|
||||
<p2 x="240" y="70"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="100"/>
|
||||
<p2 x="240" y="110"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="70"/>
|
||||
<p2 x="240" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="110"/>
|
||||
<p2 x="240" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="40"/>
|
||||
<p2 x="180" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="100"/>
|
||||
<p2 x="180" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="60"/>
|
||||
<p2 x="180" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="180" y="120"/>
|
||||
<p2 x="180" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="60"/>
|
||||
<p2 x="70" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="20"/>
|
||||
<p2 x="70" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="140"/>
|
||||
<p2 x="70" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="70" y="90"/>
|
||||
<p2 x="70" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="120" y="100"/>
|
||||
<p2 x="120" y="110"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="120" y="70"/>
|
||||
<p2 x="120" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="100"/>
|
||||
<p2 x="300" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="60"/>
|
||||
<p2 x="300" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="190" y="60"/>
|
||||
<p2 x="190" y="90"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="190" y="90"/>
|
||||
<p2 x="190" y="120"/>
|
||||
<p1 x="380" y="180"/>
|
||||
<p2 x="380" y="240"/>
|
||||
</wire>
|
||||
</wires>
|
||||
<measurementOrdering>
|
||||
<string>C</string>
|
||||
<string>J</string>
|
||||
<string>K</string>
|
||||
<string>Q</string>
|
||||
<string>~Q</string>
|
||||
</measurementOrdering>
|
||||
</circuit>
|
@ -361,6 +361,16 @@ public class Model {
|
||||
return signals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a copy of all registered Signals
|
||||
*/
|
||||
public ArrayList<Signal> getSignalsCopy() {
|
||||
ArrayList<Signal> n = new ArrayList<>(signals.size());
|
||||
n.addAll(signals);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* registers a ROM to the model
|
||||
* @param rom the ROM
|
||||
@ -419,6 +429,11 @@ public class Model {
|
||||
public int compareTo(Signal o) {
|
||||
return name.compareTo(o.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.neemann.digital.lang.Lang;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
@ -39,6 +40,7 @@ public class Circuit {
|
||||
private ElementAttributes attributes;
|
||||
private final ArrayList<VisualElement> visualElements;
|
||||
private ArrayList<Wire> wires;
|
||||
private List<String> measurementOrdering;
|
||||
private transient boolean dotsPresent = false;
|
||||
private transient boolean modified = false;
|
||||
|
||||
@ -430,4 +432,21 @@ public class Circuit {
|
||||
return pinList.toArray(new ObservableValue[pinList.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ordering of values used to show measurements
|
||||
*
|
||||
* @return list of names
|
||||
*/
|
||||
public List<String> getMeasurementOrdering() {
|
||||
return measurementOrdering;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ordering of values used to show measurements
|
||||
*
|
||||
* @param measurementOrdering
|
||||
*/
|
||||
public void setMeasurementOrdering(List<String> measurementOrdering) {
|
||||
this.measurementOrdering = measurementOrdering;
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ import de.neemann.digital.draw.model.RealTimeClock;
|
||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||
import de.neemann.digital.gui.components.CircuitComponent;
|
||||
import de.neemann.digital.gui.components.ElementOrderer;
|
||||
import de.neemann.digital.gui.components.OrderMerger;
|
||||
import de.neemann.digital.gui.components.ProbeDialog;
|
||||
import de.neemann.digital.gui.components.data.DataSetDialog;
|
||||
import de.neemann.digital.gui.components.data.MeasurementFilter;
|
||||
import de.neemann.digital.gui.components.listing.ROMListingDialog;
|
||||
import de.neemann.digital.gui.state.State;
|
||||
import de.neemann.digital.gui.state.StateManager;
|
||||
@ -31,6 +31,8 @@ import java.awt.event.WindowEvent;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
@ -45,7 +47,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
private static final Icon ICON_STEP = IconCreator.create("step.gif");
|
||||
private static final Icon ICON_ELEMENT = IconCreator.create("element.gif");
|
||||
private static final Icon ICON_SELECT = IconCreator.create("Select24.gif");
|
||||
// private static final Icon ICON_WIRE = IconCreator.create("wire.gif");
|
||||
private static final Icon ICON_NEW = IconCreator.create("New24.gif");
|
||||
private static final Icon ICON_OPEN = IconCreator.create("Open24.gif");
|
||||
private static final Icon ICON_OPEN_WIN = IconCreator.create("OpenNew24.gif");
|
||||
@ -73,7 +74,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
private ScheduledThreadPoolExecutor timerExecuter = new ScheduledThreadPoolExecutor(1);
|
||||
|
||||
private State elementState;
|
||||
//private State wireState;
|
||||
private State selectState;
|
||||
private State runModelState;
|
||||
private State runModelMicroState;
|
||||
@ -203,7 +203,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
JMenu edit = new JMenu(Lang.get("menu_edit"));
|
||||
bar.add(edit);
|
||||
|
||||
//ToolTipAction wireStateAction = wireState.createToolTipAction(Lang.get("menu_wire"), ICON_WIRE).setToolTip(Lang.get("menu_wire_tt"));
|
||||
ToolTipAction elementStateAction = elementState.createToolTipAction(Lang.get("menu_element"), ICON_ELEMENT).setToolTip(Lang.get("menu_element_tt"));
|
||||
ToolTipAction selectStateAction = selectState.createToolTipAction(Lang.get("menu_select"), ICON_SELECT).setToolTip(Lang.get("menu_select_tt"));
|
||||
|
||||
@ -226,8 +225,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
ToolTipAction orderMeasurements = new ToolTipAction(Lang.get("menu_orderMeasurements")) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ElementOrder o = new ElementOrder(circuitComponent.getCircuit(), new MeasurementFilter());
|
||||
new ElementOrderer<>(Main.this, Lang.get("menu_orderMeasurements"), o).setVisible(true);
|
||||
orderMeasurements();
|
||||
}
|
||||
}.setToolTip(Lang.get("menu_orderMeasurements_tt"));
|
||||
|
||||
@ -241,7 +239,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
|
||||
|
||||
edit.add(elementStateAction.createJMenuItem());
|
||||
//edit.add(wireStateAction.createJMenuItem());
|
||||
edit.add(selectStateAction.createJMenuItem());
|
||||
edit.add(orderInputs.createJMenuItem());
|
||||
edit.add(orderOutputs.createJMenuItem());
|
||||
@ -316,7 +313,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
run.add(runModelMicroAction.createJMenuItem());
|
||||
run.add(doStep.createJMenuItem());
|
||||
run.add(runToBreak.createJMenuItem());
|
||||
//run.add(speedTest.createJMenuItem());
|
||||
run.add(showProbes);
|
||||
run.add(showGraph);
|
||||
run.add(showListing);
|
||||
@ -329,7 +325,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
toolBar.add(save.createJButtonNoText());
|
||||
toolBar.addSeparator();
|
||||
toolBar.add(elementState.setIndicator(elementStateAction.createJButtonNoText()));
|
||||
//toolBar.add(wireState.setIndicator(wireStateAction.createJButtonNoText()));
|
||||
toolBar.add(selectState.setIndicator(selectStateAction.createJButtonNoText()));
|
||||
toolBar.add(circuitComponent.getDeleteAction().createJButtonNoText());
|
||||
toolBar.addSeparator();
|
||||
@ -353,9 +348,24 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
setLocationRelativeTo(parent);
|
||||
}
|
||||
|
||||
private void orderMeasurements() {
|
||||
try {
|
||||
Model m = new ModelDescription(circuitComponent.getCircuit(), library).createModel();
|
||||
circuitComponent.getCircuit().clearState();
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
for (Model.Signal s : m.getSignals())
|
||||
names.add(s.getName());
|
||||
new OrderMerger<String, String>(circuitComponent.getCircuit().getMeasurementOrdering()).order(names);
|
||||
ElementOrderer.ListOrder<String> o = new ElementOrderer.ListOrder<>(names);
|
||||
new ElementOrderer<>(Main.this, Lang.get("menu_orderMeasurements"), o).setVisible(true);
|
||||
circuitComponent.getCircuit().setMeasurementOrdering(names);
|
||||
} catch (Exception e1) {
|
||||
showSwingError(Lang.get("msg_errorCreatingModel"), e1);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupStates() {
|
||||
elementState = stateManager.register(new ModeState(CircuitComponent.Mode.part));
|
||||
//wireState = stateManager.register(new ModeState(CircuitComponent.Mode.wire));
|
||||
selectState = stateManager.register(new ModeState(CircuitComponent.Mode.select));
|
||||
runModelState = stateManager.register(new State() {
|
||||
@Override
|
||||
@ -425,11 +435,13 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
|
||||
runToBreak.setEnabled(!runClock && model.isFastRunModel());
|
||||
|
||||
if (showProbes.isSelected())
|
||||
new ProbeDialog(this, model, updateEvent).setVisible(true);
|
||||
List<String> ordering = circuitComponent.getCircuit().getMeasurementOrdering();
|
||||
if (showProbes.isSelected()) {
|
||||
new ProbeDialog(this, model, updateEvent, ordering).setVisible(true);
|
||||
}
|
||||
|
||||
if (showGraph.isSelected())
|
||||
new DataSetDialog(this, model, updateEvent).setVisible(true);
|
||||
new DataSetDialog(this, model, updateEvent, ordering).setVisible(true);
|
||||
|
||||
if (showListing.isSelected())
|
||||
for (ROM rom : model.getRoms())
|
||||
|
@ -39,9 +39,9 @@ import java.util.HashSet;
|
||||
* @author hneemann
|
||||
*/
|
||||
public class CircuitComponent extends JComponent {
|
||||
private static final Icon iconDelete = IconCreator.create("Delete24.gif");
|
||||
private static final Icon ICON_DELETE = IconCreator.create("Delete24.gif");
|
||||
private static final String DEL_ACTION = "myDelAction";
|
||||
|
||||
private static final String delAction = "myDelAction";
|
||||
private final ElementLibrary library;
|
||||
private final ShapeFactory shapeFactory;
|
||||
private final HashSet<Drawable> highLighted;
|
||||
@ -59,8 +59,8 @@ public class CircuitComponent extends JComponent {
|
||||
setCircuit(aCircuit);
|
||||
|
||||
KeyStroke delKey = KeyStroke.getKeyStroke("DELETE");
|
||||
getInputMap().put(delKey, delAction);
|
||||
getActionMap().put(delAction, deleteAction);
|
||||
getInputMap().put(delKey, DEL_ACTION);
|
||||
getActionMap().put(DEL_ACTION, deleteAction);
|
||||
|
||||
setFocusable(true);
|
||||
|
||||
@ -92,10 +92,6 @@ public class CircuitComponent extends JComponent {
|
||||
listener = new PartMouseListener();
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
break;
|
||||
case wire:
|
||||
listener = new WireMouseListener();
|
||||
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
||||
break;
|
||||
case select:
|
||||
listener = new SelectMouseListener();
|
||||
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
||||
@ -202,7 +198,7 @@ public class CircuitComponent extends JComponent {
|
||||
setModeAndReset(Mode.part);
|
||||
}
|
||||
|
||||
public enum Mode {part, wire, running, select}
|
||||
public enum Mode {part, running, select}
|
||||
|
||||
private abstract class Mouse extends MouseAdapter implements MouseMotionListener {
|
||||
private Vector pos;
|
||||
@ -225,49 +221,6 @@ public class CircuitComponent extends JComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private class WireMouseListener extends Mouse {
|
||||
|
||||
private Wire wire;
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
if (wire != null) {
|
||||
circuit.add(wire);
|
||||
Vector startPos = raster(getPosVector(e));
|
||||
if (circuit.isPinPos(startPos))
|
||||
wire = null;
|
||||
else
|
||||
wire = new Wire(startPos, startPos);
|
||||
} else {
|
||||
Vector startPos = raster(getPosVector(e));
|
||||
wire = new Wire(startPos, startPos);
|
||||
}
|
||||
repaint();
|
||||
} else {
|
||||
if (wire != null) {
|
||||
wire = null;
|
||||
repaint();
|
||||
} else
|
||||
editAttributes(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
if (wire != null) {
|
||||
wire.setP2(raster(getPosVector(e)));
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTo(Graphic gr) {
|
||||
if (wire != null)
|
||||
wire.drawTo(gr, false);
|
||||
}
|
||||
}
|
||||
|
||||
private class PartMouseListener extends Mouse {
|
||||
|
||||
private VisualElement partToInsert;
|
||||
@ -522,7 +475,7 @@ public class CircuitComponent extends JComponent {
|
||||
private class DelAction extends ToolTipAction {
|
||||
|
||||
DelAction() {
|
||||
super(Lang.get("menu_delete"), iconDelete);
|
||||
super(Lang.get("menu_delete"), ICON_DELETE);
|
||||
setToolTip(Lang.get("menu_delete_tt"));
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,35 @@ public class ElementOrderer<T> extends JDialog {
|
||||
|
||||
}
|
||||
|
||||
private static class ArrayOrderInterface<T> implements OrderInterface<T> {
|
||||
public static class ListOrder<T> implements OrderInterface<T> {
|
||||
private java.util.List<T> list;
|
||||
|
||||
public ListOrder(java.util.List<T> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(int index) {
|
||||
return list.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swap(int i, int j) {
|
||||
T z = list.get(i);
|
||||
list.set(i, list.get(j));
|
||||
list.set(j, z);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ArrayOrder<T> implements OrderInterface<T> {
|
||||
private final T[] data;
|
||||
|
||||
public ArrayOrderInterface(T[] data) {
|
||||
public ArrayOrder(T[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@ -129,6 +154,6 @@ public class ElementOrderer<T> extends JDialog {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ElementOrderer<>(null, "Test", new ArrayOrderInterface<>(new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9})).setVisible(true);
|
||||
new ElementOrderer<>(null, "Test", new ArrayOrder<>(new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9})).setVisible(true);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package de.neemann.digital.gui.components;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
*/
|
||||
public class OrderMerger<O, N> {
|
||||
private final List<O> oldOrdering;
|
||||
|
||||
public OrderMerger(List<O> oldOrdering) {
|
||||
this.oldOrdering = oldOrdering;
|
||||
}
|
||||
|
||||
public <L extends List<N>> void order(L list) {
|
||||
if (oldOrdering == null || oldOrdering.size() == 0)
|
||||
return;
|
||||
|
||||
int n = 0;
|
||||
for (O o : oldOrdering) {
|
||||
int found = -1;
|
||||
for (int i = n; i < list.size(); i++) {
|
||||
if (equals(list.get(i), o)) {
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found >= 0) {
|
||||
N r = list.remove(found);
|
||||
list.add(n, r);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(N a, O b) {
|
||||
return a.equals(b);
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
@ -22,12 +23,19 @@ public class ProbeDialog extends JDialog implements ModelStateObserver {
|
||||
private final ModelEvent.Event type;
|
||||
private final SignalTableModel tableModel;
|
||||
|
||||
public ProbeDialog(Frame owner, Model model, ModelEvent.Event type) {
|
||||
public ProbeDialog(Frame owner, Model model, ModelEvent.Event type, List<String> ordering) {
|
||||
super(owner, Lang.get("win_measures"), false);
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
this.type = type;
|
||||
|
||||
ArrayList<Model.Signal> signals = model.getSignals();
|
||||
ArrayList<Model.Signal> signals = model.getSignalsCopy();
|
||||
new OrderMerger<String, Model.Signal>(ordering) {
|
||||
@Override
|
||||
public boolean equals(Model.Signal a, String b) {
|
||||
return a.getName().equals(b);
|
||||
}
|
||||
}.order(signals);
|
||||
|
||||
tableModel = new SignalTableModel(signals);
|
||||
JTable list = new JTable(tableModel);
|
||||
getContentPane().add(new JScrollPane(list), BorderLayout.CENTER);
|
||||
|
@ -3,6 +3,7 @@ package de.neemann.digital.gui.components.data;
|
||||
import de.neemann.digital.core.Model;
|
||||
import de.neemann.digital.core.ModelEvent;
|
||||
import de.neemann.digital.core.ModelStateObserver;
|
||||
import de.neemann.digital.gui.components.OrderMerger;
|
||||
import de.neemann.digital.lang.Lang;
|
||||
|
||||
import javax.swing.*;
|
||||
@ -10,6 +11,7 @@ import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Dialog which shows the data to plot.
|
||||
@ -27,17 +29,25 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param owner the parent frame
|
||||
* @param model the model used to collect the data
|
||||
* @param type the event type which triggers a new DataSample
|
||||
* @param owner the parent frame
|
||||
* @param model the model used to collect the data
|
||||
* @param type the event type which triggers a new DataSample
|
||||
* @param ordering
|
||||
*/
|
||||
public DataSetDialog(Frame owner, Model model, ModelEvent.Event type) {
|
||||
public DataSetDialog(Frame owner, Model model, ModelEvent.Event type, List<String> ordering) {
|
||||
super(owner, Lang.get("win_measures"), false);
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
setAlwaysOnTop(true);
|
||||
this.type = type;
|
||||
|
||||
signals = model.getSignals();
|
||||
signals = model.getSignalsCopy();
|
||||
new OrderMerger<String, Model.Signal>(ordering) {
|
||||
@Override
|
||||
public boolean equals(Model.Signal a, String b) {
|
||||
return a.getName().equals(b);
|
||||
}
|
||||
}.order(signals);
|
||||
|
||||
dataSet = new DataSet(signals);
|
||||
|
||||
dsc = new DataSetComponent(dataSet);
|
||||
|
@ -1,15 +0,0 @@
|
||||
package de.neemann.digital.gui.components.data;
|
||||
|
||||
import de.neemann.digital.draw.elements.ElementOrder;
|
||||
import de.neemann.digital.draw.elements.VisualElement;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
*/
|
||||
public class MeasurementFilter implements ElementOrder.ElementMatcher {
|
||||
@Override
|
||||
public boolean matches(VisualElement element) {
|
||||
String name = element.getElementName();
|
||||
return name.equals("In") || name.equals("Out") || name.equals("LED") || name.equals("Clock") || name.equals("Probe");
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package de.neemann.digital.gui.components;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
*/
|
||||
public class OrderMergerTest extends TestCase {
|
||||
public void testOrder() throws Exception {
|
||||
ArrayList<String> oldList = new ArrayList<>();
|
||||
oldList.add("b");
|
||||
oldList.add("d");
|
||||
|
||||
ArrayList<String> newList = new ArrayList<>();
|
||||
newList.add("a");
|
||||
newList.add("b");
|
||||
newList.add("c");
|
||||
newList.add("d");
|
||||
|
||||
new OrderMerger<String, String>(oldList).order(newList);
|
||||
|
||||
assertEquals(4, newList.size());
|
||||
assertEquals("b", newList.get(0));
|
||||
assertEquals("d", newList.get(1));
|
||||
assertEquals("a", newList.get(2));
|
||||
assertEquals("c", newList.get(3));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user