18 #ifndef _DECAF_UTIL_ABSTRACTSEQUENTIALLIST_H_
19 #define _DECAF_UTIL_ABSTRACTSEQUENTIALLIST_H_
58 template<
typename E >
85 __FILE__, __LINE__,
"Abstract sequential list does not implement the listIterator." );
89 __FILE__, __LINE__,
"Abstract sequential list does not implement the listIterator." );
99 virtual E
get(
int index )
const {
102 std::auto_ptr< ListIterator<E> > iter( this->
listIterator( index ) );
106 __FILE__, __LINE__,
"get called with invalid index." );
117 virtual E
set(
int index,
const E& element ) {
120 std::auto_ptr< ListIterator<E> > iter( this->
listIterator( index ) );
121 E result = iter->next();
122 iter->set( element );
126 __FILE__, __LINE__,
"set called with invalid index." );
137 virtual void add(
int index,
const E& element ) {
140 std::auto_ptr< ListIterator<E> > iter( this->
listIterator( index ) );
141 iter->add( element );
144 __FILE__, __LINE__,
"add called with invalid index." );
159 std::auto_ptr< ListIterator<E> > iter( this->
listIterator( index ) );
160 std::auto_ptr< Iterator<E> > srcIter( source.
iterator() );
161 int next = iter->nextIndex();
162 while( srcIter->hasNext() ) {
163 iter->add( srcIter->next() );
165 return next != iter->nextIndex();
177 std::auto_ptr< ListIterator<E> > iter( this->
listIterator( index ) );
178 E result = iter->next();
183 __FILE__, __LINE__,
"set called with invalid index." );
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 (opt...
Definition: AbstractSequentialList.h:157
The root interface in the collection hierarchy.
Definition: Collection.h:68
virtual ListIterator< E > * listIterator(int index DECAF_UNUSED)
Definition: AbstractSequentialList.h:83
virtual ListIterator< E > * listIterator()
Definition: AbstractSequentialList.h:76
An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator's current position in the list.
Definition: ListIterator.h:38
virtual ListIterator< E > * listIterator() const
Definition: AbstractSequentialList.h:79
virtual Iterator< E > * iterator()
Definition: AbstractSequentialList.h:69
virtual Iterator< E > * iterator() const
Definition: AbstractSequentialList.h:72
Defines an object that can be used to iterate over the elements of a collection.
Definition: Iterator.h:34
Definition: IndexOutOfBoundsException.h:31
Definition: UnsupportedOperationException.h:32
virtual E set(int index, const E &element)
Replaces the element at the specified position in this list with the specified element.The index of the element to replace. The element to be stored at the specified position.the element previously at the specified position.if the index given is less than zero or greater than the List size. if this is an unmodifiable collection. if the Collection is a container of pointers and does not allow NULL values. if some property of the element prevents it from being added to this collection if the element cannot be added at this time due to insertion restrictions.
Definition: AbstractSequentialList.h:117
virtual decaf::util::Iterator< E > * iterator()=0
virtual void add(int index, const E &element)
Inserts the specified element at the specified position in this list.Shifts the element currently at ...
Definition: AbstractSequentialList.h:137
This class provides a skeletal implementation of the List interface to minimize the effort required t...
Definition: AbstractList.h:65
virtual ListIterator< E > * listIterator(int index DECAF_UNUSED) const
Definition: AbstractSequentialList.h:87
#define DECAF_UNUSED
Definition: Config.h:160
Definition: NoSuchElementException.h:31
This class provides a skeletal implementation of the List interface to minimize the effort required t...
Definition: AbstractSequentialList.h:59
virtual E removeAt(int index)
Removes the element at the specified position in this list.Shifts any subsequent elements to the left...
Definition: AbstractSequentialList.h:174
virtual ~AbstractSequentialList()
Definition: AbstractSequentialList.h:67
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25