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

E26041-01

ChainedComparator Class Reference

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

Inherits Object, Comparator, QueryMapComparator, EntryAwareComparator, and PortableObject.

List of all members.


Detailed Description

Composite comparator implementation based on a collection of comparators.

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) == 0
 
the (n+1)-th comparator will be applied to calculate the value.

Author:
gm 2008.08.04

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.

Returns:
true if Entry keys are expected; false otherwise

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< ObjectArrayf_vaComparator
 The wrapped Comparator array.

Constructor & Destructor Documentation

ChainedComparator ( ObjectArray::View  vaComparator  )  [protected]

Construct a ChainedComparator.

Parameters:
vaComparator the comparator array


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.

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.

Implements Comparator.

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 ObjectArray::View getComparators (  )  const [virtual]

Obtain the underlying Comparator array.

Returns:
the Comparator array


Member Data Documentation

FinalView<ObjectArray> f_vaComparator [protected]

The wrapped Comparator array.

Could be null.


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