no.sesat.search.query.parser
Class AbstractLeafClause

java.lang.Object
  extended by no.sesat.search.query.parser.AbstractClause
      extended by no.sesat.search.query.parser.AbstractLeafClause
All Implemented Interfaces:
Serializable, no.sesat.commons.visitor.Visitable, Clause, LeafClause
Direct Known Subclasses:
EmailClauseImpl, IntegerClauseImpl, NumberGroupClauseImpl, PhoneNumberClauseImpl, PhraseClauseImpl, UrlClauseImpl, WordClauseImpl

public abstract class AbstractLeafClause
extends AbstractClause
implements LeafClause

Basic implementation of the LeafClause interface. Implements ontop of AbstractClause. Objects of this class are immutable

Version:
$Id: AbstractLeafClause.java 7225 2009-04-09 00:32:20Z ssmiweve $
See Also:
Serialized Form

Field Summary
protected  String field
          TODO comment me.
 
Fields inherited from class no.sesat.search.query.parser.AbstractClause
DFAULT_REFERENCE_MAP_TYPE, ERR_FAILED_FINDING_OR_USING_CONSTRUCTOR, ERR_MUST_ALWAYS_USE_ARGED_CONSTRUCTOR
 
Constructor Summary
protected AbstractLeafClause(String term, String field, Set<TokenPredicate> knownPredicates, Set<TokenPredicate> possiblePredicates)
          Create clause with the given term, known and possible predicates.
 
Method Summary
static
<T extends AbstractLeafClause>
T
createClause(Class<T> clauseClass, String term, String field, TokenEvaluationEngine engine, no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
          Works off the assumption that LeafClause constructor's have the exact parameter list: final String term, final String field, final Set<Predicate> knownPredicates, final Set<Predicate> possiblePredicates Where this is true subclasses are free to use this helper method.
 String getField()
          Get the field.
 String toString()
           
 
Methods inherited from class no.sesat.search.query.parser.AbstractClause
accept, addClauseInUse, findClauseInUse, findPredicates, getKnownPredicates, getPossiblePredicates, getTerm, hashCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface no.sesat.search.query.Clause
getKnownPredicates, getPossiblePredicates, getTerm
 
Methods inherited from interface no.sesat.commons.visitor.Visitable
accept
 

Field Detail

field

protected final String field
TODO comment me.

Constructor Detail

AbstractLeafClause

protected AbstractLeafClause(String term,
                             String field,
                             Set<TokenPredicate> knownPredicates,
                             Set<TokenPredicate> possiblePredicates)
Create clause with the given term, known and possible predicates.

Parameters:
term - the term (query string) for this clause.
field -
knownPredicates - the set of known predicates for this clause.
possiblePredicates - the set of possible predicates for this clause.
Method Detail

createClause

public static <T extends AbstractLeafClause> T createClause(Class<T> clauseClass,
                                                            String term,
                                                            String field,
                                                            TokenEvaluationEngine engine,
                                                            no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
Works off the assumption that LeafClause constructor's have the exact parameter list: final String term, final String field, final Set<Predicate> knownPredicates, final Set<Predicate> possiblePredicates Where this is true subclasses are free to use this helper method.

Type Parameters:
T - specific type of AbstractLeafClause
Parameters:
clauseClass - the exact subclass of AbstracLeafClause that we are about to create (or find already in use).
term - the term the clause we are about to create (or find) will have.
field - the field the clause we are about to create (or find) will have.
engine - the factory handing out evaluators against TokenPredicates. Also holds state information about the current term/clause we are finding predicates against.
weakCache - the map containing the key to WeakReference (of the Clause) mappings.
Returns:
Either a clause already in use that matches this term and field, or a newly created cluase for this term and field.

getField

public String getField()
Get the field.

Specified by:
getField in interface LeafClause
Returns:
the field.

toString

public String toString()
Overrides:
toString in class AbstractClause


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