for (Nonterminal nt : c.getNodes()) {
List<Production> removedProductions = new LinkedList<Production>();
List<Production> addedProductions = new LinkedList<Production>();
for (Production prod : nt.getProductions()) {
if (prod instanceof BinaryProduction) {
BinaryProduction bp = (BinaryProduction)prod;
// only consider assertions
if (!bp.getOperation().isAssertion())
continue;
// if the destination node is also in a cycle
if (c.contains(bp.getNonterminal1()) || c.contains(bp.getNonterminal2())) {
removedProductions.add(prod);
addedProductions.add(new UnitProduction(bp.getNonterminal1()));
}
}
else if (prod instanceof UnaryProduction) {
UnaryProduction up = (UnaryProduction)prod;