#include <coherence/util/comparator/ChainedComparator.hpp>
Inherits Object, Comparator, QueryMapComparator, EntryAwareComparator, and PortableObject.
The comparators in the array assumed to be sorted according to their priorities; only in a case when the n-th comparator cannot determine the order of the passed objects:
vaComparator[n]->compare(o1, o2) == 0the (n+1)-th comparator will be applied to calculate the value.
Public Types | |
typedef spec::Handle | Handle |
ChainedComparator Handle definition. | |
typedef spec::View | View |
ChainedComparator View definition. | |
typedef spec::Holder | Holder |
ChainedComparator 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.This implementation simply passes on this invocation to the wrapped Comparator objects if they too implement this interface, or invokes their default compare method passing the values extracted from the passed entries. | |
virtual bool | isKeyComparator () const |
Specifies whether this comparator expects to compare keys or values.
| |
virtual void | readExternal (PofReader::Handle hIn) |
virtual void | writeExternal (PofWriter::Handle hOut) const |
virtual bool | equals (Object::View v) const |
virtual ObjectArray::View | getComparators () const |
Obtain the underlying Comparator array. | |
Static Public Member Functions | |
static bool | isKeyComparator (Comparator::View vComparator) |
Check whether the specified comparator expects to compare keys or values. | |
static ChainedComparator::Handle | getInstance () |
An instance of the ChainedComparator. | |
Protected Member Functions | |
ChainedComparator () | |
Default constructor (necessary for the PortableObject interface). | |
ChainedComparator (ObjectArray::View vaComparator) | |
Construct a ChainedComparator. | |
Protected Attributes | |
FinalView< ObjectArray > | f_vaComparator |
The wrapped Comparator array. |
ChainedComparator | ( | ObjectArray::View | vaComparator | ) | [protected] |
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.
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. |
Implements Comparator.
static bool isKeyComparator | ( | Comparator::View | vComparator | ) | [static] |
Check whether the specified comparator expects to compare keys or values.
vComparator | a Comparator to check |
virtual ObjectArray::View getComparators | ( | ) | const [virtual] |
FinalView<ObjectArray> f_vaComparator [protected] |
The wrapped Comparator array.
Could be null.