Search in sources :

Example 1 with Operand

use of javax.jcr.query.qom.Operand in project jackrabbit by apache.

the class RowComparator method compare.

public int compare(Row a, Row b) {
    try {
        for (Ordering ordering : orderings) {
            Operand operand = ordering.getOperand();
            Value[] va = evaluator.getValues(operand, a);
            Value[] vb = evaluator.getValues(operand, b);
            int d = comparator.compare(va, vb);
            if (d != 0) {
                if (JCR_ORDER_DESCENDING.equals(ordering.getOrder())) {
                    return -d;
                } else {
                    return d;
                }
            }
        }
        return 0;
    } catch (RepositoryException e) {
        throw new RuntimeException("Unable to compare rows " + a + " and " + b, e);
    }
}
Also used : Operand(javax.jcr.query.qom.Operand) Ordering(javax.jcr.query.qom.Ordering) Value(javax.jcr.Value) RepositoryException(javax.jcr.RepositoryException)

Aggregations

RepositoryException (javax.jcr.RepositoryException)1 Value (javax.jcr.Value)1 Operand (javax.jcr.query.qom.Operand)1 Ordering (javax.jcr.query.qom.Ordering)1