LogicGates/eu.heili/OrGate.java

19 lines
429 B
Java
Raw Normal View History

public class OrGate extends LogicGate {
2020-04-13 12:36:06 +00:00
public OrGate(final int inputnr) {
2020-04-13 09:14:15 +00:00
super(inputnr);
}
2020-04-13 12:36:06 +00:00
public OrGate(final DigitalInput... inputvals) {
2020-04-13 09:14:15 +00:00
super(inputvals);
}
@Override
public boolean getOutput() {
boolean state = getInput(0).getValue();
for (int i = 1; i < getInputNumber(); i++) {
2020-04-13 09:14:15 +00:00
state |= getInput(i).getValue();
}
return state;
}
}