Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# EntryComparator Class Reference

`#include <coherence/util/comparator/EntryComparator.hpp>`

Inherits SafeComparator.

List of all members.

## Detailed Description

Comparator implementation used to compare map entries.

Depending on the comparison style this comparator will compare entries' values, entries' keys or, when the provided comparator is an instance of QueryMapComparator, the entries themselves.

Author:
  nsa 2008.05.30

## Public Types
typedef spec::Handle | Handle
| EntryComparator Handle definition.
typedef spec::View | View
| EntryComparator View definition.
typedef spec::Holder | Holder
| EntryComparator Holder definition.
## Public Member Functions
virtual int32_t | compare (Object::View vO1, Object::View vO2) const
| Compares two arguments for order.
virtual void | readExternal (PofReader::Handle hIn)
virtual void | writeExternal (PofWriter::Handle hOut) const
virtual bool | equals (Object::View v) const
int32_t | getComparisonStyle ()
| Obtain the comparison style value utilized by this EntryComparator.
bool | isCompareValue ()
| Check whether or not this EntryComparator uses entries' values to pass for comparison to the underlying Comparator.
bool | isCompareKey ()
| Check whether or not this EntryComparator uses entries' keys to pass for comparison to the underlying Comparator.
bool | isCompareEntry ()
| Check whether or not this EntryComparator pass entries themselves for comparison to the underlying QueryMapComparator::compareEntries method.
## Static Public Attributes
static const int32_t | CMP_AUTO
| Indicates that this EntryComparator should choose the comparison style based on the underying comparator type.
static const int32_t | CMP_VALUE
| Indicates that this EntryComparator should compare the entries' values.
static const int32_t | CMP_KEY
| Indicates that this EntryComparator should compare the entries' keys.
static const int32_t | CMP_ENTRY
| Indicates that entries that implement com.tangosol.util.QueryMap.Entry interface will be compared using the QueryMapComparator::compareEntries method.
## Protected Member Functions
| EntryComparator ()
| Default constructor (necessary for the PortableObject interface).
| EntryComparator (Comparator::View vComparator, int32_t nStyle=CMP_AUTO)
| Construct a SafeComparator delegating to the specified (wrapped) comparator.
## Protected Attributes
int32_t | m_nStyle
| Comparison style utilized by this EntryComparator.

## Constructor & Destructor Documentation

EntryComparator | ( | Comparator::View | vComparator,
|  | int32_t | nStyle = `CMP_AUTO` |
| ) |  |  | `[protected]`

Construct a SafeComparator delegating to the specified (wrapped) comparator.

Parameters:

  | vComparator | Comparator object to delegate comparison of non-null values (optional)

## Member Function Documentation

virtual int32_t compare | ( | Object::View | vO1,
|  | Object::View | vO2 |
| ) |  |  | const `[virtual]`

Compares two arguments for order.

The arguments must be coherence::util::Map::Entry objects. Depending on the comparison style, this method will pass either the entries' values, keys or the entries themselves to the underlying Comparator.

Parameters:

  | vO1 | the first object to be compared
  | vO2 | the second object to be compared

Returns:
  a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second

Exceptions:

  | ClassCastException | if the arguments' types prevent them from being compared by this Comparator.

Reimplemented from SafeComparator.

int32_t getComparisonStyle | ( |  | ) |

Obtain the comparison style value utilized by this EntryComparator.

The returned value should be one of the CMP_* constants.

Returns:
  the comparison style value

bool isCompareValue | ( |  | ) |

Check whether or not this EntryComparator uses entries' values to pass for comparison to the underlying Comparator.

Returns:
  true iff entries' values are used for comparison

bool isCompareKey | ( |  | ) |

Check whether or not this EntryComparator uses entries' keys to pass for comparison to the underlying Comparator.

Returns:
  true iff entries' keys are used for comparison

bool isCompareEntry | ( |  | ) |

Check whether or not this EntryComparator pass entries themselves for comparison to the underlying QueryMapComparator::compareEntries method.

Returns:
  true iff entries themselves are used for comparison

## Member Data Documentation

int32_t m_nStyle `[protected]`

Comparison style utilized by this EntryComparator.

Valid values are any of the CMP_* constants.

The documentation for this class was generated from the following file:

- coherence/util/comparator/EntryComparator.hpp

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.