/** * Check if a node is a leaf node. */ public boolean isLeaf(Object node) { // System.out.println("isLeaf: "+getChildCount(node)==0+" "+node); return getChildCount(node)==0; }
/** * Get the index of a given child. */ public int getIndexOfChild(Object parent, Object child) { int index = -1; // Hack!!! Inefficient implementation!? int count = getChildCount(parent); for(int i=0; index==-1 && i<count; i++) { if(getChild(parent, i).equals(child)) index = i; } return index; }