|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.query.optimize.RewriteAsRangeCriteria
@Immutable public class RewriteAsRangeCriteria
An optimizer rule
that rewrites two AND-ed
Constraint
s that constraint a dynamic
operand to a range of values as a single Between
constraint. This rule also collapses and removes any constraints that
are unnecessary because other constraints are more restrictive or because they cancel out other constraints.
Field Summary | |
---|---|
protected static Constraint |
CONFLICTING_CONSTRAINT
|
static RewriteAsRangeCriteria |
INSTANCE
|
Constructor Summary | |
---|---|
RewriteAsRangeCriteria()
|
Method Summary | |
---|---|
protected int |
compareStaticOperands(QueryContext context,
Comparison comparison1,
Comparison comparison2)
Compare the values used in the two comparisons |
PlanNode |
execute(QueryContext context,
PlanNode plan,
LinkedList<OptimizerRule> ruleStack)
Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules. |
protected Comparison |
getComparison(QueryContext context,
Comparison comparison1,
Comparison comparison2,
boolean smallest)
Get the comparison with the smallest (or largest) value. |
protected Object |
getValue(QueryContext context,
StaticOperand operand)
Get the value associated with the static operand of the comparison. |
protected void |
nullReference(List<Comparison> comparisons,
Comparison comparisonToNull)
Find all occurrences of the comparison object in the supplied list and null the list's reference to it. |
protected void |
nullReference(List<Comparison> comparisons,
Iterable<Comparison> comparisonsToNull)
Find all references in the supplied list that match those supplied and set them to null. |
protected Constraint |
rewrite(QueryContext context,
List<Comparison> comparisons)
Rewrite the supplied comparisons, returning the new constraint and nulling in the supplied list those comparisons that were rewritten (and leaving those that were not rewritten) |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final Constraint CONFLICTING_CONSTRAINT
public static final RewriteAsRangeCriteria INSTANCE
Constructor Detail |
---|
public RewriteAsRangeCriteria()
Method Detail |
---|
public PlanNode execute(QueryContext context, PlanNode plan, LinkedList<OptimizerRule> ruleStack)
execute
in interface OptimizerRule
context
- the context in which the query is being optimized; never nullplan
- the plan to be optimized; never nullruleStack
- the stack of rules that will be run after this rule; never null
OptimizerRule.execute(org.modeshape.graph.query.QueryContext,
org.modeshape.graph.query.plan.PlanNode, java.util.LinkedList)
public String toString()
toString
in class Object
Object.toString()
protected Constraint rewrite(QueryContext context, List<Comparison> comparisons)
context
- the query contextcomparisons
- the list of comparisons that sould be rewritten if possible; never null
protected void nullReference(List<Comparison> comparisons, Comparison comparisonToNull)
comparisons
- the collection in which null references are to be placedcomparisonToNull
- the comparison that is to be found and nulled in the collectionprotected void nullReference(List<Comparison> comparisons, Iterable<Comparison> comparisonsToNull)
comparisons
- the collection in which null references are to be placedcomparisonsToNull
- the comparisons that are to be found and nulled in the collectionprotected int compareStaticOperands(QueryContext context, Comparison comparison1, Comparison comparison2)
context
- the query context; may not be nullcomparison1
- the first comparison object; may not be nullcomparison2
- the second comparison object; may not be null
protected Comparison getComparison(QueryContext context, Comparison comparison1, Comparison comparison2, boolean smallest)
context
- the query context; may not be nullcomparison1
- the first comparison object; may not be nullcomparison2
- the second comparison object; may not be nullsmallest
- true if the comparison with the smallest value should be returned, or false otherwise
protected Object getValue(QueryContext context, StaticOperand operand)
variable
name
, the variable value is returned.
context
- the query context; may not be nulloperand
- the static operand; may not be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |