org.apache.chemistry.opencmis.jcr.query
Class ParseTreeWalker<T>

java.lang.Object
  extended by org.apache.chemistry.opencmis.jcr.query.ParseTreeWalker<T>
Type Parameters:
T - type of the result determined by the Evaluator used.
All Implemented Interfaces:
PredicateWalkerBase

public class ParseTreeWalker<T>
extends java.lang.Object
implements PredicateWalkerBase

This implementation of PredicateWalkerBase traverses the parse tree of a CMIS query. It uses an Evaluator to accumulate the result of the traversal. Evaluator has a corresponding method for each node type in the parse tree. ParseTreeWalker calls these methods while traversing the parse tree passing an Evaluator for each of the corresponding operation's arguments.
The walkPredicate(Tree) serves as entry point for traversing a parse tree. After successful traversal, the result is obtained from the getResult() method.


Constructor Summary
ParseTreeWalker(Evaluator<T> evaluator)
          Create a new instance for traversing CMIS query parse trees.
 
Method Summary
 T getResult()
          Retrieve the result of a successful traversal.
protected  T walkOtherExpr(Evaluator evaluator, org.antlr.runtime.tree.Tree node)
          For extensibility.
protected  T walkOtherPredicate(Evaluator evaluator, org.antlr.runtime.tree.Tree node)
          For extensibility.
 java.lang.Boolean walkPredicate(org.antlr.runtime.tree.Tree node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParseTreeWalker

public ParseTreeWalker(Evaluator<T> evaluator)
Create a new instance for traversing CMIS query parse trees.

Parameters:
evaluator - Evaluator for evaluating the nodes of the parse tree
Method Detail

getResult

public T getResult()
Retrieve the result of a successful traversal.

Returns:
result of traversal or null if either not yet traversed, an error occurred on traversal or the query has an empty where clause.

walkPredicate

public java.lang.Boolean walkPredicate(org.antlr.runtime.tree.Tree node)
Specified by:
walkPredicate in interface PredicateWalkerBase

walkOtherExpr

protected T walkOtherExpr(Evaluator evaluator,
                          org.antlr.runtime.tree.Tree node)
For extensibility.


walkOtherPredicate

protected T walkOtherPredicate(Evaluator evaluator,
                               org.antlr.runtime.tree.Tree node)
For extensibility.



Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.