#include <coherence/util/LinkedList.hpp>
Inherits AbstractList.
Public Types | ||||||||||
typedef spec::Handle | Handle | |||||||||
LinkedList Handle definition. | ||||||||||
typedef spec::View | View | |||||||||
LinkedList View definition. | ||||||||||
typedef spec::Holder | Holder | |||||||||
LinkedList 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.
| ||||||||||
virtual bool | addAll (size32_t i, Collection::View vc) | |||||||||
Add all the elements from the supplied collection to this collection at the position specified.
| ||||||||||
virtual Object::Holder | get (size32_t i) const | |||||||||
Return the element from the specified position in the list.
| ||||||||||
virtual size32_t | indexOf (Object::View v) const | |||||||||
Return the position in the list of the first instance of the specified element.
| ||||||||||
virtual size32_t | lastIndexOf (Object::View v) const | |||||||||
Return the position in this list of the last instance of the specified element.
| ||||||||||
virtual ListIterator::Handle | listIterator (size32_t index=0) const | |||||||||
Return a ListIterator for this list starting at index.
| ||||||||||
virtual ListMuterator::Handle | listIterator (size32_t index=0) | |||||||||
Return a ListIterator for this list starting at index.
| ||||||||||
virtual Object::Holder | remove (size32_t index) | |||||||||
Remove the element at the specified position in the list.
| ||||||||||
virtual Object::Holder | set (size32_t index, Object::Holder oh) | |||||||||
Replace the element at the specified position in this list with the specified element.
| ||||||||||
virtual List::View | subList (size32_t fromIndex, size32_t toIndex) const | |||||||||
Return a new list containing the contents of the list between the specified fromIndex (inclusive) and toIndex (exclusive).
| ||||||||||
virtual List::Handle | subList (size32_t fromIndex, size32_t toIndex) | |||||||||
Return a new list containing the contents of the list between the specified fromIndex (inclusive) and toIndex (exclusive).
| ||||||||||
virtual size32_t | size () const | |||||||||
Return the number of elements in this collection.
| ||||||||||
virtual Iterator::Handle | iterator () const | |||||||||
Return an Iterator over this collection.
| ||||||||||
virtual Muterator::Handle | iterator () | |||||||||
Return an Iterator over this collection.
| ||||||||||
virtual bool | add (Object::Holder oh) | |||||||||
Add the given element to this collection.
This implementation will throw a coherence::lang::UnsupportedOperationException | ||||||||||
virtual bool | addAll (Collection::View vc) | |||||||||
Add all elements from the supplied collection to this collection.
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.
This implementation will throw a coherence::lang::UnsupportedOperationException unless add() is overridden (assuming the specified collection is non-empty). | ||||||||||
virtual bool | removeAll (Collection::View vColl) | |||||||||
Remove all instances of the elements in the supplied collection from this collection. Upon completion, contains() on this collection will return false for all elements in the supplied collection.
This implementation will throw a coherence::lang::UnsupportedOperationException} unless remove() is overridden (assuming the specified collection is non-empty). | ||||||||||
virtual bool | retainAll (Collection::View vCol) | |||||||||
Remove all elements from this collection that are not present in the supplied collection.
This implementation will throw a coherence::lang::UnsupportedOperationException unless remove() is overridden (assuming there are items to be removed by the operation). | ||||||||||
virtual void | clear () | |||||||||
Remove all elements from this collection.
This implementation will throw a coherence::lang::UnsupportedOperationException. | ||||||||||
Protected Member Functions | ||||||||||
LinkedList () | ||||||||||
Create a new LinkedList. | ||||||||||
LinkedList (Collection::View vc) | ||||||||||
Create a new LinkedList that has a reference to every element in the supplied collection. | ||||||||||
virtual | ~LinkedList () | |||||||||
Destructor. | ||||||||||
virtual void | onEscape (bool fEscaped) const | |||||||||
Event called when the guarding Object's escape state changes. As with all event methods any derived implementation should include a call to the super class's implementation. Ultimately delegation must reach Object::onEscape() which will perform the actual act of preparing the object for multi/single-threaded access. Throughout the call it is guaranteed that the object remains visible to only a single thread, and as such it is not allowable to perform an action from within this method which would attempt to escape this object.
| ||||||||||
virtual void | assertIndex (size32_t i) const | |||||||||
Helper method that will throw a coherence::lang::IndexOutOfBoundsException if the supplied index is out of range. | ||||||||||
Protected Attributes | ||||||||||
size32_t | m_cElements | |||||||||
The number of elements in the list. | ||||||||||
MemberHandle < ListElement > | m_hHead | |||||||||
The head of the list. | ||||||||||
MemberHandle < ListElement > | m_hTail | |||||||||
The tail of the list. | ||||||||||
Classes | ||||||||||
class | ListElement | |||||||||
ListElement is the foundation element for the linked list. More... | ||||||||||
class | SubLinkedList | |||||||||
Utility class to implement a SubList of a LinkedList. More... |
LinkedList | ( | ) | [protected] |
LinkedList | ( | Collection::View | vc | ) | [protected] |
Create a new LinkedList that has a reference to every element in the supplied collection.
vc | The collection to base the LinkedList on |
virtual void assertIndex | ( | size32_t | i | ) | const [protected, virtual] |
Helper method that will throw a coherence::lang::IndexOutOfBoundsException if the supplied index is out of range.
i | the index to test |