Class BetweenFilter
IFilter which compares the result of a member invocation with a value for "Between" condition.
Inherited Members
Namespace: Tangosol.Util.Filter
Assembly: Coherence.dll
Syntax
public class BetweenFilter : AndFilter, IIndexAwareFilter, IEntryFilter, IFilter, IPortableObject
Remarks
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 member 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.
Constructors
BetweenFilter()
Default constructor.
Declaration
public BetweenFilter()
BetweenFilter(string, double, double)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(string method, double from, double to)
Parameters
Type | Name | Description |
---|---|---|
string | method | The name of the member to invoke via reflection. |
double | from | The double value to compare the "Greater or Equals" boundary with. |
double | to | The double value to compare the "Less or Equals" boundary with. |
BetweenFilter(string, IComparable, IComparable)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(string method, IComparable from, IComparable to)
Parameters
Type | Name | Description |
---|---|---|
string | method | The name of the method to invoke via reflection. |
IComparable | from | The object to compare the "Greater or Equals" boundary with. |
IComparable | to | The object to compare the "Less or Equals" boundary with. |
BetweenFilter(string, IComparable, IComparable, bool, bool)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(string method, IComparable lower, IComparable upper, bool includeLower, bool includeUpper)
Parameters
Type | Name | Description |
---|---|---|
string | method | The name of the member to invoke via reflection. |
IComparable | lower | The lower bound of the range of values that evaluate to true |
IComparable | upper | The upper bound of the range of values that evaluate to true |
bool | includeLower | A flag indicating whether values matching the lower bound of the range evaluate to true |
bool | includeUpper | A flag indicating whether values matching the upper bound of the range evaluate to true |
BetweenFilter(string, int, int)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(string method, int from, int to)
Parameters
Type | Name | Description |
---|---|---|
string | method | The name of the method to invoke via reflection. |
int | from | The integer value to compare the "Greater or Equals" boundary with. |
int | to | The integer value to compare the "Less or Equals" boundary with. |
BetweenFilter(string, long, long)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(string method, long from, long to)
Parameters
Type | Name | Description |
---|---|---|
string | method | The name of the method to invoke via reflection. |
long | from | The long value to compare the "Greater or Equals" boundary with. |
long | to | The long value to compare the "Less or Equals" boundary with. |
BetweenFilter(string, float, float)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(string method, float from, float to)
Parameters
Type | Name | Description |
---|---|---|
string | method | The name of the method to invoke via reflection. |
float | from | The float value to compare the "Greater or Equals" boundary with. |
float | to | The float value to compare the "Less or Equals" boundary with. |
BetweenFilter(IValueExtractor, IComparable, IComparable)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(IValueExtractor extractor, IComparable from, IComparable to)
Parameters
Type | Name | Description |
---|---|---|
IValueExtractor | extractor | The IValueExtractor to use by this filter. |
IComparable | from | The object to compare the "Greater or Equals" boundary with. |
IComparable | to | The object to compare the "Less or Equals" boundary with. |
BetweenFilter(IValueExtractor, IComparable, IComparable, bool, bool)
Construct a BetweenFilter for testing "Between" condition.
Declaration
public BetweenFilter(IValueExtractor extractor, IComparable lower, IComparable upper, bool includeLower, bool includeUpper)
Parameters
Type | Name | Description |
---|---|---|
IValueExtractor | extractor | The IValueExtractor to use to extract values from the entry to evaluate |
IComparable | lower | The lower bound of the range of values that evaluate to true |
IComparable | upper | The upper bound of the range of values that evaluate to true |
bool | includeLower | A flag indicating whether values matching the lower bound of the range evaluate to true |
bool | includeUpper | A flag indicating whether values matching the upper bound of the range evaluate to true |
Properties
IsLowerBoundInclusive
Returns true if extracted values equal to the lower bound of the range evaluate to true.
Declaration
public virtual bool IsLowerBoundInclusive { get; }
Property Value
Type | Description |
---|---|
bool | True if extracted values equal to the lower bound of the range evaluate to true. |
IsUpperBoundInclusive
Returns true if extracted values equal to the upper bound of the range evaluate to true.
Declaration
public virtual bool IsUpperBoundInclusive { get; }
Property Value
Type | Description |
---|---|
bool | True if extracted values equal to the upper bound of the range evaluate to true. |
LowerBound
Gets the object to representing the lower bound of the range of values that evaluate to true
Declaration
public virtual IComparable LowerBound { get; }
Property Value
Type | Description |
---|---|
IComparable | The lower bound of the range of values to compare the extraction result with. |
UpperBound
Gets the object to representing the upper bound of the range of values that evaluate to true
Declaration
public virtual IComparable UpperBound { get; }
Property Value
Type | Description |
---|---|
IComparable | The upper bound of the range of values to compare the extraction result with. |
ValueExtractor
Obtain the IValueExtractor used by this filter.
Declaration
public virtual IValueExtractor ValueExtractor { get; }
Property Value
Type | Description |
---|---|
IValueExtractor | The IValueExtractor used by this filter. |
Methods
ApplyIndex(IDictionary, ICollection)
Filter remaining keys using an IDictionary of available indexes.
Declaration
public IFilter ApplyIndex(IDictionary indexes, ICollection keys)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | indexes | The available ICacheIndex objects keyed by the related IValueExtractor; read-only. |
ICollection | keys | The mutable set of keys that remain to be filtered. |
Returns
Type | Description |
---|---|
IFilter | An IFilter object that can be used to process the
remaining keys, or |
Remarks
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 IEntryFilter) 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.
CalculateEffectiveness(IDictionary, ICollection)
Given an IDictionary of available indexes, determine if this IIndexAwareFilter can use any of the indexes to assist in its processing, and if so, determine how effective the use of that index would be.
Declaration
public int CalculateEffectiveness(IDictionary indexes, ICollection keys)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | indexes | The available ICacheIndex objects keyed by the related IValueExtractor; read-only. |
ICollection | keys | The set of keys that will be filtered; read-only. |
Returns
Type | Description |
---|---|
int | An effectiveness estimate of how well this filter can use the specified indexes to filter the specified keys. |
Remarks
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 keys.size() then a user could avoid using the index and iterate through the keys calling Evaluate rather than ApplyIndex.
Evaluate(object)
Apply the test to the object.
Declaration
public virtual bool Evaluate(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o | An object to which the test is applied. |
Returns
Type | Description |
---|---|
bool | true if the test passes, false otherwise. |
EvaluateEntry(ICacheEntry)
Apply the test to an ICacheEntry.
Declaration
public virtual bool EvaluateEntry(ICacheEntry entry)
Parameters
Type | Name | Description |
---|---|---|
ICacheEntry | entry | The ICacheEntry to evaluate; never |
Returns
Type | Description |
---|---|
bool | true if the test passes, false otherwise. |
ToString()
Return a human-readable description for this ArrayFilter.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string description of the ArrayFilter. |