Fixed traffic light examples

This commit is contained in:
hneemann 2016-03-26 10:10:03 +01:00
parent 4acf9aeced
commit 2ef58e8b9d
8 changed files with 91 additions and 226 deletions

View File

@ -5,10 +5,7 @@
<elementName>JK_FF</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Z_0</string>
</entry>
</elementAttributes>
@ -19,7 +16,7 @@
<elementName>JK_FF</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement/elementAttributes/entry/key"/>
<string>Label</string>
<string>Z_1</string>
</entry>
</elementAttributes>
@ -42,10 +39,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Rot</string>
</entry>
</elementAttributes>
@ -56,15 +50,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Color</name>
<def class="awt-color">
<red>255</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</def>
</key>
<string>Color</string>
<awt-color>
<red>255</red>
<green>255</green>
@ -73,10 +59,7 @@
</awt-color>
</entry>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Gelb</string>
</entry>
</elementAttributes>
@ -87,7 +70,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[6]/elementAttributes/entry/key"/>
<string>Color</string>
<awt-color>
<red>0</red>
<green>255</green>
@ -96,7 +79,7 @@
</awt-color>
</entry>
<entry>
<key reference="../../../../visualElement[6]/elementAttributes/entry[2]/key"/>
<string>Label</string>
<string>Grün</string>
</entry>
</elementAttributes>
@ -107,10 +90,7 @@
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Clock</string>
</entry>
</elementAttributes>

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<visualElements>
<visualElement>
@ -16,10 +17,7 @@
<elementName>And</elementName>
<elementAttributes>
<entry>
<key>
<name>Inputs</name>
<def class="int">2</def>
</key>
<string>Inputs</string>
<int>3</int>
</entry>
</elementAttributes>
@ -36,10 +34,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Rot</string>
</entry>
</elementAttributes>
@ -50,15 +45,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Color</name>
<def class="awt-color">
<red>255</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</def>
</key>
<string>Color</string>
<awt-color>
<red>255</red>
<green>255</green>
@ -67,10 +54,7 @@
</awt-color>
</entry>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Gelb</string>
</entry>
</elementAttributes>
@ -81,16 +65,16 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[6]/elementAttributes/entry/key"/>
<string>Color</string>
<awt-color>
<red>0</red>
<red>51</red>
<green>255</green>
<blue>0</blue>
<alpha>255</alpha>
</awt-color>
</entry>
<entry>
<key reference="../../../../visualElement[6]/elementAttributes/entry[2]/key"/>
<string>Label</string>
<string>Grün</string>
</entry>
</elementAttributes>
@ -101,10 +85,7 @@
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Clock</string>
</entry>
</elementAttributes>
@ -115,10 +96,7 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Feuer</string>
</entry>
</elementAttributes>

View File

@ -29,10 +29,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Rot</string>
</entry>
</elementAttributes>
@ -43,15 +40,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Color</name>
<def class="awt-color">
<red>255</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</def>
</key>
<string>Color</string>
<awt-color>
<red>255</red>
<green>255</green>
@ -60,10 +49,7 @@
</awt-color>
</entry>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Gelb</string>
</entry>
</elementAttributes>
@ -74,16 +60,16 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[6]/elementAttributes/entry/key"/>
<string>Color</string>
<awt-color>
<red>0</red>
<red>51</red>
<green>255</green>
<blue>0</blue>
<alpha>255</alpha>
</awt-color>
</entry>
<entry>
<key reference="../../../../visualElement[6]/elementAttributes/entry[2]/key"/>
<string>Label</string>
<string>Grün</string>
</entry>
</elementAttributes>
@ -94,10 +80,7 @@
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Clock</string>
</entry>
</elementAttributes>
@ -120,10 +103,7 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Feuer</string>
</entry>
</elementAttributes>
@ -241,4 +221,4 @@
<p2 x="140" y="180"/>
</wire>
</wires>
</circuit>
</circuit>

View File

