mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 17:34:43 -04:00
added possibility to create circuits with gates with only two inputs
This commit is contained in:
parent
82a7d20143
commit
4e4ec3e70e
@ -62,7 +62,7 @@
|
|||||||
<int>0</int>
|
<int>0</int>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="460" y="240"/>
|
<pos x="460" y="280"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -73,7 +73,7 @@
|
|||||||
<int>0</int>
|
<int>0</int>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="460" y="260"/>
|
<pos x="460" y="300"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<int>0</int>
|
<int>0</int>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="460" y="380"/>
|
<pos x="460" y="420"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -95,7 +95,7 @@
|
|||||||
<int>0</int>
|
<int>0</int>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="460" y="400"/>
|
<pos x="460" y="440"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -106,7 +106,7 @@
|
|||||||
<string>A_0</string>
|
<string>A_0</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="540"/>
|
<pos x="100" y="540"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -117,7 +117,7 @@
|
|||||||
<string>A_1</string>
|
<string>A_1</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="580"/>
|
<pos x="100" y="580"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -128,7 +128,7 @@
|
|||||||
<string>A_2</string>
|
<string>A_2</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="620"/>
|
<pos x="100" y="620"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<string>A_3</string>
|
<string>A_3</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="660"/>
|
<pos x="100" y="660"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -150,7 +150,7 @@
|
|||||||
<string>B_0</string>
|
<string>B_0</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="700"/>
|
<pos x="100" y="700"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -161,7 +161,7 @@
|
|||||||
<string>B_1</string>
|
<string>B_1</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="740"/>
|
<pos x="100" y="740"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -172,7 +172,7 @@
|
|||||||
<string>B_2</string>
|
<string>B_2</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="780"/>
|
<pos x="100" y="780"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -183,7 +183,7 @@
|
|||||||
<string>B_3</string>
|
<string>B_3</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="820"/>
|
<pos x="100" y="820"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -222,7 +222,7 @@
|
|||||||
<string>A_4</string>
|
<string>A_4</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="200"/>
|
<pos x="100" y="200"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -233,7 +233,7 @@
|
|||||||
<string>A_5</string>
|
<string>A_5</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="240"/>
|
<pos x="100" y="240"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -244,7 +244,7 @@
|
|||||||
<string>A_6</string>
|
<string>A_6</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="280"/>
|
<pos x="100" y="280"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -255,7 +255,7 @@
|
|||||||
<string>A_7</string>
|
<string>A_7</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="320"/>
|
<pos x="100" y="320"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -266,7 +266,7 @@
|
|||||||
<string>B_4</string>
|
<string>B_4</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="360"/>
|
<pos x="100" y="360"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -277,7 +277,7 @@
|
|||||||
<string>B_5</string>
|
<string>B_5</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="400"/>
|
<pos x="100" y="400"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -288,7 +288,7 @@
|
|||||||
<string>B_6</string>
|
<string>B_6</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="440"/>
|
<pos x="100" y="440"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -299,7 +299,7 @@
|
|||||||
<string>B_7</string>
|
<string>B_7</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="480"/>
|
<pos x="100" y="480"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -338,7 +338,7 @@
|
|||||||
<string>A_8</string>
|
<string>A_8</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="-140"/>
|
<pos x="100" y="-140"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -349,7 +349,7 @@
|
|||||||
<string>A_9</string>
|
<string>A_9</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="-100"/>
|
<pos x="100" y="-100"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -360,7 +360,7 @@
|
|||||||
<string>A_10</string>
|
<string>A_10</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="-60"/>
|
<pos x="100" y="-60"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -371,7 +371,7 @@
|
|||||||
<string>A_11</string>
|
<string>A_11</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="-20"/>
|
<pos x="100" y="-20"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -382,7 +382,7 @@
|
|||||||
<string>B_8</string>
|
<string>B_8</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="20"/>
|
<pos x="100" y="20"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -393,7 +393,7 @@
|
|||||||
<string>B_9</string>
|
<string>B_9</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="60"/>
|
<pos x="100" y="60"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -404,7 +404,7 @@
|
|||||||
<string>B_10</string>
|
<string>B_10</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="100"/>
|
<pos x="100" y="100"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -415,7 +415,7 @@
|
|||||||
<string>B_11</string>
|
<string>B_11</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="80" y="140"/>
|
<pos x="100" y="140"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -426,7 +426,7 @@
|
|||||||
<string>P=Q</string>
|
<string>P=Q</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="660" y="260"/>
|
<pos x="620" y="260"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -437,7 +437,7 @@
|
|||||||
<string>P<Q</string>
|
<string>P<Q</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="660" y="220"/>
|
<pos x="620" y="220"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
<visualElement>
|
<visualElement>
|
||||||
@ -448,7 +448,7 @@
|
|||||||
<string>P>Q</string>
|
<string>P>Q</string>
|
||||||
</entry>
|
</entry>
|
||||||
</elementAttributes>
|
</elementAttributes>
|
||||||
<pos x="660" y="300"/>
|
<pos x="620" y="300"/>
|
||||||
<rotate>0</rotate>
|
<rotate>0</rotate>
|
||||||
</visualElement>
|
</visualElement>
|
||||||
</visualElements>
|
</visualElements>
|
||||||
@ -467,110 +467,34 @@
|
|||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="320" y="-100"/>
|
<p1 x="320" y="-100"/>
|
||||||
<p2 x="420" y="440"/>
|
<p2 x="440" y="400"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="300" y="-60"/>
|
<p1 x="300" y="-60"/>
|
||||||
<p2 x="440" y="300"/>
|
<p2 x="440" y="260"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="300" y="240"/>
|
<p1 x="300" y="240"/>
|
||||||
<p2 x="440" y="420"/>
|
<p2 x="460" y="380"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="100" y="540"/>
|
<p1 x="300" y="280"/>
|
||||||
<p2 x="140" y="580"/>
|
<p2 x="460" y="240"/>
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="580"/>
|
|
||||||
<p2 x="140" y="600"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="700"/>
|
|
||||||
<p2 x="140" y="720"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="820"/>
|
|
||||||
<p2 x="140" y="780"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="660"/>
|
|
||||||
<p2 x="140" y="640"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="200"/>
|
|
||||||
<p2 x="140" y="240"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="240"/>
|
|
||||||
<p2 x="140" y="260"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="360"/>
|
|
||||||
<p2 x="140" y="380"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="480"/>
|
|
||||||
<p2 x="140" y="440"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="320"/>
|
|
||||||
<p2 x="140" y="300"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="-140"/>
|
|
||||||
<p2 x="140" y="-100"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="-100"/>
|
|
||||||
<p2 x="140" y="-80"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="20"/>
|
|
||||||
<p2 x="140" y="40"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="140"/>
|
|
||||||
<p2 x="140" y="100"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="-20"/>
|
|
||||||
<p2 x="140" y="-40"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="640" y="220"/>
|
|
||||||
<p2 x="600" y="240"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="600" y="280"/>
|
|
||||||
<p2 x="640" y="300"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="140" y="80"/>
|
|
||||||
<p2 x="100" y="100"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="140" y="420"/>
|
|
||||||
<p2 x="100" y="440"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="100" y="780"/>
|
|
||||||
<p2 x="140" y="760"/>
|
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="360" y="320"/>
|
<p1 x="360" y="320"/>
|
||||||
<p2 x="480" y="320"/>
|
<p2 x="480" y="320"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="320"/>
|
<p1 x="100" y="320"/>
|
||||||
<p2 x="100" y="320"/>
|
<p2 x="120" y="320"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="160" y="320"/>
|
<p1 x="160" y="320"/>
|
||||||
<p2 x="180" y="320"/>
|
<p2 x="180" y="320"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="640"/>
|
<p1 x="120" y="640"/>
|
||||||
<p2 x="180" y="640"/>
|
<p2 x="180" y="640"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
@ -578,20 +502,20 @@
|
|||||||
<p2 x="180" y="0"/>
|
<p2 x="180" y="0"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="460" y="260"/>
|
<p1 x="120" y="260"/>
|
||||||
<p2 x="480" y="260"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="140" y="260"/>
|
|
||||||
<p2 x="180" y="260"/>
|
<p2 x="180" y="260"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="580" y="260"/>
|
<p1 x="580" y="260"/>
|
||||||
<p2 x="660" y="260"/>
|
<p2 x="620" y="260"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="580"/>
|
<p1 x="440" y="260"/>
|
||||||
<p2 x="100" y="580"/>
|
<p2 x="480" y="260"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="580"/>
|
||||||
|
<p2 x="120" y="580"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="280" y="580"/>
|
<p1 x="280" y="580"/>
|
||||||
@ -602,56 +526,56 @@
|
|||||||
<p2 x="180" y="580"/>
|
<p2 x="180" y="580"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="200"/>
|
<p1 x="100" y="200"/>
|
||||||
<p2 x="100" y="200"/>
|
<p2 x="140" y="200"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="-140"/>
|
<p1 x="100" y="-140"/>
|
||||||
<p2 x="100" y="-140"/>
|
<p2 x="140" y="-140"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="780"/>
|
<p1 x="100" y="780"/>
|
||||||
<p2 x="100" y="780"/>
|
<p2 x="120" y="780"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="780"/>
|
<p1 x="140" y="780"/>
|
||||||
<p2 x="180" y="780"/>
|
<p2 x="180" y="780"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="140"/>
|
<p1 x="100" y="140"/>
|
||||||
<p2 x="100" y="140"/>
|
<p2 x="140" y="140"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="-80"/>
|
<p1 x="120" y="-80"/>
|
||||||
<p2 x="180" y="-80"/>
|
<p2 x="180" y="-80"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="460" y="400"/>
|
<p1 x="100" y="400"/>
|
||||||
<p2 x="480" y="400"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="80" y="400"/>
|
|
||||||
<p2 x="180" y="400"/>
|
<p2 x="180" y="400"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="720"/>
|
<p1 x="440" y="400"/>
|
||||||
|
<p2 x="480" y="400"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="720"/>
|
||||||
<p2 x="180" y="720"/>
|
<p2 x="180" y="720"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="80"/>
|
<p1 x="120" y="80"/>
|
||||||
<p2 x="180" y="80"/>
|
<p2 x="180" y="80"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="-20"/>
|
<p1 x="100" y="-20"/>
|
||||||
<p2 x="100" y="-20"/>
|
<p2 x="120" y="-20"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="160" y="-20"/>
|
<p1 x="160" y="-20"/>
|
||||||
<p2 x="180" y="-20"/>
|
<p2 x="180" y="-20"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="660"/>
|
<p1 x="100" y="660"/>
|
||||||
<p2 x="100" y="660"/>
|
<p2 x="120" y="660"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="160" y="660"/>
|
<p1 x="160" y="660"/>
|
||||||
@ -666,27 +590,23 @@
|
|||||||
<p2 x="180" y="340"/>
|
<p2 x="180" y="340"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="20"/>
|
<p1 x="100" y="20"/>
|
||||||
<p2 x="100" y="20"/>
|
<p2 x="120" y="20"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="160" y="20"/>
|
<p1 x="160" y="20"/>
|
||||||
<p2 x="180" y="20"/>
|
<p2 x="180" y="20"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
|
||||||
<p1 x="280" y="600"/>
|
|
||||||
<p2 x="320" y="600"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="140" y="600"/>
|
|
||||||
<p2 x="180" y="600"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="280" y="280"/>
|
<p1 x="280" y="280"/>
|
||||||
|
<p2 x="300" y="280"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="460" y="280"/>
|
||||||
<p2 x="480" y="280"/>
|
<p2 x="480" y="280"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="280"/>
|
<p1 x="100" y="280"/>
|
||||||
<p2 x="180" y="280"/>
|
<p2 x="180" y="280"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
@ -694,51 +614,59 @@
|
|||||||
<p2 x="600" y="280"/>
|
<p2 x="600" y="280"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="540"/>
|
<p1 x="280" y="600"/>
|
||||||
<p2 x="100" y="540"/>
|
<p2 x="320" y="600"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="640" y="220"/>
|
<p1 x="120" y="600"/>
|
||||||
<p2 x="660" y="220"/>
|
<p2 x="180" y="600"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="480"/>
|
<p1 x="100" y="540"/>
|
||||||
<p2 x="100" y="480"/>
|
<p2 x="140" y="540"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="600" y="220"/>
|
||||||
|
<p2 x="620" y="220"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="480"/>
|
||||||
|
<p2 x="140" y="480"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="280" y="-100"/>
|
<p1 x="280" y="-100"/>
|
||||||
<p2 x="320" y="-100"/>
|
<p2 x="320" y="-100"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="-100"/>
|
<p1 x="100" y="-100"/>
|
||||||
<p2 x="100" y="-100"/>
|
<p2 x="120" y="-100"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="-100"/>
|
<p1 x="140" y="-100"/>
|
||||||
<p2 x="180" y="-100"/>
|
<p2 x="180" y="-100"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="740"/>
|
<p1 x="460" y="420"/>
|
||||||
<p2 x="180" y="740"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="440" y="420"/>
|
|
||||||
<p2 x="480" y="420"/>
|
<p2 x="480" y="420"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="420"/>
|
<p1 x="120" y="420"/>
|
||||||
<p2 x="180" y="420"/>
|
<p2 x="180" y="420"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="100"/>
|
<p1 x="100" y="740"/>
|
||||||
<p2 x="100" y="100"/>
|
<p2 x="180" y="740"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="100"/>
|
||||||
|
<p2 x="120" y="100"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="100"/>
|
<p1 x="140" y="100"/>
|
||||||
<p2 x="180" y="100"/>
|
<p2 x="180" y="100"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="-40"/>
|
<p1 x="120" y="-40"/>
|
||||||
<p2 x="180" y="-40"/>
|
<p2 x="180" y="-40"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
@ -750,48 +678,44 @@
|
|||||||
<p2 x="480" y="360"/>
|
<p2 x="480" y="360"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="360"/>
|
<p1 x="100" y="360"/>
|
||||||
<p2 x="100" y="360"/>
|
<p2 x="120" y="360"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="160" y="360"/>
|
<p1 x="160" y="360"/>
|
||||||
<p2 x="180" y="360"/>
|
<p2 x="180" y="360"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="40"/>
|
<p1 x="120" y="40"/>
|
||||||
<p2 x="180" y="40"/>
|
<p2 x="180" y="40"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="620"/>
|
<p1 x="460" y="300"/>
|
||||||
|
<p2 x="480" y="300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="300"/>
|
||||||
|
<p2 x="180" y="300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="600" y="300"/>
|
||||||
|
<p2 x="620" y="300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="620"/>
|
||||||
<p2 x="180" y="620"/>
|
<p2 x="180" y="620"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="280" y="620"/>
|
<p1 x="280" y="620"/>
|
||||||
<p2 x="340" y="620"/>
|
<p2 x="340" y="620"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
|
||||||
<p1 x="440" y="300"/>
|
|
||||||
<p2 x="480" y="300"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="140" y="300"/>
|
|
||||||
<p2 x="180" y="300"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="640" y="300"/>
|
|
||||||
<p2 x="660" y="300"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="280" y="240"/>
|
<p1 x="280" y="240"/>
|
||||||
<p2 x="300" y="240"/>
|
<p2 x="300" y="240"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="460" y="240"/>
|
<p1 x="100" y="240"/>
|
||||||
<p2 x="480" y="240"/>
|
<p2 x="120" y="240"/>
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="80" y="240"/>
|
|
||||||
<p2 x="100" y="240"/>
|
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="240"/>
|
<p1 x="140" y="240"/>
|
||||||
@ -802,52 +726,136 @@
|
|||||||
<p2 x="600" y="240"/>
|
<p2 x="600" y="240"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="820"/>
|
<p1 x="460" y="240"/>
|
||||||
<p2 x="100" y="820"/>
|
<p2 x="480" y="240"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="760"/>
|
<p1 x="100" y="820"/>
|
||||||
<p2 x="180" y="760"/>
|
<p2 x="140" y="820"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="440"/>
|
<p1 x="460" y="440"/>
|
||||||
<p2 x="100" y="440"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="420" y="440"/>
|
|
||||||
<p2 x="480" y="440"/>
|
<p2 x="480" y="440"/>
|
||||||
</wire>
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="440"/>
|
||||||
|
<p2 x="120" y="440"/>
|
||||||
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="440"/>
|
<p1 x="140" y="440"/>
|
||||||
<p2 x="180" y="440"/>
|
<p2 x="180" y="440"/>
|
||||||
</wire>
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="760"/>
|
||||||
|
<p2 x="180" y="760"/>
|
||||||
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="280" y="-60"/>
|
<p1 x="280" y="-60"/>
|
||||||
<p2 x="300" y="-60"/>
|
<p2 x="300" y="-60"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="80" y="-60"/>
|
<p1 x="100" y="-60"/>
|
||||||
<p2 x="180" y="-60"/>
|
<p2 x="180" y="-60"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
|
||||||
<p1 x="80" y="60"/>
|
|
||||||
<p2 x="180" y="60"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="80" y="700"/>
|
|
||||||
<p2 x="100" y="700"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
|
||||||
<p1 x="160" y="700"/>
|
|
||||||
<p2 x="180" y="700"/>
|
|
||||||
</wire>
|
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="460" y="380"/>
|
<p1 x="460" y="380"/>
|
||||||
<p2 x="480" y="380"/>
|
<p2 x="480" y="380"/>
|
||||||
</wire>
|
</wire>
|
||||||
<wire>
|
<wire>
|
||||||
<p1 x="140" y="380"/>
|
<p1 x="120" y="380"/>
|
||||||
<p2 x="180" y="380"/>
|
<p2 x="180" y="380"/>
|
||||||
</wire>
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="60"/>
|
||||||
|
<p2 x="180" y="60"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="100" y="700"/>
|
||||||
|
<p2 x="120" y="700"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="160" y="700"/>
|
||||||
|
<p2 x="180" y="700"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="80"/>
|
||||||
|
<p2 x="120" y="100"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="20"/>
|
||||||
|
<p2 x="120" y="40"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="-40"/>
|
||||||
|
<p2 x="120" y="-20"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="-100"/>
|
||||||
|
<p2 x="120" y="-80"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="420"/>
|
||||||
|
<p2 x="120" y="440"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="360"/>
|
||||||
|
<p2 x="120" y="380"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="300"/>
|
||||||
|
<p2 x="120" y="320"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="240"/>
|
||||||
|
<p2 x="120" y="260"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="760"/>
|
||||||
|
<p2 x="120" y="780"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="700"/>
|
||||||
|
<p2 x="120" y="720"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="640"/>
|
||||||
|
<p2 x="120" y="660"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="120" y="580"/>
|
||||||
|
<p2 x="120" y="600"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="600" y="280"/>
|
||||||
|
<p2 x="600" y="300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="600" y="220"/>
|
||||||
|
<p2 x="600" y="240"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="100"/>
|
||||||
|
<p2 x="140" y="140"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="-140"/>
|
||||||
|
<p2 x="140" y="-100"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="440"/>
|
||||||
|
<p2 x="140" y="480"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="200"/>
|
||||||
|
<p2 x="140" y="240"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="780"/>
|
||||||
|
<p2 x="140" y="820"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="140" y="540"/>
|
||||||
|
<p2 x="140" y="580"/>
|
||||||
|
</wire>
|
||||||
</wires>
|
</wires>
|
||||||
</circuit>
|
</circuit>
|
@ -8,6 +8,7 @@ import de.neemann.digital.analyse.expression.modify.ExpressionModifier;
|
|||||||
public final class Not implements Expression {
|
public final class Not implements Expression {
|
||||||
|
|
||||||
private Expression expression;
|
private Expression expression;
|
||||||
|
private boolean protect = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a not expression.
|
* Creates a not expression.
|
||||||
@ -22,7 +23,7 @@ public final class Not implements Expression {
|
|||||||
if (a == Constant.ZERO)
|
if (a == Constant.ZERO)
|
||||||
return Constant.ONE;
|
return Constant.ONE;
|
||||||
|
|
||||||
if (a instanceof Not) {
|
if (a instanceof Not && !((Not) a).protect) {
|
||||||
return ((Not) a).expression;
|
return ((Not) a).expression;
|
||||||
} else
|
} else
|
||||||
return new Not(a);
|
return new Not(a);
|
||||||
@ -32,12 +33,22 @@ public final class Not implements Expression {
|
|||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
* In most cases it's better to use {@link Not#not(Expression)}.
|
* In most cases it's better to use {@link Not#not(Expression)}.
|
||||||
*
|
*
|
||||||
* @param expression
|
* @param expression the expression to invert
|
||||||
*/
|
*/
|
||||||
public Not(Expression expression) {
|
public Not(Expression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protects this not against simplification
|
||||||
|
*
|
||||||
|
* @return this for call chaning
|
||||||
|
*/
|
||||||
|
public Not protect() {
|
||||||
|
protect = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean calculate(Context context) throws ExpressionException {
|
public boolean calculate(Context context) throws ExpressionException {
|
||||||
return !expression.calculate(context);
|
return !expression.calculate(context);
|
||||||
|
@ -26,7 +26,7 @@ public abstract class Operation implements Expression {
|
|||||||
* @return the created expression
|
* @return the created expression
|
||||||
*/
|
*/
|
||||||
public static Expression or(Iterable<Expression> exp) {
|
public static Expression or(Iterable<Expression> exp) {
|
||||||
return simplify(new Or(exp));
|
return simplify(new Or(exp, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,7 +36,17 @@ public abstract class Operation implements Expression {
|
|||||||
* @return the created expression
|
* @return the created expression
|
||||||
*/
|
*/
|
||||||
public static Expression or(Expression... exp) {
|
public static Expression or(Expression... exp) {
|
||||||
return simplify(new Or(Arrays.asList(exp)));
|
return simplify(new Or(Arrays.asList(exp), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new OR expression
|
||||||
|
*
|
||||||
|
* @param exp the expressions to OR
|
||||||
|
* @return the created expression
|
||||||
|
*/
|
||||||
|
public static Expression orNoMerge(Expression... exp) {
|
||||||
|
return simplify(new Or(Arrays.asList(exp), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,7 +56,7 @@ public abstract class Operation implements Expression {
|
|||||||
* @return the created expression
|
* @return the created expression
|
||||||
*/
|
*/
|
||||||
public static Expression and(Iterable<Expression> exp) {
|
public static Expression and(Iterable<Expression> exp) {
|
||||||
return simplify(new And(exp));
|
return simplify(new And(exp, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +66,17 @@ public abstract class Operation implements Expression {
|
|||||||
* @return the created expression
|
* @return the created expression
|
||||||
*/
|
*/
|
||||||
public static Expression and(Expression... exp) {
|
public static Expression and(Expression... exp) {
|
||||||
return simplify(new And(Arrays.asList(exp)));
|
return simplify(new And(Arrays.asList(exp), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new AND expression
|
||||||
|
*
|
||||||
|
* @param exp the expressions to AND
|
||||||
|
* @return the created expression
|
||||||
|
*/
|
||||||
|
public static Expression andNoMerge(Expression... exp) {
|
||||||
|
return simplify(new And(Arrays.asList(exp), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Expression simplify(Operation operation) {
|
private static Expression simplify(Operation operation) {
|
||||||
@ -72,11 +92,14 @@ public abstract class Operation implements Expression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Operation(Iterable<Expression> exp) {
|
private Operation(Iterable<Expression> exp, boolean merge) {
|
||||||
expr = new ArrayList<>();
|
expr = new ArrayList<>();
|
||||||
for (Expression e : exp)
|
for (Expression e : exp)
|
||||||
if (e != null)
|
if (e != null)
|
||||||
|
if (merge)
|
||||||
merge(e);
|
merge(e);
|
||||||
|
else
|
||||||
|
expr.add(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void merge(Expression e) {
|
private void merge(Expression e) {
|
||||||
@ -143,8 +166,8 @@ public abstract class Operation implements Expression {
|
|||||||
*/
|
*/
|
||||||
public static final class And extends Operation {
|
public static final class And extends Operation {
|
||||||
|
|
||||||
private And(Iterable<Expression> exp) {
|
private And(Iterable<Expression> exp, boolean merge) {
|
||||||
super(exp);
|
super(exp, merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,8 +186,8 @@ public abstract class Operation implements Expression {
|
|||||||
*/
|
*/
|
||||||
public static final class Or extends Operation {
|
public static final class Or extends Operation {
|
||||||
|
|
||||||
private Or(Iterable<Expression> exp) {
|
private Or(Iterable<Expression> exp, boolean merge) {
|
||||||
super(exp);
|
super(exp, merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,6 +25,19 @@ public interface ExpressionModifier {
|
|||||||
return modifier.modify(expression);
|
return modifier.modify(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the given expression with the given modifiers
|
||||||
|
*
|
||||||
|
* @param expression the expression to modify
|
||||||
|
* @param modifiers the modifiers to use
|
||||||
|
* @return the modified expression
|
||||||
|
*/
|
||||||
|
static Expression modifyExpression(Expression expression, ExpressionModifier... modifiers) {
|
||||||
|
for (ExpressionModifier m : modifiers)
|
||||||
|
expression = modifyExpression(expression, m);
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies an expression.
|
* Modifies an expression.
|
||||||
* Don't recurse! Recursion is done by calling {@link Expression#modify(ExpressionModifier)}
|
* Don't recurse! Recursion is done by calling {@link Expression#modify(ExpressionModifier)}
|
||||||
|
@ -16,12 +16,12 @@ public class NAnd implements ExpressionModifier {
|
|||||||
@Override
|
@Override
|
||||||
public Expression modify(Expression expression) {
|
public Expression modify(Expression expression) {
|
||||||
if (expression instanceof Operation.And) {
|
if (expression instanceof Operation.And) {
|
||||||
return new Not(not(expression));
|
return not(new Not(expression).protect());
|
||||||
} else if (expression instanceof Operation.Or) {
|
} else if (expression instanceof Operation.Or) {
|
||||||
ArrayList<Expression> exp = new ArrayList<>();
|
ArrayList<Expression> exp = new ArrayList<>();
|
||||||
for (Expression e : ((Operation.Or) expression).getExpressions())
|
for (Expression e : ((Operation.Or) expression).getExpressions())
|
||||||
exp.add(not(e));
|
exp.add(not(e));
|
||||||
return not(Operation.and(exp));
|
return new Not(Operation.and(exp)).protect();
|
||||||
} else
|
} else
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ public class NOr implements ExpressionModifier {
|
|||||||
@Override
|
@Override
|
||||||
public Expression modify(Expression expression) {
|
public Expression modify(Expression expression) {
|
||||||
if (expression instanceof Operation.Or) {
|
if (expression instanceof Operation.Or) {
|
||||||
return new Not(not(expression));
|
return not(new Not(expression).protect());
|
||||||
} else
|
} else
|
||||||
if (expression instanceof Operation.And) {
|
if (expression instanceof Operation.And) {
|
||||||
ArrayList<Expression> exp = new ArrayList<>();
|
ArrayList<Expression> exp = new ArrayList<>();
|
||||||
for (Expression e : ((Operation.And) expression).getExpressions())
|
for (Expression e : ((Operation.And) expression).getExpressions())
|
||||||
exp.add(not(e));
|
exp.add(not(e));
|
||||||
return not(Operation.or(exp));
|
return new Not(Operation.or(exp)).protect();
|
||||||
} else
|
} else
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package de.neemann.digital.analyse.expression.modify;
|
||||||
|
|
||||||
|
import de.neemann.digital.analyse.expression.Expression;
|
||||||
|
import de.neemann.digital.analyse.expression.Operation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static de.neemann.digital.analyse.expression.Operation.andNoMerge;
|
||||||
|
import static de.neemann.digital.analyse.expression.Operation.orNoMerge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hneemann
|
||||||
|
*/
|
||||||
|
public class TwoInputs implements ExpressionModifier {
|
||||||
|
@Override
|
||||||
|
public Expression modify(Expression expression) {
|
||||||
|
if (expression instanceof Operation) {
|
||||||
|
Operation op = (Operation) expression;
|
||||||
|
if (op.getExpressions().size() > 2) {
|
||||||
|
if (expression instanceof Operation.And)
|
||||||
|
return new Twoer(op.getExpressions(), (a, b) -> andNoMerge(a, b)).generate();
|
||||||
|
else if (expression instanceof Operation.Or)
|
||||||
|
return new Twoer(op.getExpressions(), (a, b) -> orNoMerge(a, b)).generate();
|
||||||
|
else
|
||||||
|
throw new RuntimeException("operation not supported: " + expression.getClass().getSimpleName());
|
||||||
|
} else
|
||||||
|
return expression;
|
||||||
|
} else
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface OpGen {
|
||||||
|
Expression op(Expression a, Expression b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class Twoer {
|
||||||
|
private final ArrayList<Expression> expressions;
|
||||||
|
private final OpGen opGen;
|
||||||
|
|
||||||
|
Twoer(ArrayList<Expression> expressions, OpGen opGen) {
|
||||||
|
this.expressions = expressions;
|
||||||
|
this.opGen = opGen;
|
||||||
|
}
|
||||||
|
|
||||||
|
Expression generate() {
|
||||||
|
return gen(0, expressions.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Expression gen(int a, int b) {
|
||||||
|
if (a == b)
|
||||||
|
return expressions.get(a);
|
||||||
|
else if (a == b - 1)
|
||||||
|
return opGen.op(expressions.get(a), expressions.get(b));
|
||||||
|
else {
|
||||||
|
int i = (a + b) / 2;
|
||||||
|
return opGen.op(gen(a, i), gen(i + 1, b));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ import de.neemann.digital.analyse.expression.format.FormatterException;
|
|||||||
import de.neemann.digital.analyse.expression.modify.ExpressionModifier;
|
import de.neemann.digital.analyse.expression.modify.ExpressionModifier;
|
||||||
import de.neemann.digital.analyse.expression.modify.NAnd;
|
import de.neemann.digital.analyse.expression.modify.NAnd;
|
||||||
import de.neemann.digital.analyse.expression.modify.NOr;
|
import de.neemann.digital.analyse.expression.modify.NOr;
|
||||||
|
import de.neemann.digital.analyse.expression.modify.TwoInputs;
|
||||||
import de.neemann.digital.draw.builder.Builder;
|
import de.neemann.digital.draw.builder.Builder;
|
||||||
import de.neemann.digital.draw.builder.BuilderException;
|
import de.neemann.digital.draw.builder.BuilderException;
|
||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
@ -128,19 +129,42 @@ public class TableFrame extends JFrame {
|
|||||||
createCircuit(ExpressionModifier.IDENTITY);
|
createCircuit(ExpressionModifier.IDENTITY);
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_table_create_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_table_create_tt")).createJMenuItem());
|
||||||
|
|
||||||
if (Main.enableExperimental()) {
|
if (Main.enableExperimental()) {
|
||||||
|
createMenu.add(new ToolTipAction(Lang.get("menu_table_createTwo")) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
createCircuit(new TwoInputs());
|
||||||
|
}
|
||||||
|
}.setToolTip(Lang.get("menu_table_createTwo_tt")).createJMenuItem());
|
||||||
|
|
||||||
createMenu.add(new ToolTipAction(Lang.get("menu_table_createNAnd")) {
|
createMenu.add(new ToolTipAction(Lang.get("menu_table_createNAnd")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
createCircuit(new NAnd());
|
createCircuit(new NAnd());
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_table_createNAnd_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_table_createNAnd_tt")).createJMenuItem());
|
||||||
|
|
||||||
|
createMenu.add(new ToolTipAction(Lang.get("menu_table_createNAndTwo")) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
createCircuit(new TwoInputs(), new NAnd());
|
||||||
|
}
|
||||||
|
}.setToolTip(Lang.get("menu_table_createNAndTwo_tt")).createJMenuItem());
|
||||||
|
|
||||||
createMenu.add(new ToolTipAction(Lang.get("menu_table_createNOr")) {
|
createMenu.add(new ToolTipAction(Lang.get("menu_table_createNOr")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
createCircuit(new NOr());
|
createCircuit(new NOr());
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_table_createNOr_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_table_createNOr_tt")).createJMenuItem());
|
||||||
|
|
||||||
|
createMenu.add(new ToolTipAction(Lang.get("menu_table_createNOrTwo")) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
createCircuit(new TwoInputs(), new NOr());
|
||||||
|
}
|
||||||
|
}.setToolTip(Lang.get("menu_table_createNOrTwo_tt")).createJMenuItem());
|
||||||
}
|
}
|
||||||
bar.add(createMenu);
|
bar.add(createMenu);
|
||||||
|
|
||||||
@ -155,7 +179,7 @@ public class TableFrame extends JFrame {
|
|||||||
setLocationRelativeTo(parent);
|
setLocationRelativeTo(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createCircuit(ExpressionModifier modifier) {
|
private void createCircuit(ExpressionModifier... modifier) {
|
||||||
try {
|
try {
|
||||||
Builder builder = new Builder(shapeFactory);
|
Builder builder = new Builder(shapeFactory);
|
||||||
HashSet<String> contained = new HashSet<>();
|
HashSet<String> contained = new HashSet<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user