code: static int distance(GeneralNameInterface base,
                          GeneralNameInterface test, int incomparable)
      {
          switch (base.constrains(test)) {
          case GeneralNameInterface.NAME_DIFF_TYPE:
              if (debug != null) {
                  debug.println("Builder.distance(): Names are different types");
              }
              return incomparable;
          case GeneralNameInterface.NAME_SAME_TYPE:
              if (debug != null) {
                  debug.println("Builder.distance(): Names are same type but " +
                      "in different subtrees");
              }
              return incomparable;
          case GeneralNameInterface.NAME_MATCH:
              return 0;
          case GeneralNameInterface.NAME_WIDENS:
              break;
          case GeneralNameInterface.NAME_NARROWS:
              break;
          default: // should never occur
              return incomparable;
          }
  
          /* names are in same subtree */
          return test.subtreeDepth() - base.subtreeDepth();
      }
docs: get distance of one GeneralName from another
  
  @param base GeneralName at base of subtree
  @param test GeneralName to be tested against base
  @param incomparable the value to return if the names are
  incomparable
  @return distance of test name from base, where 0
  means exact match, 1 means test is an immediate
  child of base, 2 means test is a grandchild, etc.
  -1 means test is a parent of base, -2 means test
  is a grandparent, etc.