if (content instanceof ElementNode || content instanceof AttributeNode) {
sc.setContent(pred.get(content).getIndex());
}
}
else if (node instanceof MultiContentNode) {
MultiContentNode mc = (MultiContentNode)node;
LinkedList<Integer> newcontent = new LinkedList<Integer>();
LinkedList<Integer> removedcontent = new LinkedList<Integer>();
for (int child : mc.getContents()) {
Node content = xg.getNode(child);
if (content instanceof ElementNode || content instanceof AttributeNode) {
Node p = pred.get(content);
if (p != mc) { // predecessor might be this node -- don't change that
newcontent.add(p.getIndex());
removedcontent.add(child);
}
}
}
mc.getContents().removeAll(removedcontent);
mc.getContents().addAll(newcontent);
}
}
}