|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jec.Operator net.sf.jec.namedop.GroupOperator net.sf.jec.namedop.OrderByOperator
OrderByOperator sorts a Collection of elements by applying the argument operator to each element and comparing between the resulting values. The sort mode can be ascendent (by default) or descendent. You can specify a sort mode for each argument operator by writting it just after the argument operator.
Syntax: orderby(argOperator, [sortMode], [argOperator, [sortMode]])
Examples:
1. This one orders ascending by the accessor operators customerNumber (primary field) and customerAge (secondary field).
orderby(customerNumber, customerAge)
2. This one orders by the same criteria but descending. This example ilustrates where to specify the sort mode when you want to apply the same for all the argument operators. You must place it as the last argument.
orderby(customerNumber, customerAge, 'desc')
3. This one orders the primary field descending and the secondary ascending.
orderby(customerNumber, 'desc', customerAge, 'asc')
4. A given sort mode applies to all of the operator arguments preceeding it until another sort mode is found. In this example, the two last argOperators are sorted ascending and the first is sorted descending. Think that the tuple is processed from the right to the left and the sort modes are switches that fix the current sort mode.
orderby(customerNumber, 'desc', customerAge, customerWeight, 'asc')
In this case we could remove the last 'asc' argument because this is the default sort mode. The result would be the same:
orderby(customerNumber, 'desc', customerAge, customerWeight)
But you should always specify explicitly the desired order.
Field Summary |
Fields inherited from class net.sf.jec.Operator |
argOps, nestedOp, showFunctionString |
Constructor Summary | |
OrderByOperator()
Creates a new OrderByOperator |
Method Summary | |
protected java.lang.Object |
directMap(java.lang.Object rootCtx,
java.lang.Object ctx)
Returns the associated value to the given context and root context |
java.lang.String |
toExpressionString()
Returns an expression String representation for this operator |
java.lang.String |
toFunctionString()
Returns a function representation String for this operator |
Methods inherited from class net.sf.jec.namedop.GroupOperator |
applyToGroup |
Methods inherited from class net.sf.jec.Operator |
apply, setArgumentOperators, setNestedOperator, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OrderByOperator()
Method Detail |
public java.lang.String toFunctionString()
toFunctionString
in class Operator
public java.lang.String toExpressionString()
toExpressionString
in class Operator
protected java.lang.Object directMap(java.lang.Object rootCtx, java.lang.Object ctx) throws EvaluationException
directMap
in class Operator
rootCtx
- The root context, needed for operators that require
expression evaluation from root point. Example: Indexer operatorsctx
- The current context where the operator will work over
EvaluationException
- when the operator can not be applied to the given context.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |