org.apache.jackrabbit.core.query
Class QueryNode

java.lang.Object
  extended byorg.apache.jackrabbit.core.query.QueryNode
Direct Known Subclasses:
ExactQueryNode, NAryQueryNode, OrderQueryNode, QueryRootNode, RelationQueryNode, TextsearchQueryNode

public abstract class QueryNode
extends Object

Implements an abstract base class for nodes of a query tree that represents a query. The query tree is independent from the query syntax which is used to search the repository.


Field Summary
static int TYPE_AND
          Type value for AndQueryNode
static int TYPE_DEREF
          Type value for DerefQueryNode
static int TYPE_EXACT
          Type value for ExactQueryNode
static int TYPE_LOCATION
          Type value for LocationStepQueryNode
static int TYPE_NODETYPE
          Type value for NodeTypeQueryNode
static int TYPE_NOT
          Type value for NotQueryNode
static int TYPE_OR
          Type value for OrQueryNode
static int TYPE_ORDER
          Type value for OrderQueryNode
static int TYPE_PATH
          Type value for PathQueryNode
static int TYPE_RELATION
          Type value for RelationQueryNode
static int TYPE_ROOT
          Type value for QueryRootNode
static int TYPE_TEXTSEARCH
          Type value for TextsearchQueryNode
 
Constructor Summary
QueryNode(QueryNode parent)
          Constructs a new QueryNode with a reference to it's parent.
 
Method Summary
abstract  Object accept(QueryNodeVisitor visitor, Object data)
          Accepts a QueryNodeVisitor and calls the apropriate visit method on the visitor depending on the concrete implementation of this QueryNode.
 String dump()
          Dumps this QueryNode and its child nodes to a String.
abstract  boolean equals(Object obj)
          Returns true if obj is the same type of QueryNode as this node and is equal to this node.
 QueryNode getParent()
          Returns the parent QueryNode or null if this is the root node of a query tree.
abstract  int getType()
          Returns the type of this query node.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_ROOT

public static final int TYPE_ROOT
Type value for QueryRootNode

See Also:
Constant Field Values

TYPE_RELATION

public static final int TYPE_RELATION
Type value for RelationQueryNode

See Also:
Constant Field Values

TYPE_ORDER

public static final int TYPE_ORDER
Type value for OrderQueryNode

See Also:
Constant Field Values

TYPE_TEXTSEARCH

public static final int TYPE_TEXTSEARCH
Type value for TextsearchQueryNode

See Also:
Constant Field Values

TYPE_EXACT

public static final int TYPE_EXACT
Type value for ExactQueryNode

See Also:
Constant Field Values

TYPE_NODETYPE

public static final int TYPE_NODETYPE
Type value for NodeTypeQueryNode

See Also:
Constant Field Values

TYPE_AND

public static final int TYPE_AND
Type value for AndQueryNode

See Also:
Constant Field Values

TYPE_OR

public static final int TYPE_OR
Type value for OrQueryNode

See Also:
Constant Field Values

TYPE_NOT

public static final int TYPE_NOT
Type value for NotQueryNode

See Also:
Constant Field Values

TYPE_LOCATION

public static final int TYPE_LOCATION
Type value for LocationStepQueryNode

See Also:
Constant Field Values

TYPE_PATH

public static final int TYPE_PATH
Type value for PathQueryNode

See Also:
Constant Field Values

TYPE_DEREF

public static final int TYPE_DEREF
Type value for DerefQueryNode

See Also:
Constant Field Values
Constructor Detail

QueryNode

public QueryNode(QueryNode parent)
Constructs a new QueryNode with a reference to it's parent.

Parameters:
parent - the parent node, or null if this is the root node of a query tree.
Method Detail

getParent

public QueryNode getParent()
Returns the parent QueryNode or null if this is the root node of a query tree.

Returns:
the parent QueryNode or null if this is the root node of a query tree.

dump

public String dump()
Dumps this QueryNode and its child nodes to a String.

Returns:
the query tree as a String.

accept

public abstract Object accept(QueryNodeVisitor visitor,
                              Object data)
Accepts a QueryNodeVisitor and calls the apropriate visit method on the visitor depending on the concrete implementation of this QueryNode.

Parameters:
visitor - the visitor to call back.
data - arbitrary data for the visitor.
Returns:
the return value of the visitor.visit() call.

getType

public abstract int getType()
Returns the type of this query node.

Returns:
the type of this query node.

equals

public abstract boolean equals(Object obj)
Returns true if obj is the same type of QueryNode as this node and is equal to this node.

Parameters:
obj - the reference object with which to compare.
Returns:
true if obj is equal to this; false otherwise.


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.