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

E77779-01

SafeComparator Class Reference

#include <coherence/util/comparator/SafeComparator.hpp>

Inherited by EntryComparator, and InverseComparator.

List of all members.


Detailed Description

NULL-safe delegating comparator.

NULL values are evaluated as "less then" any non-null value. If the wrapped comparator is not specified then all non-null values must implement the coherence::util::Comparable interface. Use SafeComparator::getInstance to obtain an instance of non-delegating SafeComparator.

Author:
djl 2008.05.05

Public Types

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

Public Member Functions

virtual int32_t compare (Object::View vO1, Object::View vO2) const
 Compares its two arguments for order.
virtual int32_t compareEntries (QueryMap::Entry::View vEntry1, QueryMap::Entry::View vEntry2) const
 Compare two entries using the underlying comparator.
virtual bool isKeyComparator () const
 
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
 
virtual TypedHandle
< const String > 
toString () const
 
virtual Comparator::View getComparator () const
 Obtain the wrapped Comparator.

Static Public Member Functions

static bool isKeyComparator (Comparator::View vComparator)
 Check whether the specified comparator expects to compare keys or values.
static int32_t compareSafe (Comparator::View vComparator, Object::View vO1, Object::View vO2)
 Compares its two arguments for order.
static
SafeComparator::Handle 
getInstance ()
 An instance of the SafeComparator.

Protected Member Functions

 SafeComparator ()
 Default constructor (necessary for the PortableObject interface).
 SafeComparator (Comparator::View vComparator)
 Construct a SafeComparator delegating to the specified (wrapped) comparator.

Protected Attributes

FinalView< Comparator > f_vComparator
 The wrapped Comparator.

Constructor & Destructor Documentation

SafeComparator ( Comparator::View  vComparator  )  [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 its two arguments for order.

Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. Null values are evaluated as "less then" any non-null value. If the wrapped comparator is not specified, all non-null values must implement the Comparable interface.

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 in EntryComparator, and InverseComparator.

virtual int32_t compareEntries ( QueryMap::Entry::View  vEntry1,
QueryMap::Entry::View  vEntry2 
) const [virtual]

Compare two entries using the underlying comparator.

If the wrapped comparator does not implement the QueryMapComparator interface, revert to the entry values comparison.

Reimplemented in InverseComparator.

static bool isKeyComparator ( Comparator::View  vComparator  )  [static]

Check whether the specified comparator expects to compare keys or values.

Parameters:
vComparator a Comparator to check
Returns:
true if the comparator expects keys; false otherwise

virtual Comparator::View getComparator (  )  const [virtual]

Obtain the wrapped Comparator.

Returns:
the wrapped Comparator

static int32_t compareSafe ( Comparator::View  vComparator,
Object::View  vO1,
Object::View  vO2 
) [static]

Compares its two arguments for order.

Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. Null values are evaluated as "less then" any non-null value. Non-null values must implement the coherence::util::Comparable interface.

Parameters:
vComparator a comparator to use for the comparison (optional)
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 are not Comparable


Member Data Documentation

FinalView<Comparator> f_vComparator [protected]

The wrapped Comparator.

Could be null.


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