public int depth ( Tree node ) { Tree p = node . parent ( this ) ; if ( this == node ) { return 0 ; } if ( p == null ) { return - 1 ; } int depth = 1 ; while ( this != p ) { p = p . parent ( this ) ; depth ++ ; } return depth ; }
Returns the distance between this node and the specified subnode