|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.jdoql.OrderingComparator
An instance of this class is used to compare two instances of
Comparable
based on the ordering expressions
defined by a query tree. This instance holds references to a query tree,
a tree walker and a memory query instance for this purpose.
Constructor Summary | |
OrderingComparator(TreeWalker walker,
MemoryQuery nodeVisitor)
Constructs an ordering comparator for a tree walker and a node visitor. |
|
OrderingComparator(TreeWalker walker,
MemoryQuery nodeVisitor,
QueryTree queryTree)
Constructs an ordering comparator for a tree walker, a node visitor and a query tree. |
Method Summary | |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Required method for implementing the interface Comparator . |
void |
setQueryTree(QueryTree queryTree)
Sets the query tree for this ordering comparator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
Constructor Detail |
public OrderingComparator(TreeWalker walker, MemoryQuery nodeVisitor)
setQueryTree
.
walker
- the tree walkernodeVisitor
- the node visitor evaluating the ordering expressionspublic OrderingComparator(TreeWalker walker, MemoryQuery nodeVisitor, QueryTree queryTree)
walker
- the tree walkernodeVisitor
- the node visitor evaluating the ordering expressionsqueryTree
- the query tree containing the ordering expressionsMethod Detail |
public void setQueryTree(QueryTree queryTree)
queryTree
- the query tree containing the ordering expression listpublic int compare(java.lang.Object o1, java.lang.Object o2)
Comparator
.
This method returns a negative integer, zero, or a positive integer
as the first argument is less than, equal to, or greater than the second
argument.
If this instance is not bound to a query tree or,
if the query tree bound to this instance
does not have any ordering expression, then argument o1
is less than argument o2
by definition.
compare
in interface java.util.Comparator
o1
- the first object to be comparedo2
- the second object to be compared
java.lang.ClassCastException
- if the arguments are not instances of
Comparable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |