Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

SubList Class Reference

#include <coherence/util/SubList.hpp>

Inherits AbstractList.

Inherited by CircularArrayList::SubCircularArrayList, and LinkedList::SubLinkedList.

List of all members.


Detailed Description

SubList delegates all operations to it's full list while providing a partial view of the list.

Author:
nsa 2008.02.08
 

Public Types

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

Public Member Functions

virtual bool add (size32_t i, Object::Holder oh)
 Add the given element to this collection at the position specified.

If an element is already at that position it will be shifted to the right by 1.

Parameters:
 i the position to insert the element at
 oh the element to add
Returns:
true iff this list was modified as a result of this operation
Exceptions:
 coherence::lang::IndexOutOfBoundsException if the index is out of range
virtual bool addAll (size32_t i, Collection::View vc)
 Add all the elements from the supplied collection to this collection at the position specified.

Parameters:
 i the index of the list to add the elements to
 vc the collection to add to this list
Returns:
true iff this list was modified as a result of this operation
Exceptions:
 coherence::lang::IndexOutOfBoundsException if the inedex is out of range
virtual Object::Holder get (size32_t i) const
 Return the element from the specified position in the list.

Parameters:
 i the position of the item to return
Returns:
the element from the specified position in the list
Exceptions:
 coherence::lang::IndexOutOfBoundsException if the index is out of range
virtual size32_t indexOf (Object::View v) const
 Return the position in the list of the first instance of the specified element.

Parameters:
 v The object in the list to return the index of
Returns:
the position of the object if found, or List::npos
virtual size32_t lastIndexOf (Object::View v) const
 Return the position in this list of the last instance of the specified element.

Parameters:
 v The element to search for in the list
Returns:
the position of the element if found, or List::npos
virtual
ListIterator::Handle 
listIterator (size32_t index=0) const
 Return a ListIterator for this list starting at index.

Parameters:
 i the index to start the ListIterator at
Returns:
a ListIterator for this list start at index
virtual
ListMuterator::Handle 
listIterator (size32_t index=0)
 Return a ListIterator for this list starting at index.

Parameters:
 i the index to start the ListIterator at
Returns:
a ListIterator for this list start at index
virtual Object::Holder remove (size32_t idx)
 Remove the element at the specified position in the list.

Parameters:
 i the index from which to remove an element
Returns:
the element at the specified position prior to this operation
Exceptions:
 coherence::lang::IndexOutOfBoundsException if the index is out of range
virtual Object::Holder set (size32_t idx, Object::Holder oh)
 Replace the element at the specified position in this list with the specified element.

Parameters:
 i the position in the list to replace
 oh the object to replace at the specified position
Returns:
the element at the specified position prior to this operation
Exceptions:
 coherence::lang::IndexOutOfBoundsException if the index is out of range
virtual size32_t size () const
 Return the number of elements in this collection.

Returns:
the number of elements in this collection
virtual Iterator::Handle iterator () const
 Return an Iterator over this collection.

Returns:
an Iterator over this collection
virtual Muterator::Handle iterator ()
 Return an Iterator over this collection.

Returns:
an Iterator over this collection
virtual bool add (Object::Holder oh)
 Add the given element to this collection.

Parameters:
 oh the element to add
Returns:
true iff this collection was modified as a result of this operation

This implementation will throw a coherence::lang::UnsupportedOperationException

virtual bool addAll (Collection::View vc)
 Add all elements from the supplied collection to this collection.

Parameters:
 vCol the collection of elements to add
Returns:
true iff this collection was modified as a result of this operation
Exceptions:
 coherence::lang::NullPointerException if the specified collection is NULL
See also:
add()

This implementation will throw a coherence::lang::UnsupportedOperationException unless add() is overridden (assuming the specified collection is non-empty).

virtual bool remove (Object::View v)
 Remove the supplied element from this collection.

Parameters:
 v the element to remove
Returns:
true iff this collection was modified as a result of this operation

This implementation will throw a coherence::lang::UnsupportedOperationException unless add() is overridden (assuming the specified collection is non-empty).


Protected Member Functions

void assertIndex (size32_t i) const
 Validate that the supplied index is in the appropriate range for this SubList.
virtual List::Handle getDelegate ()
 Return the to delegate to.
virtual List::View getDelegate () const
 Return the to delegate to.

Protected Attributes

FinalHolder< Listm_ohList
 The underlying list this is a sublist of.
size32_t m_iOffset
 The offset this list is based on from the underlying list.
size32_t m_iSize
 The size of this sublist.

Member Function Documentation

void assertIndex ( size32_t  i  )  const [protected]

Validate that the supplied index is in the appropriate range for this SubList.

Parameters:
 i the index to test against the SubList's boundaries
Exceptions:
 coherence::lang::IndexOutOfBoundsException iff the supplied index is outside the range of this SubList.

virtual List::Handle getDelegate (  )  [protected, virtual]

Return the to delegate to.

Returns:
the list to delegate to

virtual List::View getDelegate (  )  const [protected, virtual]

Return the to delegate to.

Returns:
the list to delegate to


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