no.sesat.search.query.token
Class AbstractEvaluatorFactory

java.lang.Object
  extended by no.sesat.search.query.token.AbstractEvaluatorFactory
Direct Known Subclasses:
FastQueryMatchingEvaluatorFactory, JepEvaluatorFactory, RegExpEvaluatorFactory, SolrEvaluatorFactory

public abstract class AbstractEvaluatorFactory
extends Object

EvaluatorFactory responsible to finding appropriate factory subclass to use given the context. Any implementing EvaluatorFactory provides two main methods isResponsibleFor(token) getEvaluator(token) which are used by primarily by the TokenEvaluationEngine to find applicable evaluators and to use them. SKER3540

Version:
$Id: AbstractEvaluatorFactory.java 7225 2009-04-09 00:32:20Z ssmiweve $

Nested Class Summary
static interface AbstractEvaluatorFactory.Context
          The context the RegExpEvaluatorFactory must work against.
 
Constructor Summary
protected AbstractEvaluatorFactory(AbstractEvaluatorFactory.Context context)
          All factory implementations must super to this in their constructor.
 
Method Summary
protected  AbstractEvaluatorFactory.Context getContext()
          Obtain the context we're working within.
abstract  TokenEvaluator getEvaluator(TokenPredicate token)
          If the evaluator is not found in this site it will fallback and look in the parent site.
static AbstractEvaluatorFactory instanceOf(AbstractEvaluatorFactory.Context cxt)
          find the appropriate factory subclass to use given the context.
 boolean isResponsibleFor(TokenPredicate token)
          Is the factory responsibe for evaluation of this TokenPredicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEvaluatorFactory

protected AbstractEvaluatorFactory(AbstractEvaluatorFactory.Context context)
                            throws SiteKeyedFactoryInstantiationException
All factory implementations must super to this in their constructor.

Parameters:
context - the supplied context to work within.
Throws:
SiteKeyedFactoryInstantiationException - if factory construction fails.
Method Detail

instanceOf

public static final AbstractEvaluatorFactory instanceOf(AbstractEvaluatorFactory.Context cxt)
find the appropriate factory subclass to use given the context.

Parameters:
cxt - supplied context.
Returns:
the appropriate factory subclass.

isResponsibleFor

public boolean isResponsibleFor(TokenPredicate token)
Is the factory responsibe for evaluation of this TokenPredicate. Default implementation checks that getEvaluator(..) does not return ALWAYS_FALSE_EVALUATOR

Parameters:
token - the TokenPredicate we're checking
Returns:
true if factory is responsible for evaluating the given TokenPredicate.

getEvaluator

public abstract TokenEvaluator getEvaluator(TokenPredicate token)
                                     throws EvaluationException
If the evaluator is not found in this site it will fallback and look in the parent site.

Parameters:
token - the predicate the evaluator is to be used for
Returns:
the TokenEvaluator to use. Or TokenEvaluationEngineImpl.ALWAYS_FALSE_EVALUATOR if not found.
Throws:
EvaluationException

getContext

protected final AbstractEvaluatorFactory.Context getContext()
Obtain the context we're working within.

Returns:
the context.


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.