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 decaf::util::Iterator< E > * iterator()=0
Definition IndexOutOfBoundsException.h:31
Definition UnsupportedOperationException.h:32
This class provides a skeletal implementation of the List interface to minimize the effort required t...
Definition AbstractList.h:66
AbstractList()
Definition AbstractList.h:341
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 ListIterator< E > * listIterator(int index DECAF_UNUSED)
Definition AbstractSequentialList.h:83
virtual E get(int index) const
Gets the element contained at position passed.value at index specified.
Definition AbstractSequentialList.h:99
virtual ListIterator< E > * listIterator()
Definition AbstractSequentialList.h:76
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
virtual ListIterator< E > * listIterator() const
Definition AbstractSequentialList.h:79
virtual Iterator< E > * iterator()
Definition AbstractSequentialList.h:69
virtual ~AbstractSequentialList()
Definition AbstractSequentialList.h:67
virtual ListIterator< E > * listIterator(int index DECAF_UNUSED) const
Definition AbstractSequentialList.h:87
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
virtual Iterator< E > * iterator() const
Definition AbstractSequentialList.h:72
virtual E set(int index, const E &element)
Replaces the element at the specified position in this list with the specified element....
Definition AbstractSequentialList.h:116
The root interface in the collection hierarchy.
Definition Collection.h:69
Defines an object that can be used to iterate over the elements of a collection.
Definition Iterator.h:34
An iterator for lists that allows the programmer to traverse the list in either direction,...
Definition ListIterator.h:38
Definition NoSuchElementException.h:31
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25