parent.removeOutput(or);
or.removeAllInputs();
if(pn != null)
pn.removeComponent(or);
} else if(output instanceof And) {
And and = (And) output;
//Remove as input from and
and.removeInput(trueComponent);
trueComponent.removeOutput(and);
//If and has only one input, remove it
if(and.getInputs().size() == 1) {
Component in = and.getSingleInput();
and.removeInput(in);
in.removeOutput(and);
for(Component out : and.getOutputs()) {
//Disconnect from and
out.removeInput(and);
//and.removeOutput(out); //do at end
//Connect directly to the new input
out.addInput(in);
in.addOutput(out);
}
and.removeAllOutputs();
if (pn != null) {
pn.removeComponent(and);
}
} else if (and.getInputs().size() == 0) {
if (pn != null) {
pn.removeComponent(and);
}
}
} else if(output instanceof Not) {