Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

AbstractLongArray Class Reference

#include <coherence/util/AbstractLongArray.hpp>

Inherits Object, and LongArray.

Inherited by AbstractSparseArray.

List of all members.


Detailed Description

Abstract base class for LongArray implementations.

Author:
js 2008.04.04
 

Public Types

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

Public Member Functions

virtual Object::Holder get (int64_t lIndex) const
 Return the value stored at the specified index.

Parameters:
 lIndex a long index value
Returns:
the object stored at the specified index, or NULL
virtual int64_t add (Object::Holder ohValue)
 Add the passed element value to the LongArray and return the index at which the element value was stored.

Parameters:
 ohValue the object to add to the LongArray
Returns:
the long index value at which the element value was stored
virtual bool exists (int64_t lIndex) const
 Determine if the specified index is in use.

Parameters:
 lIndex a long index value
Returns:
true if a value (including NULL) is stored at the specified index, otherwise false
virtual Object::Holder remove (int64_t lIndex)
 Remove the specified index from the LongArray, returning its associated value.

Parameters:
 lIndex the index into the LongArray
Returns:
the associated value (which can be NULL) or NULL if the specified index is not in the LongArray
virtual bool contains (Object::View vElement) const
 Determine if the LongArray contains the specified element.

More formally, returns true if and only if this LongArray contains at least one element e such that (o==NULL ? e==NULL : o.equals(e)).

Parameters:
 vElement element whose presence in this list is to be tested
Returns:
true if this list contains the specified element
virtual void clear ()
 Remove all nodes from the LongArray.
virtual bool isEmpty () const
 Test for empty LongArray.

Returns:
true if LongArray has no nodes
virtual size32_t getSize () const
 Determine the size of the LongArray.

Returns:
the number of nodes in the LongArray
virtual int64_t getFirstIndex () const
 Determine the first index that exists in the LongArray.

Returns:
the lowest long value, 0 <= n <= Long.max_value, that exists in this LongArray, or -1 if the LongArray is empty
virtual int64_t getLastIndex () const
 Determine the last index that exists in the LongArray.

Returns:
the highest long value, 0 <= n <= Long.max_value, that exists in this LongArray, or -1 if the LongArray is empty
virtual void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
 out the stream used to output the description
virtual bool equals (Object::View v) const
  
virtual size32_t hashCode () const
 Return a hash code value for the Object.

This method is supported for the benefit of hash-based containers.

The general contract of hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object

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