#include <coherence/util/comparator/SafeComparator.hpp>
Inherited by EntryComparator, and InverseComparator.
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.
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. |
SafeComparator | ( | Comparator::View | vComparator | ) | [protected] |
Construct a SafeComparator delegating to the specified (wrapped) comparator.
vComparator | Comparator object to delegate comparison of non-null values (optional) |
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.
vO1 | the first object to be compared | |
vO2 | the second object to be compared |
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.
vComparator | a Comparator to check |
virtual Comparator::View getComparator | ( | ) | const [virtual] |
Obtain 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.
vComparator | a comparator to use for the comparison (optional) | |
vO1 | the first object to be compared | |
vO2 | the second object to be compared |
ClassCastException | if the arguments are not Comparable |
FinalView<Comparator> f_vComparator [protected] |
The wrapped Comparator.
Could be null.