LogicGates/eu.heili/OrGate.java

19 lines
409 B
Java
Raw Normal View History

2020-04-13 09:14:15 +00:00
public class OrGate extends LogicGate{
public OrGate(int inputnr) {
super(inputnr);
}
2020-04-13 09:23:57 +00:00
public OrGate(boolean... 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++){
state |= getInput(i).getValue();
}
return state;
}
}