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) {
|
2020-04-13 10:48:15 +00:00
|
|
|
this.value = value > 0;
|
2020-04-13 09:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setValue(char value) {
|
2020-04-13 10:48:15 +00:00
|
|
|
this.value = value == 'H';
|
2020-04-13 09:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|