LogicGates/eu.heili/OrGate.java
2020-04-13 14:36:06 +02:00

19 lines
429 B
Java

public class OrGate extends LogicGate {
public OrGate(final int inputnr) {
super(inputnr);
}
public OrGate(final DigitalInput... inputvals) {
super(inputvals);
}
@Override
public boolean getOutput() {
boolean state = getInput(0).getValue();
for (int i = 1; i < getInputNumber(); i++) {
state |= getInput(i).getValue();
}
return state;
}
}