allow defining pins after inserting it to other gate
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
public class DigitalInput {
 | 
					public class DigitalInput {
 | 
				
			||||||
    private boolean value = false;
 | 
					    private boolean value = false;
 | 
				
			||||||
 | 
					    private LogicGate gt = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public DigitalInput(final boolean value) {
 | 
					    public DigitalInput(final boolean value) {
 | 
				
			||||||
        setValue(value);
 | 
					        setValue(value);
 | 
				
			||||||
@@ -24,7 +25,11 @@ public class DigitalInput {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean getValue() {
 | 
					    public boolean getValue() {
 | 
				
			||||||
        return value;
 | 
					        if (gt != null) {
 | 
				
			||||||
 | 
					            return gt.getOutput(); // validate gate here
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return value;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setValue(boolean value) {
 | 
					    public void setValue(boolean value) {
 | 
				
			||||||
@@ -32,7 +37,7 @@ public class DigitalInput {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setValue(LogicGate gate) {
 | 
					    public void setValue(LogicGate gate) {
 | 
				
			||||||
        this.value = gate.getOutput(); // todo validation stuff
 | 
					        this.gt = gate;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setValue(int value) {
 | 
					    public void setValue(int value) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user