Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.3.0)

E80355-01

ComparisonFilter Class Reference

#include <coherence/util/filter/ComparisonFilter.hpp>

Inherits ExtractorFilter.

Inherited by ContainsAllFilter, ContainsAnyFilter, ContainsFilter, EqualsFilter, GreaterEqualsFilter, GreaterFilter, InFilter, LessEqualsFilter, LessFilter, LikeFilter, and NotEqualsFilter.

List of all members.


Detailed Description

Filter which compares the result of a method invocation with a value.

Author:
djl 2008.03.02

Public Types

typedef spec::Handle Handle
 ComparisonFilter Handle definition.
typedef spec::View View
 ComparisonFilter View definition.
typedef spec::Holder Holder
 ComparisonFilter Holder definition.

Public Member Functions

virtual void readExternal (PofReader::Handle hIn)
 
virtual void writeExternal (PofWriter::Handle hOut) const
 
virtual bool equals (Object::View v) const
 
virtual size32_t hashCode () const
 Return a hash code value for the Object.

This method is supported for the benefit of hash-based containers.

The general contract of hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object

virtual TypedHandle
< const String
toString () const
 Output a human-readable description of this Object to the given stream.

Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toString method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents and is generally how toString() will be implemented.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::View vs = COH_TO_STRING(vKey << " = " << vValue);

The COH_TO_STRING macro is also the most common way to implement the toString method. For example:

 virtual TypedHandle<const String> Person::toString() const
     {
     return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN);
     }

Returns:
a string representation of this object

virtual Object::View getValue () const
 Get the object to compare the reflection result with.

Static Public Member Functions

static int32_t calculateIteratorEffectiveness (int32_t cKeys)
 Helper method to calculate effectiveness (or rather ineffectiveness) of a simple iteration against a key set that has to be performed due to an absence of corresponding index.

Protected Member Functions

 ComparisonFilter ()
 Default constructor (necessary for the ExternalizableLite interface).
 ComparisonFilter (ValueExtractor::View vValueExtractor, Object::View vObject)
 Construct a ComparisonFilter.
virtual int32_t calculateMatchEffectiveness (Map::View vMapIndexes, Set::View vSetKeys) const
 Helper method to calculate effectiveness for ComparisonFilters that need no more than a single index match in order to retrieve all necessary keys to perform the applyIndex() operation.
virtual int32_t calculateRangeEffectiveness (Map::View vMapIndexes, Set::View vSetKeys) const
 Helper method to calculate effectiveness for ComparisonFilters that need a range of values from an index in order to retrieve all necessary keys to perform the applyIndex() operation.

Protected Attributes

FinalView< Objectf_vValue
 The value to compare to.

Constructor & Destructor Documentation

ComparisonFilter ( ValueExtractor::View  vValueExtractor,
Object::View  vObject 
) [protected]

Construct a ComparisonFilter.

Parameters:
vExtractor the ComparisonFilter to use by this filter
vObject the object to compare the result with


Member Function Documentation

virtual int32_t calculateMatchEffectiveness ( Map::View  vMapIndexes,
Set::View  vSetKeys 
) const [protected, virtual]

Helper method to calculate effectiveness for ComparisonFilters that need no more than a single index match in order to retrieve all necessary keys to perform the applyIndex() operation.

Such filters are: Contains, Equals, NotEquals.

Parameters:
vMapIndexes the available MapIndex objects keyed by the related ValueExtractor; read-only
vSetKeys the set of keys that will be filtered; read-only
Returns:
an effectiveness estimate of how well this filter can use the specified indexes to filter the specified keys

virtual int32_t calculateRangeEffectiveness ( Map::View  vMapIndexes,
Set::View  vSetKeys 
) const [protected, virtual]

Helper method to calculate effectiveness for ComparisonFilters that need a range of values from an index in order to retrieve all necessary keys to perform the applyIndex() operation.

Such filters are: Less, LessEquals, Greater, GreaterEquals.

Parameters:
vMapIndexes the available MapIndex objects keyed by the related ValueExtractor; read-only
vSetKeys the set of keys that will be filtered; read-only
Returns:
an effectiveness estimate of how well this filter can use the specified indexes to filter the specified keys

static int32_t calculateIteratorEffectiveness ( int32_t  cKeys  )  [static]

Helper method to calculate effectiveness (or rather ineffectiveness) of a simple iteration against a key set that has to be performed due to an absence of corresponding index.

Parameters:
cKeys the number of keys to iterate through

virtual Object::View getValue (  )  const [virtual]

Get the object to compare the reflection result with.

Returns:
the object to compare the reflection result with


The documentation for this class was generated from the following file:
Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.