Logo Search packages:      
Sourcecode: antlr version File versions

boolean antlr::BaseAST::equalsTreePartial ( AST  sub  )  [inline, inherited]

Is 't' a subtree of the tree rooted at 'this'? The siblings of 'this' are ignored.

Implements antlr::collections::AST.

Definition at line 195 of file BaseAST.java.

References antlr::BaseAST::equals(), antlr::BaseAST::equalsListPartial(), antlr::collections::AST::getFirstChild(), and antlr::BaseAST::getFirstChild().

        // the empty tree is always a subset of any tree.
        if (sub == null) {
            return true;

        // check roots first.
        if (!this.equals(sub)) return false;
        // if roots match, do full list partial match test on children.
        if (this.getFirstChild() != null) {
            if (!this.getFirstChild().equalsListPartial(sub.getFirstChild())) return false;
        return true;

Generated by  Doxygen 1.6.0   Back to index