/** * Returns true if <code>anotherNode</code> is a descendant of this node -- if it is this node, * one of this node's children, or a descendant of one of this node's children. Note that a node * is considered a descendant of itself. If <code>anotherNode</code> is null, returns false. This * operation is at worst O(h) where h is the distance from the root to <code>anotherNode</code>. * * @see #isNodeAncestor * @see #getSharedAncestor * @param anotherNode node to test as descendant of this node * @return true if this node is an ancestor of <code>anotherNode</code> */ public boolean isNodeDescendant(DefaultMutableTreeNode anotherNode) { if (anotherNode == null) return false; return anotherNode.isNodeAncestor(this); }