org.apache.directory.server.xdbm.search
Interface Evaluator<N extends org.apache.directory.shared.ldap.filter.ExprNode,E>

All Known Implementing Classes:
AndEvaluator, ApproximateEvaluator, EqualityEvaluator, GreaterEqEvaluator, LessEqEvaluator, NotEvaluator, OneLevelScopeEvaluator, OrEvaluator, PresenceEvaluator, SubstringEvaluator, SubtreeScopeEvaluator

public interface Evaluator<N extends org.apache.directory.shared.ldap.filter.ExprNode,E>

Evaluates candidate entries to see if they match a filter expression. Evaluators contain various overloads to the evaluate method. Often a developer working in this region of the code may wonder when to use one override verses another. The overload taking an IndexEntry argument is specifically suited for use when there is the possibility of multiple entry lookups from the master table. If the same candidate in the form of an IndexEntry is evaluated more then this overload is more efficient since it stores the looked up entry in the IndexEntry preventing multiple lookups. If the index entry is already populated with an entry object, and some evaluation is required then it is preferrable to use the overload that takes a Long id instead. Likewise if it is known in advance that the expression is a leaf node built on an indexed attribute then the overload with the Long id argument is also preferrable unless an IndexEntry already exists in which case it makes no difference. The overload taking the ServerEntry itself is a last resort option and ok to use when it is known that no index exists for the attributes of Evaluators based on leaf expressions.

Version:
$Rev: 656489 $
Author:
Apache Directory Project

Method Summary
 boolean evaluate(E entry)
          Evaluates whether or not a candidate, satisfies the expression associated with this Evaluator .
 boolean evaluate(IndexEntry<?,E> entry)
          Evaluates a candidate to determine if a filter expression selects it.
 boolean evaluate(java.lang.Long id)
          Evaluates whether or not a candidate, specified by an id, satisfies the expression associated with this Evaluator .
 N getExpression()
          Gets the expression used by this expression Evaluator.
 

Method Detail

evaluate

boolean evaluate(IndexEntry<?,E> entry)
                 throws java.lang.Exception
Evaluates a candidate to determine if a filter expression selects it. If an IndexEntry does has a null reference to the entry object, this Evaluator may set it if it has to access the full entry within the master table of the store. Subsequent evaluations on the IndexEntry then need not access the store to retreive the entry if they need to access it's attributes.

Parameters:
entry - the index record of the entry to evaluate
Returns:
true if filter selects the candidate false otherwise
Throws:
java.lang.Exception - if there are faults during evaluation

evaluate

boolean evaluate(java.lang.Long id)
                 throws java.lang.Exception
Evaluates whether or not a candidate, specified by an id, satisfies the expression associated with this Evaluator .

Parameters:
id - the identifier for the candidate entry
Returns:
true if filter selects the candidate false otherwise
Throws:
java.lang.Exception - if there are faults during evaluation

evaluate

boolean evaluate(E entry)
                 throws java.lang.Exception
Evaluates whether or not a candidate, satisfies the expression associated with this Evaluator .

Parameters:
entry - the candidate entry
Returns:
true if filter selects the candidate false otherwise
Throws:
java.lang.Exception - if there are faults during evaluation

getExpression

N getExpression()
Gets the expression used by this expression Evaluator.

Returns:
the AST for the expression


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.