public abstract class Refinement<T>
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Refinement.Clause<T>
The Clause class describes a clause within a Refinement, which
can have one or more clauses.
|
Modifier | Constructor and Description |
---|---|
protected |
Refinement(java.util.List<Refinement.Clause<T>> clauses,
int count)
Creates a Refinement with a List of Refinement.Clause objects
and a count of how many results are expected to return
these clauses are applied.
|
protected |
Refinement(T value,
int count)
Creates a Refinement with a value of type T and a count
of how many results applying this Refinement will be
expected to return.
|
protected |
Refinement(T value,
java.lang.String comparator,
int count)
Creates a Refinement with a value of type T a comparator,
and a count of how many results applying this Refinement
will be expected to return.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAttributePredicate(java.util.List<Predicate> children,
AttributePredicate<T> newPredicate)
Subclasses should normalize the list of AttributePredicate<T>
by overriding this method.
|
protected void |
buildName(java.util.List<Refinement.Clause<T>> clauses)
Delegate to subclasses to build the name of the Refinement
given a list of clauses.
|
protected void |
buildName(Refinement.Clause<T> clause)
Delegate to subclasses to build the name of the Refinement
given a clause.
|
protected abstract void |
buildName(T value)
Let the subclass build the name based on a type T that
the subclass will know.
|
protected AttributePredicate<T> |
createPredicate(QName name,
java.lang.String comparator,
T value) |
protected java.util.List<Refinement.Clause<T>> |
getClauses()
Returns the list of clauses held within
this Refinement.
|
abstract ComplexPredicate.ConjunctionOp |
getConjunctionOp()
Gets the conjunction operator that can be used
to chain clauses produced by this Refinement.
|
int |
getCount()
Gets the number of results expected
to return when this Refinement is applied.
|
java.lang.String |
getName()
Gets the display name of this Refinement.
|
T |
getValue()
Gets the value to compare against in the first clause
of this Refinement.
|
abstract boolean |
hasMatch(T value)
Different types have different interpretations of hasMatch.
|
void |
increment()
Increment the count of this Refinement.
|
void |
increment(int count)
Increment the count of this Refinement by a certain
amount.
|
protected java.util.List<Refinement.Clause<T>> |
initClauses(T value,
java.lang.String comparator) |
boolean |
isCurrent()
Is this the current refinement?
|
void |
refine(Refiner<T> refiner,
ComplexPredicate topPredicate)
Allows for refining a Query object.
|
void |
setCount(int count)
Sets the number of results expected
to return when this Refinement is applied.
|
void |
setCurrent(boolean value)
Indicate if this is the current refinement
|
void |
setName(java.lang.String name)
Sets the display name of the Refinement.
|
java.lang.String |
toString() |
protected Refinement(T value, int count)
value
- a value of type T to compare against
with an EQUALS comparator valuecount
- the number of results expected to return
when this Refinement is appliedprotected Refinement(T value, java.lang.String comparator, int count)
value
- a value of type T to compare againstcomparator
- the String comparator to use for comparison
taken from ComparatorConstantscount
- the number of results expected to return
when this Refinement is appliedprotected Refinement(java.util.List<Refinement.Clause<T>> clauses, int count)
clauses
- the List of Refinement.Clause objects
each representing a comparisoncount
- the number of results expected to return
when this Refinement is appliedprotected java.util.List<Refinement.Clause<T>> initClauses(T value, java.lang.String comparator)
protected java.util.List<Refinement.Clause<T>> getClauses()
protected void buildName(java.util.List<Refinement.Clause<T>> clauses)
clauses
- the List of Refinement.Clause objects that
subclasses can use to build the name of the Refinementprotected void buildName(Refinement.Clause<T> clause)
clause
- the Refinement.Clause objects that
subclasses can use to build the name of the Refinementprotected abstract void buildName(T value)
value
- a value of type T that a subclass will use
to build the name for the Refinementpublic abstract boolean hasMatch(T value)
value
- a value to match the clauses defined in this classpublic void refine(Refiner<T> refiner, ComplexPredicate topPredicate) throws ContradictionException
topPredicate
- the Predicate object being modifiedrefiner
- holder of Refinements that may affect the topPredicateContradictionException
- when the act of refining causes
a contradiction to occur in the ComplexPredicate.protected AttributePredicate<T> createPredicate(QName name, java.lang.String comparator, T value)
protected void addAttributePredicate(java.util.List<Predicate> children, AttributePredicate<T> newPredicate) throws ContradictionException
children
- the children of the top level ComplexPredicate to refinenewPredicate
- the new AttributePredicate<T> to add.ContradictionException
public abstract ComplexPredicate.ConjunctionOp getConjunctionOp()
public T getValue()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- the name to setpublic int getCount()
public void setCount(int count)
count
- an integer that estimates the number
of results expected after applicationpublic void increment()
public void increment(int count)
count
- the count to add to the current countpublic void setCurrent(boolean value)
public boolean isCurrent()
public java.lang.String toString()
toString
in class java.lang.Object