Oracle Coherence for C++ API
Release 3.6.1.0
E18813-01

- Main Page
- Namespaces
- Classes
- Files

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

# Comparable Class Reference

`#include <coherence/lang/Comparable.hpp>`

Inherits Object.

Inherited by Character16`[virtual]`, ClassBasedHeapAnalyzer::ClassStats`[virtual]`, Float32`[virtual]`, Float64`[virtual]`, Integer16`[virtual]`, Integer32`[virtual]`, Integer64`[virtual]`, Octet`[virtual]`, Primitive`[virtual]`, Primitive< bool >`[virtual]`, Primitive< char16_t >`[virtual]`, Primitive< float32_t >`[virtual]`, Primitive< float64_t >`[virtual]`, Primitive< int16_t >`[virtual]`, Primitive< int32_t >`[virtual]`, Primitive< int64_t >`[virtual]`, Primitive< octet_t >`[virtual]`, String`[virtual]`, ArrayFilter::WeightedFilter`[virtual]`, and UUID`[virtual]`.

List of all members.

## Detailed Description

This interface imposes a total ordering on the objects of each class that implements it.

This ordering is referred to as the class's natural ordering, and the class's `compareTo` method is referred to as its natural comparison method.

Author:
  jh 2008.02.27

## Public Types
typedef spec::Handle | Handle
| Comparable Handle definition.
typedef spec::View | View
| Comparable View definition.
typedef spec::Holder | Holder
| Comparable Holder definition.
## Public Member Functions
virtual int32_t | compareTo (Object::View v) const =0
| Compare this object with the specified object for order.
virtual bool | operator< (Object::View v) const
| Standard C++ less-than operator delegate.

## Member Function Documentation

virtual int32_t compareTo | ( | Object::View | v | ) | const`[pure virtual]`

Compare this object with the specified object for order.

Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.

It is strongly recommended, but not strictly required, that `(x->compareTo(y) == 0) == (x->equals(y))`.

Parameters:

  | v | the Object to be compared

Returns:
  a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object

Exceptions:

  | ClassCastException | if the specified Object's type prevents it from being compared to this Object

Implemented in Character16, ClassBasedHeapAnalyzer::ClassStats, Float32, Float64, Integer16, Octet, Primitive, String, Primitive< int64_t >, Primitive< int16_t >, Primitive< float64_t >, Primitive< char16_t >, Primitive< float32_t >, Primitive< int32_t >, Primitive< octet_t >, and Primitive< bool >.

virtual bool operator< | ( | Object::View | v | ) | const`[inline, virtual]`

Standard C++ less-than operator delegate.

Parameters:

  | v | the Object to be compared

Returns:
  true if this object is less than the specified object

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

- coherence/lang/Comparable.hpp

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