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