This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "random access" data store (such as an array). More...
#include <src/main/decaf/util/AbstractList.h>

Data Structures | |
| class | ConstSimpleListIterator |
| class | SimpleListIterator |
Public Member Functions | |
| AbstractList () | |
| virtual | ~AbstractList () |
| virtual Iterator< E > * | iterator () |
| virtual Iterator< E > * | iterator () const |
| virtual ListIterator< E > * | listIterator () |
| virtual ListIterator< E > * | listIterator () const |
| virtual ListIterator< E > * | listIterator (int index) |
| virtual ListIterator< E > * | listIterator (int index) const |
| virtual void | clear () |
| Removes all of the elements from this collection (optional operation). | |
| virtual bool | add (const E &value) |
| Returns true if this collection changed as a result of the call. | |
| virtual void | add (int index DECAF_UNUSED, const E &element DECAF_UNUSED) |
| virtual bool | addAll (int index, const Collection< E > &source) |
| Inserts all of the elements in the specified collection into this list at the specified position (optional operation). | |
| virtual E | removeAt (int index DECAF_UNUSED) |
| Removes the element at the specified position in this list. | |
| virtual E | set (int index DECAF_UNUSED, const E &element DECAF_UNUSED) |
| virtual int | indexOf (const E &value) const |
| Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. | |
| virtual int | lastIndexOf (const E &value) const |
| Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. | |
Protected Member Functions | |
| void | removeRange (int start, int end) |
Protected Attributes | |
| int | modCount |
This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "random access" data store (such as an array).
For sequential access data (such as a linked list), AbstractSequentialList should be used in preference to this class.
To implement an unmodifiable list, the programmer needs only to extend this class and provide implementations for the get(int) and size() methods.
To implement a modifiable list, the programmer must additionally override the set(int, E) method (which otherwise throws an UnsupportedOperationException). If the list is variable-size the programmer must additionally override the add(int, E) and remove(int) methods.
The programmer should generally provide a void (no argument) and collection constructor, as per the recommendation in the Collection interface specification.
Unlike the other abstract collection implementations, the programmer does not have to provide an iterator implementation; the iterator and list iterator are implemented by this class, on top of the "random access" methods: get(int), set(int, E), add(int, E) and remove(int).
The documentation for each non-abstract method in this class describes its implementation in detail. Each of these methods may be overridden if the collection being implemented admits a more efficient implementation.
| decaf::util::AbstractList< E >::AbstractList | ( | ) | [inline] |
| virtual decaf::util::AbstractList< E >::~AbstractList | ( | ) | [inline, virtual] |
| virtual void decaf::util::AbstractList< E >::add | ( | int index | DECAF_UNUSED, | |
| const E &element | DECAF_UNUSED | |||
| ) | [inline, virtual] |
| virtual bool decaf::util::AbstractList< E >::add | ( | const E & | value | ) | [inline, virtual] |
Returns true if this collection changed as a result of the call.
(Returns false if this collection does not permit duplicates and already contains the specified element.)
Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
For non-pointer values, i.e. class instances or string's the object will be copied into the collection, thus the object must support being copied, must not hide the copy constructor and assignment operator.
| value | The reference to the element to add to this Collection. |
| UnsupportedOperationExceptio | if this is an unmodifiable collection. | |
| NullPointerException | if the Collection is a container of pointers and does not allow NULL values. | |
| IllegalArgumentException | if some property of the element prevents it from being added to this collection | |
| IllegalStateException | if the element cannot be added at this time due to insertion restrictions. |
Implements decaf::util::Collection< E >.
Reimplemented in decaf::util::ArrayList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::ArrayList< ServiceListener * >, decaf::util::ArrayList< Pointer< ActiveMQDestination > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
Referenced by decaf::util::AbstractList< cms::Connection * >::add(), and decaf::util::AbstractList< cms::Connection * >::addAll().
| virtual bool decaf::util::AbstractList< E >::addAll | ( | int | index, | |
| const Collection< E > & | source | |||
| ) | [inline, virtual] |
Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
| index | The index at which to insert the first element from the specified collection | |
| source | The Collection containing elements to be added to this list |
| IndexOutOfBoundsException | if the index given is less than zero or greater than the List size. | |
| UnsupportedOperationExceptio | if this is an unmodifiable collection. | |
| NullPointerException | if the Collection is a container of pointers and does not allow NULL values. | |
| IllegalArgumentException | if some property of the element prevents it from being added to this collection | |
| IllegalStateException | if the element cannot be added at this time due to insertion restrictions. |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::ArrayList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, decaf::util::AbstractSequentialList< cms::Connection * >, decaf::util::ArrayList< ServiceListener * >, decaf::util::ArrayList< Pointer< ActiveMQDestination > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
| virtual void decaf::util::AbstractList< E >::clear | ( | ) | [inline, virtual] |
Removes all of the elements from this collection (optional operation).
The collection will be empty after this method returns.
This implementation iterates over this collection, removing each element using the Iterator.remove operation. Most implementations will probably choose to override this method for efficiency.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by this collection's iterator method does not implement the remove method and this collection is non-empty.
| UnsupportedOperationException | if the clear operation is not supported by this collection |
Reimplemented from decaf::util::AbstractCollection< E >.
Reimplemented in decaf::util::ArrayList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::ArrayList< ServiceListener * >, decaf::util::ArrayList< Pointer< ActiveMQDestination > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
| virtual int decaf::util::AbstractList< E >::indexOf | ( | const E & | value | ) | const [inline, virtual] |
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
More formally, returns the lowest index i such that get(i) == value, or -1 if there is no such index.
| value | The element to search for in this List. |
| NullPointerException | if the Collection is a container of pointers and does not allow NULL values. |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::ArrayList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::ArrayList< ServiceListener * >, decaf::util::ArrayList< Pointer< ActiveMQDestination > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
| virtual Iterator<E>* decaf::util::AbstractList< E >::iterator | ( | ) | const [inline, virtual] |
Implements decaf::lang::Iterable< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, and decaf::util::AbstractSequentialList< cms::Connection * >.
| virtual Iterator<E>* decaf::util::AbstractList< E >::iterator | ( | ) | [inline, virtual] |
Implements decaf::lang::Iterable< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, and decaf::util::AbstractSequentialList< cms::Connection * >.
Referenced by decaf::util::ArrayList< Pointer< ActiveMQDestination > >::ArrayList().
| virtual int decaf::util::AbstractList< E >::lastIndexOf | ( | const E & | value | ) | const [inline, virtual] |
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
More formally, returns the highest index i such that get(i) == value or -1 if there is no such index.
| value | The element to search for in this List. |
| NullPointerException | if the Collection is a container of pointers and does not allow NULL values. |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::ArrayList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::ArrayList< ServiceListener * >, decaf::util::ArrayList< Pointer< ActiveMQDestination > >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
| virtual ListIterator<E>* decaf::util::AbstractList< E >::listIterator | ( | int index | ) | const [inline, virtual] |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, decaf::util::AbstractSequentialList< cms::Connection * >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
| virtual ListIterator<E>* decaf::util::AbstractList< E >::listIterator | ( | int | index | ) | [inline, virtual] |
| index | index of first element to be returned from the list iterator (by a call to the next method). |
| IndexOutOfBoundsException | if the index is out of range (index < 0 || index > size()) |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::LinkedList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, decaf::util::AbstractSequentialList< cms::Connection * >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.
| virtual ListIterator<E>* decaf::util::AbstractList< E >::listIterator | ( | ) | const [inline, virtual] |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, and decaf::util::AbstractSequentialList< cms::Connection * >.
| virtual ListIterator<E>* decaf::util::AbstractList< E >::listIterator | ( | ) | [inline, virtual] |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, and decaf::util::AbstractSequentialList< cms::Connection * >.
Referenced by decaf::util::AbstractList< cms::Connection * >::indexOf(), decaf::util::AbstractList< cms::Connection * >::lastIndexOf(), and decaf::util::AbstractList< cms::Connection * >::removeRange().
| virtual E decaf::util::AbstractList< E >::removeAt | ( | int index | index | ) | [inline, virtual] |
Removes the element at the specified position in this list.
Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
| index | - the index of the element to be removed. |
| IndexOutOfBoundsException | if the index given is less than zero or greater than the List size. | |
| UnsupportedOperationExceptio | if this is an unmodifiable collection. |
Implements decaf::util::List< E >.
Reimplemented in decaf::util::AbstractSequentialList< E >, decaf::util::ArrayList< E >, decaf::util::StlList< E >, decaf::util::AbstractSequentialList< cms::MessageConsumer * >, decaf::util::AbstractSequentialList< CompositeTask * >, decaf::util::AbstractSequentialList< URI >, decaf::util::AbstractSequentialList< Pointer< MessageDispatch > >, decaf::util::AbstractSequentialList< Pointer< DestinationInfo > >, decaf::util::AbstractSequentialList< PrimitiveValueNode >, decaf::util::AbstractSequentialList< decaf::net::URI >, decaf::util::AbstractSequentialList< Pointer< Command > >, decaf::util::AbstractSequentialList< cms::MessageProducer * >, decaf::util::AbstractSequentialList< cms::Destination * >, decaf::util::AbstractSequentialList< cms::Session * >, decaf::util::AbstractSequentialList< cms::Connection * >, decaf::util::ArrayList< ServiceListener * >, and decaf::util::ArrayList< Pointer< ActiveMQDestination > >.
| void decaf::util::AbstractList< E >::removeRange | ( | int | start, | |
| int | end | |||
| ) | [inline, protected] |
Referenced by decaf::util::AbstractList< cms::Connection * >::clear().
| virtual E decaf::util::AbstractList< E >::set | ( | int index | DECAF_UNUSED, | |
| const E &element | DECAF_UNUSED | |||
| ) | [inline, virtual] |
int decaf::util::AbstractList< E >::modCount [protected] |
1.6.1