public class ViewExpressionComparisons extends Object
ViewExpression
with a ComparisonRange
on some of the
Element
s in its sort order.
A ViewExpressionComparisons
is an analogue of a ScanComparisons
that maintains information about which
elements in the sort order of a ViewExpression
correspond to each comparison. It maintains a list of
ComparisonRange
s for each of the elements. The matchWith(ElementPredicate)
method can then take
a ElementPredicate
and try to add it to the existing comparisons.
The ViewExpressionComparisons
encapsulates the core logic of marking parts of a complex key expression as
satisfied by various types of Comparisons.Comparison
s and attempting to match more comparisons to the
remaining parts of the expression. This includes the "virtual" Comparisons.SortComparison
which is used only
to represent requested sort orders for index planning.
While this sounds a lot like a whole query planner, the scope of a ViewExpressionComparisons
is intentionally
very limited. In particular, it supports matching with an ElementPredicate
rather than a more
general QueryPredicate
As a result, the logic for handling
Boolean operations and other complexities does not belong in ViewExpressionComparisons
.
Constructor and Description |
---|
ViewExpressionComparisons(ViewExpression viewExpression) |
Modifier and Type | Method and Description |
---|---|
int |
getUnmatchedFieldCount() |
boolean |
hasComparison(Source source) |
boolean |
hasOrderBySourceWithoutComparison() |
Optional<ViewExpressionComparisons> |
matchWith(ElementPredicate component) |
Optional<ViewExpressionComparisons> |
matchWithSort(List<Element> sortOrder) |
ScanComparisons |
toScanComparisons()
Convert these comparisons to
ScanComparisons for query execution. |
ViewExpressionComparisons |
withSourcesMappedInto(Source originalSource,
Source duplicateSource)
Replace the given duplicate source with the given original source everywhere that it occurs in these view
expression comparisons.
|
public ViewExpressionComparisons(@Nonnull ViewExpression viewExpression)
@Nonnull public Optional<ViewExpressionComparisons> matchWith(@Nonnull ElementPredicate component)
@Nonnull public Optional<ViewExpressionComparisons> matchWithSort(@Nonnull List<Element> sortOrder)
public int getUnmatchedFieldCount()
public boolean hasOrderBySourceWithoutComparison()
@Nonnull public ViewExpressionComparisons withSourcesMappedInto(@Nonnull Source originalSource, @Nonnull Source duplicateSource)
originalSource
- a source to replace all occurrences of the duplicate source withduplicateSource
- a source to replace with the original source@Nonnull public ScanComparisons toScanComparisons()
ScanComparisons
for query execution.ScanComparisons