}
toAdd.add(Pair.of((Component) inputProp, typeToAdd));
}
}
Constant trueConst = new Constant(true);
Constant falseConst = new Constant(false);
pn.addComponent(trueConst);
pn.addComponent(falseConst);
//Make them the input of all false/true components
for(Entry<Component, Type> entry : reachability.entrySet()) {
Type type = entry.getValue();
if(type == Type.TRUE || type == Type.FALSE) {
Component c = entry.getKey();
if (c instanceof Constant) {
//Don't bother trying to remove this
continue;
}
//Disconnect from inputs
for(Component input : c.getInputs()) {
input.removeOutput(c);
}
c.removeAllInputs();
if(type == Type.TRUE ^ (c instanceof Not)) {
c.addInput(trueConst);
trueConst.addOutput(c);
} else {
c.addInput(falseConst);
falseConst.addOutput(c);
}
}
}
optimizeAwayTrueAndFalse(pn, trueConst, falseConst);