|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.BitHelper
com.tangosol.util.ExternalizableHelper
com.tangosol.util.filter.ArrayFilter
com.tangosol.util.filter.AllFilter
com.tangosol.util.filter.AndFilter
com.tangosol.util.filter.BetweenFilter
public class BetweenFilter
Filter which compares the result of a method invocation with a value for "Between" condition. We use the standard ISO/IEC 9075:1992 semantic, according to which "X between Y and Z" is equivalent to "X >= Y && X <= Z". In a case when either result of a method invocation or a value to compare are equal to null, the evaluate test yields false. This approach is equivalent to the way the NULL values are handled by SQL.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.tangosol.util.filter.ArrayFilter |
---|
ArrayFilter.WeightedFilter |
Field Summary | |
---|---|
static int |
EVAL_COST The evaluation cost as a factor to the single index access operation. |
Fields inherited from class com.tangosol.util.filter.ArrayFilter |
---|
m_aFilter |
Constructor Summary | |
---|---|
BetweenFilter() Default constructor (necessary for serialization). |
|
BetweenFilter(java.lang.String sMethod, java.lang.Comparable oFrom, java.lang.Comparable oTo) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(java.lang.String sMethod, java.lang.Comparable oLowerBound, java.lang.Comparable oUpperBound, boolean fIncludeLowerBound, boolean fIncludeUpperBound) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(java.lang.String sMethod, double dFrom, double dTo) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(java.lang.String sMethod, float fFrom, float fTo) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(java.lang.String sMethod, int iFrom, int iTo) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(java.lang.String sMethod, long lFrom, long lTo) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(ValueExtractor extractor, java.lang.Comparable oFrom, java.lang.Comparable oTo) Construct a BetweenFilter for testing "Between" condition. |
|
BetweenFilter(ValueExtractor extractor, java.lang.Comparable oLowerBound, java.lang.Comparable oUpperBound, boolean fIncludeLowerBound, boolean fIncludeUpperBound) Construct a BetweenFilter for testing "Between" condition. |
Method Summary | |
---|---|
Filter |
applyIndex(java.util.Map mapIndexes, java.util.Set setKeys) Filter remaining keys using a Map of available indexes. |
protected void |
applySortedIndex(java.util.Set setKeys, java.util.SortedMap mapInverted) Called by the applyIndex(java.util.Map, java.util.Set) method if the index corresponding to this filter's value extractor is a sorted index. |
int |
calculateEffectiveness(java.util.Map mapIndexes, java.util.Set setKeys) Given a Map of available indexes, determine if this IndexAwareFilter can use any of the indexes to assist in its processing, and if so, determine how effective the use of that index would be. |
boolean |
evaluate(java.lang.Object oTarget) Apply the test to the object. |
boolean |
evaluateEntry(java.util.Map.Entry entry) Apply the test to a Map Entry. |
protected boolean |
evaluateEntry(java.util.Map.Entry entry, QueryContext ctx, QueryRecord.PartialResult.TraceStep step) Check if the given entry passes the filter's evaluation. |
protected boolean |
evaluateExtracted(java.lang.Object oExtracted) Evaluate the specified extracted value. |
void |
explain(QueryContext ctx, QueryRecord.PartialResult.ExplainStep step, java.util.Set setKeys) Record the projected query execution cost by this filter. |
java.lang.Comparable |
getLowerBound() Obtain the lower bound of the range being used to evaluate values by this BetweenFilter. |
java.lang.Comparable |
getUpperBound() Obtain the upper bound of the range being used to evaluate values by this BetweenFilter. |
ValueExtractor |
getValueExtractor() Obtain the ValueExtractor used by this filter. |
boolean |
isLowerBoundInclusive() Obtain the flag indicating whether values matching the lower bound of the range evaluate to true. |
boolean |
isUpperBoundInclusive() Obtain the flag indicating whether values matching the upper bound of the range evaluate to true. |
java.lang.String |
toString() Return a human-readable description for this Filter. |
boolean |
trace(QueryContext ctx, QueryRecord.PartialResult.TraceStep step, java.util.Map.Entry entry) Evaluate the specified entry against this filter and record the evaluation cost on the given step of the QueryRecord . |
Filter |
trace(QueryContext ctx, QueryRecord.PartialResult.TraceStep step, java.util.Set setKeys) Filter the given keys using available indexes and record the cost of execution on the given step of the QueryRecord . |
Methods inherited from class com.tangosol.util.filter.AllFilter |
---|
applyIndex |
Methods inherited from class com.tangosol.util.filter.ArrayFilter |
---|
applyFilter, calculateFilters, equals, evaluateFilter, getFilters, hashCode, readExternal, readExternal, writeExternal, writeExternal |
Methods inherited from class com.tangosol.util.BitHelper |
---|
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString |
Field Detail |
---|
public static int EVAL_COST
IndexAwareFilter.calculateEffectiveness(Map, Set)
Constructor Detail |
---|
public BetweenFilter()
public BetweenFilter(java.lang.String sMethod, java.lang.Comparable oFrom, java.lang.Comparable oTo)
sMethod
- the name of the method to invoke via reflectionoFrom
- the object to compare the "Greater or Equals" boundary withoTo
- the object to compare the "Less or Equals" boundary withpublic BetweenFilter(ValueExtractor extractor, java.lang.Comparable oFrom, java.lang.Comparable oTo)
extractor
- the ValueExtractor to use by this filteroFrom
- the object to compare the "Greater or Equals" boundary withoTo
- the object to compare the "Less or Equals" boundary withpublic BetweenFilter(java.lang.String sMethod, int iFrom, int iTo)
sMethod
- the name of the method to invoke via reflectioniFrom
- the integer value to compare the "Greater or Equals" boundary withiTo
- the integer value to compare the "Less or Equals" boundary withpublic BetweenFilter(java.lang.String sMethod, long lFrom, long lTo)
sMethod
- the name of the method to invoke via reflectionlFrom
- the long value to compare the "Greater or Equals" boundary withlTo
- the long value to compare the "Less or Equals" boundary withpublic BetweenFilter(java.lang.String sMethod, float fFrom, float fTo)
sMethod
- the name of the method to invoke via reflectionfFrom
- the float value to compare the "Greater or Equals" boundary withfTo
- the float value to compare the "Less or Equals" boundary withpublic BetweenFilter(java.lang.String sMethod, double dFrom, double dTo)
sMethod
- the name of the method to invoke via reflectiondFrom
- the double value to compare the "Greater or Equals" boundary withdTo
- the double value to compare the "Less or Equals" boundary withpublic BetweenFilter(java.lang.String sMethod, java.lang.Comparable oLowerBound, java.lang.Comparable oUpperBound, boolean fIncludeLowerBound, boolean fIncludeUpperBound)
sMethod
- the name of the method to invoke via reflectionoLowerBound
- the lower bound of the rangeoUpperBound
- the upper bound of the rangefIncludeLowerBound
- a flag indicating whether values matching the lower bound evaluate to truefIncludeUpperBound
- a flag indicating whether values matching the upper bound evaluate to truepublic BetweenFilter(ValueExtractor extractor, java.lang.Comparable oLowerBound, java.lang.Comparable oUpperBound, boolean fIncludeLowerBound, boolean fIncludeUpperBound)
extractor
- the ValueExtractor
to be used by this filteroLowerBound
- the lower bound of the rangeoUpperBound
- the upper bound of the rangefIncludeLowerBound
- a flag indicating whether values matching the lower bound evaluate to truefIncludeUpperBound
- a flag indicating whether values matching the upper bound evaluate to trueMethod Detail |
---|
public ValueExtractor getValueExtractor()
public java.lang.Comparable getLowerBound()
public java.lang.Comparable getUpperBound()
public boolean isLowerBoundInclusive()
public boolean isUpperBoundInclusive()
public boolean evaluate(java.lang.Object oTarget)
evaluate
in interface Filter
evaluate
in class AllFilter
oTarget
- the object to testpublic boolean evaluateEntry(java.util.Map.Entry entry)
evaluateEntry
in interface EntryFilter
evaluateEntry
in class ArrayFilter
entry
- the Map Entry to evaluate; never nullprotected boolean evaluateEntry(java.util.Map.Entry entry, QueryContext ctx, QueryRecord.PartialResult.TraceStep step)
evaluateEntry
in class AllFilter
entry
- a key value pair to filterctx
- the query ctx; may be nullstep
- the step used to record the execution costpublic Filter applyIndex(java.util.Map mapIndexes, java.util.Set setKeys)
The filter is responsible for removing all keys from the passed set of keys that the applicable indexes can prove should be filtered. If the filter does not fully evaluate the remaining keys using just the index information, it must return a filter (which may be an EntryFilter
) that can complete the task using an iterating implementation. If, on the other hand, the filter does fully evaluate the remaining keys using just the index information, then it should return null to indicate that no further filtering is necessary.
applyIndex
in interface IndexAwareFilter
applyIndex
in class ArrayFilter
mapIndexes
- the available MapIndex
objects keyed by the related ValueExtractor; read-onlysetKeys
- the mutable set of keys that remain to be filteredFilter
object (which may be an EntryFilter
) that can be used to process the remaining keys, or null if no additional filter processing is necessarypublic int calculateEffectiveness(java.util.Map mapIndexes, java.util.Set setKeys)
The returned value is an effectiveness estimate of how well this filter can use the specified indexes to filter the specified keys. An operation that requires no more than a single access to the index content (i.e. Equals, NotEquals) has an effectiveness of one. Evaluation of a single entry is assumed to have an effectiveness that depends on the index implementation and is usually measured as a constant number of the single operations. This number is referred to as evaluation cost.
If the effectiveness of a filter evaluates to a number larger than the keySet.size() * <evaluation cost> then a user could avoid using the index and iterate through the keySet calling evaluate rather then applyIndex.
calculateEffectiveness
in interface IndexAwareFilter
calculateEffectiveness
in class AllFilter
mapIndexes
- the available MapIndex
objects keyed by the related ValueExtractor; read-onlysetKeys
- the set of keys that will be filtered; read-onlypublic void explain(QueryContext ctx, QueryRecord.PartialResult.ExplainStep step, java.util.Set setKeys)
This method is expected to record the order of execution and estimated cost of applying corresponding indexes in the given step
without actually applying any indexes or evaluating entries.
explain
in interface QueryRecorderFilter
explain
in class ArrayFilter
ctx
- the query contextstep
- the step used to record the estimated execution costsetKeys
- the set of keys that would be filteredpublic Filter trace(QueryContext ctx, QueryRecord.PartialResult.TraceStep step, java.util.Set setKeys)
QueryRecord
.
This method should record the size of the given key set before and after applying corresponding indexes using QueryRecord.PartialResult.RecordableStep.recordPreFilterKeys(int)
and QueryRecord.PartialResult.TraceStep.recordPostFilterKeys(int)
as well as the corresponding execution time using the QueryRecord.PartialResult.TraceStep.recordDuration(long)
method.
This method is only called if the filter is an IndexAwareFilter
and its implementations should explicitly call applyIndex()
to actually perform the query. Additionally, this method should return the filter object (if any) returned by the applyIndex() call.
trace
in interface QueryRecorderFilter
trace
in class ArrayFilter
ctx
- the query contextstep
- the step used to record the execution costsetKeys
- the mutable set of keys that remain to be filteredIndexAwareFilter.applyIndex(Map, Set)
public boolean trace(QueryContext ctx, QueryRecord.PartialResult.TraceStep step, java.util.Map.Entry entry)
QueryRecord
.
This method should record the corresponding latencies using QueryRecord.PartialResult.TraceStep.recordDuration(long)
.
Implementations are responsible for explicitly calling evaluateEntry()
method to perform the actual entry evaluation. Additionally, this method should return the result of the evaluateEntry call.
trace
in interface QueryRecorderFilter
trace
in class ArrayFilter
ctx
- the contextstep
- the step used to record the evaluation costentry
- the entry to evaluateEntryFilter.evaluateEntry(Map.Entry)
public java.lang.String toString()
toString
in class ArrayFilter
protected boolean evaluateExtracted(java.lang.Object oExtracted)
oExtracted
- an extracted value to evaluateprotected void applySortedIndex(java.util.Set setKeys, java.util.SortedMap mapInverted)
applyIndex(java.util.Map, java.util.Set)
method if the index corresponding to this filter's value extractor is a sorted index.setKeys
- the set of keys of the entries being filteredmapInverted
- the index to apply
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |