|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectno.sesat.search.query.parser.AbstractClause
public abstract class AbstractClause
Basic implementation of the Clause interface. Provides basic implementation of the predicates lists, defaulting to empty lists. Also provides weak reference hashmaps to keep record and reuse the Clauses already in use in the JVM. Objects of this class are immutable
| Field Summary | |
|---|---|
static no.sesat.commons.ref.ReferenceMap.Type |
DFAULT_REFERENCE_MAP_TYPE
|
protected static String |
ERR_FAILED_FINDING_OR_USING_CONSTRUCTOR
Error message when reflection cannot find the required constructor. |
protected static String |
ERR_MUST_ALWAYS_USE_ARGED_CONSTRUCTOR
Error message when trying to use the incorrect constructor. |
| Constructor Summary | |
|---|---|
protected |
AbstractClause(String term,
Set<TokenPredicate> knownPredicates,
Set<TokenPredicate> possiblePredicates)
Create clause with the given term, known and possible predicates. |
| Method Summary | ||
|---|---|---|
void |
accept(no.sesat.commons.visitor.Visitor visitor)
|
|
protected static
|
addClauseInUse(String key,
T clause,
no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
Note there is an identical and immutable Clause ready to use in the JVM. |
|
protected static
|
findClauseInUse(String key,
no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
See if there is an identical and immutable Clause already in use in the JVM. |
|
protected static boolean |
findPredicates(TokenEvaluationEngine engine)
Find the predicates that are applicable to the clause. |
|
Set<TokenPredicate> |
getKnownPredicates()
Get the set of knownPredicates for this Clause. |
|
Set<TokenPredicate> |
getPossiblePredicates()
Get the set of possiblePredicates for this Clause. |
|
String |
getTerm()
Get the term for this Clause. |
|
int |
hashCode()
Provide a replicatable hashCode so the same segment inside the ConcurrentHashMap is used for any accidently duplicate created clauses. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final String ERR_FAILED_FINDING_OR_USING_CONSTRUCTOR
protected static final String ERR_MUST_ALWAYS_USE_ARGED_CONSTRUCTOR
public static final no.sesat.commons.ref.ReferenceMap.Type DFAULT_REFERENCE_MAP_TYPE
| Constructor Detail |
|---|
protected AbstractClause(String term,
Set<TokenPredicate> knownPredicates,
Set<TokenPredicate> possiblePredicates)
term - the term (query string) for this clause.knownPredicates - the set of known predicates for this clause.possiblePredicates - the set of possible predicates for this clause.| Method Detail |
|---|
protected static final <T extends AbstractClause> T findClauseInUse(String key,
no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
T - key - the unique (for this AbstractClause subtype) key for the Clause we are looking for.weakCache - the map containing the key to WeakReference (of the Clause) mappings.
null.
protected static final <T extends AbstractClause> T addClauseInUse(String key,
T clause,
no.sesat.commons.ref.ReferenceMap<String,T> weakCache)
T - key - the unique (for this AbstractClause subtype) key
for the Clause we are about to add to the mappings.clause - the Clause we are about to add to the mappings.weakCache - the map containing the key to WeakReference (of the Clause) mappings.
protected static final boolean findPredicates(TokenEvaluationEngine engine)
knownPredicates.
Add possible (requires further checking against the whole query heirarchy)
predicates to possiblePredicates.
engine - the factory handing out evaluators against TokenPredicates.
Also holds state information about the current term/clause we are finding predicates against.
to the current clause we are finding predicates for.
public String getTerm()
getTerm in interface Clausepublic Set<TokenPredicate> getKnownPredicates()
getKnownPredicates in interface Clausepublic Set<TokenPredicate> getPossiblePredicates()
getPossiblePredicates in interface Clausepublic void accept(no.sesat.commons.visitor.Visitor visitor)
accept in interface no.sesat.commons.visitor.Visitablepublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||