public Node removeNode (int index) { Node n = nodes.remove (index); if (n instanceof Child) ((Child)n).setParent (null); return n; }
public Document getDocument () { Parent p = getParent (); while (p != null) { if (p.getType () == Type.DOCUMENT) return (Document)p; p = ((Child)p).getParent (); } return null; }
public boolean removeNode (Node n) { if (nodes == null) return false; if (nodes.remove (n)) { if (n instanceof Child) { ((Child)n).setParent (null); } return true; } return false; }
public NodeWithChildren addNode (int index, Node node) { if (nodes == null) nodes = new ArrayList<Node> (); nodes.add (index, node); if (node instanceof Child) { Child child = (Child)node; child.setParent (this); } return this; }