LogicGates/eu.heili/DigitalInput.java

42 lines
791 B
Java
Raw Normal View History

2020-04-13 09:14:15 +00:00
public class DigitalInput {
private boolean value = false;
public DigitalInput(boolean value) {
this.value = value;
}
/**
* default value is false!
*/
public DigitalInput() {
}
public void setValue(boolean value) {
this.value = value;
}
public void setValue(LogicGate gate) {
this.value = gate.getOutput(); // todo validation stuff
}
public void setValue(int value) {
if(value > 0){
this.value = true;
}else{
this.value = false;
}
}
public void setValue(char value) {
if(value == 'H'){
this.value = true;
}else{
this.value = false;
}
}
public boolean getValue() {
return value;
}
}