public final <T extends AstNode> void addChild(final T child, final Role<T> role) { VerifyArgument.notNull(role, "role"); if (child == null || child.isNull()) { return; } verifyNotFrozen(); if (((AstNode)child)._parent != null) { throw new IllegalArgumentException("Node belongs to another tree."); } if (child.isFrozen()) { throw new IllegalArgumentException("Cannot add a frozen node."); } addChildUnsafe(child, role); }
public final <T extends AstNode> void addChild(final T child, final Role<? extends T> role) { VerifyArgument.notNull(role, "role"); if (child == null || child.isNull()) { return; } verifyNotFrozen(); if (((AstNode)child)._parent != null) { throw new IllegalArgumentException("Node belongs to another tree."); } if (child.isFrozen()) { throw new IllegalArgumentException("Cannot add a frozen node."); } addChildUnsafe(child, role); }
public final <T extends AstNode> void addChild(final T child, final Role<T> role) { VerifyArgument.notNull(role, "role"); if (child == null || child.isNull()) { return; } verifyNotFrozen(); if (((AstNode)child)._parent != null) { throw new IllegalArgumentException("Node belongs to another tree."); } if (child.isFrozen()) { throw new IllegalArgumentException("Cannot add a frozen node."); } addChildUnsafe(child, role); }
@Override @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") public AstNode clone() { try { final AstNode clone = (AstNode) super.clone(); clone._parent = null; clone._firstChild = null; clone._lastChild = null; clone._previousSibling = null; clone._nextSibling = null; clone.flags &= ~FROZEN_BIT; for (final Key<?> key : Keys.ALL_KEYS) { copyKey(this, clone, key); } for (AstNode current = _firstChild; current != null; current = current._nextSibling) { clone.addChildUnsafe(current.clone(), current.getRole()); } // clone.cloneAnnotations(); return clone; } catch (CloneNotSupportedException e) { throw new UndeclaredThrowableException(e); } }
@Override @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") public AstNode clone() { try { final AstNode clone = (AstNode) super.clone(); clone._parent = null; clone._firstChild = null; clone._lastChild = null; clone._previousSibling = null; clone._nextSibling = null; clone.flags &= ~FROZEN_BIT; for (final Key<?> key : Keys.ALL_KEYS) { copyKey(this, clone, key); } for (AstNode current = _firstChild; current != null; current = current._nextSibling) { clone.addChildUnsafe(current.clone(), current.getRole()); } // clone.cloneAnnotations(); return clone; } catch (CloneNotSupportedException e) { throw new UndeclaredThrowableException(e); } }
@Override @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") public AstNode clone() { try { final AstNode clone = (AstNode) super.clone(); clone._parent = null; clone._firstChild = null; clone._lastChild = null; clone._previousSibling = null; clone._nextSibling = null; clone.flags &= ~FROZEN_BIT; for (final Key<?> key : Keys.ALL_KEYS) { copyKey(this, clone, key); } for (AstNode current = _firstChild; current != null; current = current._nextSibling) { clone.addChildUnsafe(current.clone(), current.getRole()); } // clone.cloneAnnotations(); return clone; } catch (CloneNotSupportedException e) { throw new UndeclaredThrowableException(e); } }
oldParent.addChildUnsafe(replacement, oldRole);
oldParent.addChildUnsafe(replacement, oldRole);
oldParent.addChildUnsafe(replacement, oldRole);