org.apache.jackrabbit.core.query.lucene.constraint
Class ComparisonConstraint

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.constraint.SelectorBasedConstraint
      extended by org.apache.jackrabbit.core.query.lucene.constraint.ComparisonConstraint
All Implemented Interfaces:
Constraint, QueryObjectModelConstants
Direct Known Subclasses:
LikeConstraint

public class ComparisonConstraint
extends SelectorBasedConstraint
implements QueryObjectModelConstants

ComparisonConstraint implements a comparison constraint.


Field Summary
 
Fields inherited from interface org.apache.jackrabbit.spi.commons.query.jsr283.qom.QueryObjectModelConstants
JOIN_TYPE_INNER, JOIN_TYPE_LEFT_OUTER, JOIN_TYPE_RIGHT_OUTER, OPERATOR_EQUAL_TO, OPERATOR_GREATER_THAN, OPERATOR_GREATER_THAN_OR_EQUAL_TO, OPERATOR_LESS_THAN, OPERATOR_LESS_THAN_OR_EQUAL_TO, OPERATOR_LIKE, OPERATOR_NOT_EQUAL_TO, ORDER_ASCENDING, ORDER_DESCENDING
 
Constructor Summary
ComparisonConstraint(DynamicOperand operand1, int operator, Value operand2, SelectorImpl selector)
          Creates a new comparision constraint.
 
Method Summary
 boolean evaluate(ScoreNode[] row, Name[] selectorNames, EvaluationContext context)
          Evaluates this constraint for the given row.
protected  boolean evaluate(Value op1)
          Evaluates this constraint for the given dynamic operand value op1.
 
Methods inherited from class org.apache.jackrabbit.core.query.lucene.constraint.SelectorBasedConstraint
getSelector, getSelectorIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparisonConstraint

public ComparisonConstraint(DynamicOperand operand1,
                            int operator,
                            Value operand2,
                            SelectorImpl selector)
Creates a new comparision constraint.

Parameters:
operand1 - the dynamic operand.
operator - the operator.
operand2 - the static operand.
selector - the selector for this constraint.
Method Detail

evaluate

public boolean evaluate(ScoreNode[] row,
                        Name[] selectorNames,
                        EvaluationContext context)
                 throws IOException
Evaluates this constraint for the given row.

Specified by:
evaluate in interface Constraint
Parameters:
row - the current row of score nodes.
selectorNames - the selector names associated with row.
context - the evaluation context.
Returns:
true if the row satisfies the constraint, false otherwise.
Throws:
IOException - if an error occurs while evaluating the constraint.

evaluate

protected boolean evaluate(Value op1)
                    throws RepositoryException
Evaluates this constraint for the given dynamic operand value op1.

Parameters:
op1 - the current value of the dynamic operand.
Returns:
true if the given value satisfies the constraint.
Throws:
RepositoryException - if an error occurs while converting the values.


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