From 73fa6e12fe48d8dcddc0706c8d86373ff86920af Mon Sep 17 00:00:00 2001 From: lukas-heiligenbrunner Date: Thu, 16 Apr 2020 08:56:08 +0200 Subject: [PATCH] allow defining pins after inserting it to other gate --- eu.heili/DigitalInput.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eu.heili/DigitalInput.java b/eu.heili/DigitalInput.java index c428309..6cd52c2 100644 --- a/eu.heili/DigitalInput.java +++ b/eu.heili/DigitalInput.java @@ -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) {