//Special case: An input is "or"
//I'm honestly not sure how to handle special cases here...
//What if that "or" gate has multiple outputs? Could that happen?
//For reals... just skip over any false constants
Or or = new Or();
for(Component in : inputs) {
if(!(in instanceof Constant)) {
in.addOutput(or);
or.addInput(in);
}
}
//What if they're all false? (Or inputs is empty?) Then no inputs at this point...
if(or.getInputs().isEmpty()) {
//Hook up to "false"
falseProp.addOutput(output);
output.addInput(falseProp);
return;
}
//If there's just one, on the other hand, don't use the or gate
if(or.getInputs().size() == 1) {
Component in = or.getSingleInput();
in.removeOutput(or);
or.removeInput(in);
in.addOutput(output);
output.addInput(in);
return;
}
or.addOutput(output);
output.addInput(or);
}