#include <list.h>
Public Member Functions | |
LinkedList (void) | |
LinkedList (const LinkedList< T > &l) | |
virtual | ~LinkedList () |
virtual bool | isEmpty (void) const |
virtual unsigned int | size (void) const |
virtual AbstractIterator< T > * | iteratorPtr (void) const |
virtual LinkedList< T >::Iterator | iterator (void) const |
virtual void | purge (void) |
virtual void | pushBack (const T element) |
virtual void | popBack (void) |
virtual void | pushFront (const T element) |
virtual void | popFront (void) |
virtual void | insert (const T element, unsigned int index) |
virtual void | remove (unsigned int index) |
void | operator= (const LinkedList< T > &l) |
virtual T & | first (void) throw (EmptyCollectionException) |
virtual T & | last (void) throw (EmptyCollectionException) |
virtual const T & | first (void) const throw (EmptyCollectionException) |
virtual const T & | last (void) const throw (EmptyCollectionException) |
bool | contains (const T element) const |
bool | removeFirstMatch (const T match) |
bool | replace (int i, const T element) |
bool | replaceAll (const T match, const T e) |
bool | replaceFirst (const T match, const T e) |
Classes | |
class | Iterator |
seal::LinkedList< T >::LinkedList | ( | void | ) | [inline] |
Default Constructor.
seal::LinkedList< T >::LinkedList | ( | const LinkedList< T > & | l | ) | [inline] |
Copy constructor. It is only a reference copier. The new list and the old one share the same list elements.
seal::LinkedList< T >::~LinkedList | ( | ) | [inline, virtual] |
Destructor.
bool seal::LinkedList< T >::isEmpty | ( | void | ) | const [inline, virtual] |
Returns true is the list is empty.
Implements seal::Collection< T >.
virtual unsigned int seal::LinkedList< T >::size | ( | void | ) | const [inline, virtual] |
Returns the number of elements in the list.
Implements seal::Collection< T >.
virtual AbstractIterator<T>* seal::LinkedList< T >::iteratorPtr | ( | void | ) | const [inline, virtual] |
Returns a pointer to the iterator of the linked list. This iterator iterates from the 'front' (or begining) of the linked list to the 'back' (or end). The client of this function should be responsible of deleting the returned iterator object using delete
.
Implements seal::Collection< T >.
virtual LinkedList<T>::Iterator seal::LinkedList< T >::iterator | ( | void | ) | const [inline, virtual] |
Returns an iterator of the linked list. This iterator iterates from the 'front' (or begining) of the linked list to the 'back' (or end).
void seal::LinkedList< T >::purge | ( | void | ) | [inline, virtual] |
Destroys the linked list. The size of the list will become 0 after a call to the purge function.
Implements seal::Collection< T >.
void seal::LinkedList< T >::pushBack | ( | const T | element | ) | [inline, virtual] |
Appends an element at the back end of the list.
element | The element to be appended to the list. |
Implements seal::List< T >.
void seal::LinkedList< T >::popBack | ( | void | ) | [inline, virtual] |
Pops an element from the back end of the list.
Implements seal::List< T >.
void seal::LinkedList< T >::pushFront | ( | const T | element | ) | [inline, virtual] |
Appends an element at the front end of the list.
element | The element to be appended to the list. |
Implements seal::List< T >.
void seal::LinkedList< T >::popFront | ( | void | ) | [inline, virtual] |
Pops an element from the front end of the list.
Implements seal::List< T >.
void seal::LinkedList< T >::insert | ( | const T | element, | |
unsigned int | index | |||
) | [inline, virtual] |
Inserts an element, at the specified index, in to the linked list. If the specified index is greater than or equal to the size of the list, then the element is appended to the back end of the list.
element | The element to be inserted. | |
index | The index at which the element should be inserted. |
Implements seal::List< T >.
void seal::LinkedList< T >::remove | ( | unsigned int | index | ) | [inline, virtual] |
Removes the element at the specified index in the linked list. If the specified index is greater than or equal to the size of the list, then nothing is done.
index | The element at this index will be removed from the list. |
Implements seal::List< T >.
void seal::LinkedList< T >::operator= | ( | const LinkedList< T > & | l | ) | [inline] |
Assignment operator. An assignment operation will only be a reference copier. The LHS and RHS will share the elements of the RHS after assignment.
T & seal::LinkedList< T >::first | ( | void | ) | throw (EmptyCollectionException) [inline, virtual] |
Returns the first element in the list. Throws an seal::EmptyCollectionException
if the list is empty.
Implements seal::Collection< T >.
T & seal::LinkedList< T >::last | ( | void | ) | throw (EmptyCollectionException) [inline, virtual] |
Returns the last element in the list. Throws an seal::EmptyCollectionException
if the list is empty.
Implements seal::Collection< T >.
const T & seal::LinkedList< T >::first | ( | void | ) | const throw (EmptyCollectionException) [inline, virtual] |
Returns the first element in the list. Throws an seal::EmptyCollectionException
if the list is empty.
Implements seal::Collection< T >.
const T & seal::LinkedList< T >::last | ( | void | ) | const throw (EmptyCollectionException) [inline, virtual] |
Returns the last element in the list. Throws an seal::EmptyCollectionException
if the list is empty.
Implements seal::Collection< T >.
bool seal::LinkedList< T >::contains | ( | const T | element | ) | const [inline] |
Returns true if element
exists in the list; Else returns false.
bool seal::LinkedList< T >::removeFirstMatch | ( | const T | match | ) | [inline] |
Remove the first element which is equal to match
from the list. Returns true if an element was removed from the list; Else returns false.
bool seal::LinkedList< T >::replace | ( | int | i, | |
const T | element | |||
) | [inline] |
Replaces the element at the specified index into the linked list.
i | The index of the element which has to be replaced. | |
element | The new value of the element at index i . |
bool seal::LinkedList< T >::replaceAll | ( | const T | match, | |
const T | e | |||
) | [inline] |
Replaces all elements which match a specified value.
match | The elements with this value are replaced. | |
e | The new value of the elements with value \ match. |
bool seal::LinkedList< T >::replaceFirst | ( | const T | match, | |
const T | e | |||
) | [inline] |
Replaces the first element which matches the specified value.
match | The elements with this value are replaced. | |
e | The new value of the elements with value \ match. |