@Override public Object becomeRoot(Token newRoot, Object oldRoot) { return becomeRoot(create(newRoot), oldRoot); }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
public Object create(int tokenType, String text) { Token fromToken = createToken(tokenType, text); Tree t = (Tree)create(fromToken); return t; }
@Override public Object nil() { return create(null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
@Override public Object becomeRoot(final Token newRoot, final Object oldRoot) { return super.becomeRoot(newRoot, oldRoot); }
@Override public Object nil() { return create(null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
@Override public Object create(int tokenType, String text) { Token fromToken = createToken(tokenType, text); Tree t = (Tree)create(fromToken); return t; }
@Override public Object becomeRoot(Token newRoot, Object oldRoot) { return becomeRoot(create(newRoot), oldRoot); }
@Override public Object nil() { return create(null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
@Override public Object create(int tokenType, String text) { Token fromToken = createToken(tokenType, text); Tree t = (Tree)create(fromToken); return t; }
@Override public Object becomeRoot(Token newRoot, Object oldRoot) { return becomeRoot(create(newRoot), oldRoot); }
@Override public Object nil() { return create(null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
@Override public Object create(int tokenType, String text) { Token fromToken = createToken(tokenType, text); Tree t = (Tree)create(fromToken); return t; }