private List<E> getAllNodes() { E root = getRoot(); List all = new LinkedList(); if (root != null) { getChildNodes(all, root); } return all; }
/** * Returns the path from the specified child. * This implementation looks for the child by traversing every possible * child (deep-first). * It is suggested to override this method for better performance, * if there is a better algorithm. * @since 6.0.0 */ public int[] getPath(E child) { final List<Integer> path = new ArrayList<Integer>(); dfSearch(path, getRoot(), child); final int[] ipath = new int[path.size()]; for (int j = 0; j < ipath.length; j++) ipath[j] = path.get(j); return ipath; }
public E getChild(int[] path) { E node = getRoot(); for (int childCount = 0, i = 0; i < path.length && node != null; i++) { if (path[i] < 0 || path[i] > (childCount = _childCount(node))) return null; node = getChild(node, path[i]); } return node; }