/** * Adds sibling nodes (defined using builder-style notation via a Closure) after the current node. * * @param c A Closure defining the new sibling nodes to add using builder-style notation. */ public void plus(Closure c) { if (parent() == null) { throw new UnsupportedOperationException("Adding sibling nodes to the root node is not supported"); } appendNodes(c); }
/** * Replaces the current node with nodes defined using builder-style notation via a Closure. * * @param c A Closure defining the new nodes using builder-style notation. * @return the original now replaced node */ public Node replaceNode(Closure c) { if (parent() == null) { throw new UnsupportedOperationException("Replacing the root node is not supported"); } appendNodes(c); getParentList(parent()).remove(this); this.setParent(null); return this; }
/** * Adds sibling nodes (defined using builder-style notation via a Closure) after the current node. * * @param c A Closure defining the new sibling nodes to add using builder-style notation. */ public void plus(Closure c) { if (parent() == null) { throw new UnsupportedOperationException("Adding sibling nodes to the root node is not supported"); } appendNodes(c); }
/** * Replaces the current node with nodes defined using builder-style notation via a Closure. * * @param c A Closure defining the new nodes using builder-style notation. * @return the last appended node */ public Node replaceNode(Closure c) { if (parent() == null) { throw new UnsupportedOperationException("Replacing the root node is not supported"); } Node result = appendNodes(c); getParentList(parent()).remove(this); // this.setParent(null); // return this; return result; }