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 {
101 std::auto_ptr<ListIterator<E> > iter(this->
listIterator(index));
105 __FILE__, __LINE__,
"get called with invalid index.");
116 virtual E
set(
int index,
const E& element) {
118 std::auto_ptr<ListIterator<E> > iter(this->
listIterator(index));
119 E result = iter->next();
124 __FILE__, __LINE__,
"set called with invalid index.");
135 virtual void add(
int index,
const E& element) {
137 std::auto_ptr<ListIterator<E> > iter(this->
listIterator(index));
141 __FILE__, __LINE__,
"add called with invalid index.");
155 std::auto_ptr<ListIterator<E> > iter(this->
listIterator(index));
156 std::auto_ptr<Iterator<E> > srcIter(source.
iterator());
157 int next = iter->nextIndex();
158 while (srcIter->hasNext()) {
159 iter->add(srcIter->next());
161 return next != iter->nextIndex();
172 std::auto_ptr<ListIterator<E> > iter(this->
listIterator(index));
173 E result = iter->next();
178 __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:154
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:116
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:135
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:170
virtual ~AbstractSequentialList()
Definition: AbstractSequentialList.h:67