private final CompositeAccessStrategy strategy;
private CompositeIndexQuery next;
public CompositeIndexQueryRange(boolean isNWOnTrigger, int lookupStream, int numStreams, SubordPropRangeKey subqRangeKey, Class coercionType, List<String> expressionTexts) {
QueryGraphValueEntryRange rangeProp = subqRangeKey.getRangeInfo();
if (rangeProp.getType().isRange()) {
QueryGraphValueEntryRangeIn rangeIn = (QueryGraphValueEntryRangeIn) rangeProp;
ExprEvaluator start = rangeIn.getExprStart().getExprEvaluator();
expressionTexts.add(ExprNodeUtility.toExpressionStringMinPrecedence(rangeIn.getExprStart()));
boolean includeStart = rangeProp.getType().isIncludeStart();
ExprEvaluator end = rangeIn.getExprEnd().getExprEvaluator();
expressionTexts.add(ExprNodeUtility.toExpressionStringMinPrecedence(rangeIn.getExprEnd()));
boolean includeEnd = rangeProp.getType().isIncludeEnd();
if (!rangeProp.getType().isRangeInverted()) {
strategy = new CompositeAccessStrategyRangeNormal(isNWOnTrigger, lookupStream, numStreams, start, includeStart, end, includeEnd, coercionType, ((QueryGraphValueEntryRangeIn) rangeProp).isAllowRangeReversal());
}
else {
strategy = new CompositeAccessStrategyRangeInverted(isNWOnTrigger, lookupStream, numStreams, start, includeStart, end, includeEnd, coercionType);
}
}
else {
QueryGraphValueEntryRangeRelOp relOp = (QueryGraphValueEntryRangeRelOp) rangeProp;
ExprEvaluator key = relOp.getExpression().getExprEvaluator();
expressionTexts.add(ExprNodeUtility.toExpressionStringMinPrecedence(relOp.getExpression()));
if (rangeProp.getType() == QueryGraphRangeEnum.GREATER_OR_EQUAL) {
strategy = new CompositeAccessStrategyGE(isNWOnTrigger, lookupStream, numStreams, key, coercionType);
}
else if (rangeProp.getType() == QueryGraphRangeEnum.GREATER) {
strategy = new CompositeAccessStrategyGT(isNWOnTrigger, lookupStream, numStreams, key, coercionType);
}
else if (rangeProp.getType() == QueryGraphRangeEnum.LESS_OR_EQUAL) {
strategy = new CompositeAccessStrategyLE(isNWOnTrigger, lookupStream, numStreams, key, coercionType);
}
else if (rangeProp.getType() == QueryGraphRangeEnum.LESS) {
strategy = new CompositeAccessStrategyLT(isNWOnTrigger, lookupStream, numStreams, key, coercionType);
}
else {
throw new IllegalArgumentException("Comparison operator " + rangeProp.getType() + " not supported");
}
}
}