@ -17,10 +17,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Rot</string>
</entry>
</elementAttributes>
@ -31,27 +28,16 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Color</name>
<def class="awt-color">
<red>255</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</def>
</key>
<string>Color</string>
<awt-color>
<red>255</red>
<green>255</green>
<blue>0</blue>
<blue>51</blue>
<alpha>255</alpha>
</awt-color>
</entry>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Gelb</string>
</entry>
</elementAttributes>
@ -62,7 +48,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry/key"/>
<string>Color</string>
<awt-color>
<red>0</red>
<green>255</green>
@ -71,7 +57,7 @@
</awt-color>
</entry>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry[2]/key"/>
<string>Label</string>
<string>Grün</string>
</entry>
</elementAttributes>
@ -82,10 +68,7 @@
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Clock</string>
</entry>
</elementAttributes>
@ -108,10 +91,7 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Feuer</string>
</entry>
</elementAttributes>
@ -119,13 +99,13 @@
<rotate>0</rotate>
</visualElement>
<visualElement>
<elementName>JK-Trigger.dig</elementName>
<elementName>MS-JK.dig</elementName>
<elementAttributes/>
<pos x="240" y="140"/>
<rotate>0</rotate>
</visualElement>
<visualElement>
<elementName>JK-Trigger.dig</elementName>
<elementName>MS-JK.dig</elementName>
<elementAttributes/>
<pos x="240" y="190"/>
<rotate>0</rotate>

View File

@ -17,10 +17,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Rot</string>
</entry>
</elementAttributes>
@ -31,27 +28,16 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key>
<name>Color</name>
<def class="awt-color">
<red>255</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</def>
</key>
<string>Color</string>
<awt-color>
<red>255</red>
<green>255</green>
<blue>0</blue>
<blue>51</blue>
<alpha>255</alpha>
</awt-color>
</entry>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Gelb</string>
</entry>
</elementAttributes>
@ -62,7 +48,7 @@
<elementName>LED</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry/key"/>
<string>Color</string>
<awt-color>
<red>0</red>
<green>255</green>
@ -71,7 +57,7 @@
</awt-color>
</entry>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry[2]/key"/>
<string>Label</string>
<string>Grün</string>
</entry>
</elementAttributes>
@ -82,14 +68,11 @@
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Clock</string>
</entry>
</elementAttributes>
<pos x="200" y="140"/>
<pos x="200" y="150"/>
<rotate>0</rotate>
</visualElement>
<visualElement>
@ -108,10 +91,7 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Feuer</string>
</entry>
</elementAttributes>
@ -119,31 +99,27 @@
<rotate>0</rotate>
</visualElement>
<visualElement>
<elementName>MS-JK.dig</elementName>
<elementName>T-JK.dig</elementName>
<elementAttributes/>
<pos x="240" y="130"/>
<pos x="240" y="140"/>
<rotate>0</rotate>
</visualElement>
<visualElement>
<elementName>MS-JK.dig</elementName>
<elementName>T-JK.dig</elementName>
<elementAttributes/>
<pos x="240" y="190"/>
<rotate>0</rotate>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="230" y="160"/>
<p2 x="240" y="160"/>
</wire>
<wire>
<p1 x="210" y="210"/>
<p2 x="240" y="210"/>
</wire>
<wire>
<p1 x="230" y="130"/>
<p2 x="240" y="130"/>
</wire>
<wire>
<p1 x="270" y="130"/>
<p2 x="290" y="130"/>
</wire>
<wire>
<p1 x="200" y="180"/>
<p2 x="290" y="180"/>
@ -157,13 +133,17 @@
<p2 x="300" y="180"/>
</wire>
<wire>
<p1 x="230" y="150"/>
<p2 x="240" y="150"/>
<p1 x="200" y="150"/>
<p2 x="220" y="150"/>
</wire>
<wire>
<p1 x="300" y="150"/>
<p1 x="270" y="150"/>
<p2 x="350" y="150"/>
</wire>
<wire>
<p1 x="220" y="150"/>
<p2 x="240" y="150"/>
</wire>
<wire>
<p1 x="270" y="200"/>
<p2 x="300" y="200"/>
@ -193,16 +173,12 @@
<p2 x="350" y="170"/>
</wire>
<wire>
<p1 x="200" y="140"/>
<p2 x="220" y="140"/>
<p1 x="230" y="140"/>
<p2 x="240" y="140"/>
</wire>
<wire>
<p1 x="270" y="140"/>
<p2 x="300" y="140"/>
</wire>
<wire>
<p1 x="220" y="140"/>
<p2 x="240" y="140"/>
<p2 x="290" y="140"/>
</wire>
<wire>
<p1 x="270" y="190"/>
@ -217,19 +193,15 @@
<p2 x="240" y="190"/>
</wire>
<wire>
<p1 x="300" y="140"/>
<p2 x="300" y="150"/>
</wire>
<wire>
<p1 x="290" y="130"/>
<p1 x="290" y="140"/>
<p2 x="290" y="180"/>
</wire>
<wire>
<p1 x="230" y="130"/>
<p2 x="230" y="150"/>
<p1 x="230" y="140"/>
<p2 x="230" y="160"/>
</wire>
<wire>
<p1 x="230" y="150"/>
<p1 x="230" y="160"/>
<p2 x="230" y="170"/>
</wire>
<wire>
@ -241,7 +213,7 @@
<p2 x="200" y="180"/>
</wire>
<wire>
<p1 x="220" y="140"/>
<p1 x="220" y="150"/>
<p2 x="220" y="200"/>
</wire>
<wire>

View File

@ -5,10 +5,7 @@
<elementName>And</elementName>
<elementAttributes>
<entry>
<key>
<name>Inputs</name>
<def class="int">2</def>
</key>
<string>Inputs</string>
<int>3</int>
</entry>
</elementAttributes>
@ -19,7 +16,7 @@
<elementName>And</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement/elementAttributes/entry/key"/>
<string>Inputs</string>
<int>3</int>
</entry>
</elementAttributes>
@ -36,17 +33,11 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>J</string>
</entry>
<entry>
<key>
<name>Default</name>
<def class="int">0</def>
</key>
<string>Default</string>
<int>1</int>
</entry>
</elementAttributes>
@ -57,7 +48,7 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry/key"/>
<string>Label</string>
<string>C</string>
</entry>
</elementAttributes>
@ -104,7 +95,7 @@
<elementName>Out</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry/key"/>
<string>Label</string>
<string>Q</string>
</entry>
</elementAttributes>
@ -115,7 +106,7 @@
<elementName>Out</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[4]/elementAttributes/entry/key"/>
<string>Label</string>
<string>~Q</string>
</entry>
</elementAttributes>
@ -126,12 +117,13 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>K</string>
</entry>
<entry>
<string>Default</string>
<int>1</int>
</entry>
</elementAttributes>
<pos x="50" y="130"/>
<rotate>0</rotate>

View File

@ -17,10 +17,7 @@
<elementName>And</elementName>
<elementAttributes>
<entry>
<key>
<name>Inputs</name>
<def class="int">2</def>
</key>
<string>Inputs</string>
<int>3</int>
</entry>
</elementAttributes>
@ -31,7 +28,7 @@
<elementName>And</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[3]/elementAttributes/entry/key"/>
<string>Inputs</string>
<int>3</int>
</entry>
</elementAttributes>
@ -54,17 +51,11 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>J</string>
</entry>
<entry>
<key>
<name>Default</name>
<def class="int">0</def>
</key>
<string>Default</string>
<int>1</int>
</entry>
</elementAttributes>
@ -75,7 +66,7 @@
<elementName>Out</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[7]/elementAttributes/entry/key"/>
<string>Label</string>
<string>Q</string>
</entry>
</elementAttributes>
@ -86,7 +77,7 @@
<elementName>Out</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[7]/elementAttributes/entry/key"/>
<string>Label</string>
<string>~Q</string>
</entry>
</elementAttributes>
@ -103,10 +94,7 @@
<elementName>Probe</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>Dif</string>
</entry>
</elementAttributes>
@ -117,10 +105,7 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key>
<name>Label</name>
<def class="string"></def>
</key>
<string>Label</string>
<string>C</string>
</entry>
</elementAttributes>
@ -131,14 +116,11 @@
<elementName>In</elementName>
<elementAttributes>
<entry>
<key reference="../../../../visualElement[12]/elementAttributes/entry/key"/>
<string>Label</string>
<string>K</string>
</entry>
<entry>
<key>
<name>Default</name>
<def class="int">0</def>
</key>
<string>Default</string>
<int>1</int>
</entry>
</elementAttributes>

View File

@ -31,6 +31,7 @@ public class ClockShape implements Shape {
@Override
public Interactor applyStateMonitor(IOState ioState, Observer guiObserver) {
ioState.getOutput(0).addObserver(guiObserver); // necessary to replot wires also if component itself does not depend on state
return new Interactor() {
@Override
public void clicked(CircuitComponent cc, Point pos, IOState ioState) {