private boolean matchesQualifiedName(String qname, int endIndex) {
    int start = qname.lastIndexOf('.', endIndex - 1) + 1;

    switch (this.getToken()) {
      case NAME:
        String name = getString();
        return start == 0 && !name.isEmpty() && name.length() == endIndex && qname.startsWith(name);
      case THIS:
        return start == 0 && 4 == endIndex && qname.startsWith("this");
      case SUPER:
        return start == 0 && 5 == endIndex && qname.startsWith("super");
      case GETPROP:
        String prop = getLastChild().getString();
        return start > 1
            && prop.length() == endIndex - start
            && prop.regionMatches(0, qname, start, endIndex - start)
            && getFirstChild().matchesQualifiedName(qname, start - 1);

      case MEMBER_FUNCTION_DEF:
        // These are explicitly *not* qualified name components.
      default:
        return false;
    }
  }
private boolean matchesQualifiedName ( String qname , int endIndex ) { int start = qname . lastIndexOf ( '.' , endIndex - 1 ) + 1 ; switch ( this . getToken ( ) ) { case NAME : String name = getString ( ) ; return start == 0 && ! name . isEmpty ( ) && name . length ( ) == endIndex && qname . startsWith ( name ) ; case THIS : return start == 0 && 4 == endIndex && qname . startsWith ( "this" ) ; case SUPER : return start == 0 && 5 == endIndex && qname . startsWith ( "super" ) ; case GETPROP : String prop = getLastChild ( ) . getString ( ) ; return start > 1 && prop . length ( ) == endIndex - start && prop . regionMatches ( 0 , qname , start , endIndex - start ) && getFirstChild ( ) . matchesQualifiedName ( qname , start - 1 ) ; case MEMBER_FUNCTION_DEF : default : return false ; } }
Returns whether a node matches a simple or a qualified name, such as
<code>x</code> or <code>a.b.c</code> or <code>this.a</code>.