2020-04-13 10:56:58 +00:00
|
|
|
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();
|
2020-04-13 10:56:58 +00:00
|
|
|
for (int i = 1; i < getInputNumber(); i++) {
|
2020-04-13 09:14:15 +00:00
|
|
|
state |= getInput(i).getValue();
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|