org.apache.jackrabbit.core.query
Class OrderQueryNode

java.lang.Object
  extended byorg.apache.jackrabbit.core.query.QueryNode
      extended byorg.apache.jackrabbit.core.query.OrderQueryNode

public class OrderQueryNode
extends QueryNode

Implements a query node that defines the order of nodes according to the values of properties.


Nested Class Summary
static class OrderQueryNode.OrderSpec
          Implements a single order specification.
 
Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.query.QueryNode
TYPE_AND, TYPE_DEREF, TYPE_EXACT, TYPE_LOCATION, TYPE_NODETYPE, TYPE_NOT, TYPE_OR, TYPE_ORDER, TYPE_PATH, TYPE_RELATION, TYPE_ROOT, TYPE_TEXTSEARCH
 
Constructor Summary
OrderQueryNode(QueryNode parent)
          Creates a new OrderQueryNode with a reference to a parent node and sort properties.
 
Method Summary
 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.
 void addOrderSpec(OrderQueryNode.OrderSpec spec)
          Adds an order specification to this query node.
 void addOrderSpec(QName property, boolean ascending)
          Adds an order specification to this query node.
 boolean equals(Object obj)
          Returns true if obj is the same type of QueryNode as this node and is equal to this node.
 OrderQueryNode.OrderSpec[] getOrderSpecs()
          Returns a OrderSpec array that contains order by specifications.
 int getType()
          Returns the type of this node.
 boolean isAscending(int i)
          Returns true if the property i should be orderd ascending.
 
Methods inherited from class org.apache.jackrabbit.core.query.QueryNode
dump, getParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderQueryNode

public OrderQueryNode(QueryNode parent)
Creates a new OrderQueryNode with a reference to a parent node and sort properties.

Parameters:
parent - the parent node of this query node.
Method Detail

getType

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

Specified by:
getType in class QueryNode
Returns:
the type of this node.

addOrderSpec

public void addOrderSpec(QName property,
                         boolean ascending)
Adds an order specification to this query node.

Parameters:
property - the name of the property.
ascending - if true values of this properties are ordered ascending; descending if false.

addOrderSpec

public void addOrderSpec(OrderQueryNode.OrderSpec spec)
Adds an order specification to this query node.

Parameters:
spec - the order spec.

accept

public 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.

Specified by:
accept in class QueryNode
Parameters:
visitor - the visitor to call back.
data - arbitrary data for the visitor.
Returns:
the return value of the visitor.visit() call.

isAscending

public boolean isAscending(int i)
                    throws IndexOutOfBoundsException
Returns true if the property i should be orderd ascending. If false the property is ordered descending.

Parameters:
i - index of the property
Returns:
the order spec for the property i.
Throws:
IndexOutOfBoundsException - if there is no property with index i.

getOrderSpecs

public OrderQueryNode.OrderSpec[] getOrderSpecs()
Returns a OrderSpec array that contains order by specifications.

Returns:
order by specs.

equals

public boolean equals(Object obj)
Description copied from class: QueryNode
Returns true if obj is the same type of QueryNode as this node and is equal to this node.

Specified by:
equals in class QueryNode
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.