allow defining pins after inserting it to other gate

This commit is contained in:
lukas-heiligenbrunner 2020-04-16 08:56:08 +02:00
parent 2838795f32
commit 73fa6e12fe

View File

@ -1,5 +1,6 @@
public class DigitalInput {
private boolean value = false;
private LogicGate gt = null;
public DigitalInput(final boolean value) {
setValue(value);
@ -24,7 +25,11 @@ public class DigitalInput {
}
public boolean getValue() {
return value;
if (gt != null) {
return gt.getOutput(); // validate gate here
} else {
return value;
}
}
public void setValue(boolean value) {
@ -32,7 +37,7 @@ public class DigitalInput {
}
public void setValue(LogicGate gate) {
this.value = gate.getOutput(); // todo validation stuff
this.gt = gate;
}
public void setValue(int value) {