code: public int subtreeDepth() throws UnsupportedOperationException {
          String subtree=name;
          int i=1;
  
          /* count dots */
          for (; subtree.lastIndexOf('.') >= 0; i++) {
              subtree=subtree.substring(0,subtree.lastIndexOf('.'));
          }
  
          return i;
      }
docs: Return subtree depth of this name for purposes of determining
  NameConstraints minimum and maximum bounds and for calculating
  path lengths in name subtrees.
  
  @returns distance of name from root
  @throws UnsupportedOperationException if not supported for this name type