no.sesat.search.query.parser
Class AbstractUnaryClause

java.lang.Object
  extended by no.sesat.search.query.parser.AbstractClause
      extended by no.sesat.search.query.parser.AbstractUnaryClause
All Implemented Interfaces:
Serializable, no.sesat.commons.visitor.Visitable, Clause, UnaryClause
Direct Known Subclasses:
AbstractBinaryClause, NotClauseImpl

public abstract class AbstractUnaryClause
extends AbstractClause
implements UnaryClause

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

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

Field Summary
protected  Clause firstClause
          The first clause of a binary clause, or the only clause of a UnaryClause.
 
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 AbstractUnaryClause(String term, Clause first, Set<TokenPredicate> knownPredicates, Set<TokenPredicate> possiblePredicates)
          Create clause with the given term, known and possible predicates.
 
Method Summary
static
<T extends AbstractUnaryClause>
T
createClause(Class<T> clauseClass, String term, Clause left, Clause right, TokenEvaluationEngine engine, no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
          Works off the assumption that OperationClause constructor's have the exact parameter list: final String term, final Clause left, final Clause right, final Set<Predicate> knownPredicates, final Set<Predicate> possiblePredicates Where this is true subclasses are free to use this helper method.
 Clause getFirstClause()
          Get the firstClause.
 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

firstClause

protected final Clause firstClause
The first clause of a binary clause, or the only clause of a UnaryClause.

Constructor Detail

AbstractUnaryClause

protected AbstractUnaryClause(String term,
                              Clause first,
                              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.
first -
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 AbstractUnaryClause> T createClause(Class<T> clauseClass,
                                                             String term,
                                                             Clause left,
                                                             Clause right,
                                                             TokenEvaluationEngine engine,
                                                             no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
Works off the assumption that OperationClause constructor's have the exact parameter list: final String term, final Clause left, final Clause right, final Set<Predicate> knownPredicates, final Set<Predicate> possiblePredicates Where this is true subclasses are free to use this helper method.

Parameters:
left - the left child clause for OperationClause the clause we are about to create (or find) will have.
right - the right child clause the clause we are about to create (or find) will have.
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.
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.

getFirstClause

public Clause getFirstClause()
Get the firstClause.

Specified by:
getFirstClause in interface UnaryClause
Returns:
the firstClause.

toString

public String toString()
Overrides:
toString in class AbstractClause


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