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;
|
|
|
|
}
|
|
|
|
}
|