Public Member Functions
imagen::iLinkedList< dType > Class Template Reference

Doubly-linked list template. More...

#include <iLinkedList.h>

List of all members.

Public Member Functions

 iLinkedList ()
 Default constructor.
 iLinkedList (const iLinkedList< dType > &list)
 Copy constructor.
 ~iLinkedList ()
 Destructor.
void append (const dType &newData)
 Inserts an item at the end of the list.
void prepend (const dType &newData)
 Inserts an item at the beginning of the list.
void insert (int i, const dType &newData)
 Inserts an item at the specified index.
void removeFirst ()
 Removes the first item in the list.
void removeLast ()
 Removes the last item in the list.
void remove (int i)
 Removes the item at the specified index.
int removeAll (dType val)
 Removes all occurences of the specified value.
void replace (int i, const dType &newData)
 Replaces the item at the specified index with a new value.
dType & getFirst ()
 Gets a reference to the first item in the list.
const dType & getFirst () const
 Gets a reference to the first item in the list.
dType & getLast ()
 Gets a reference to the last item in the list.
const dType & getLast () const
 Gets a reference to the last item in the list.
dType & getItem (int i)
 Gets a reference to the item at the specified index.
const dType & getItem (int i) const
 Gets a reference to the item at the specified index.
dType takeFirst ()
 Removes the first item in the list and returns it.
dType takeLast ()
 Removes the last item in the list and returns it.
dType takeItem (int i)
 Removes the item at the specified index and returns it.
void reverse ()
 Reverses the order of the items in the list.
int countAll (dType val)
 Counts the number of occurences of the specified value.
int getSize ()
 Gets the number of items in the list.
void clear ()
 Removes all of the items from the list.
bool isMember (const dType &val)
 Checks if the specified value exists in the list.
bool isEmpty ()
 Determines whether or not the list is empty.
iLinkedList< dType > & operator= (const iLinkedList< dType > &l)
 Assigns a list to this list.
iLinkedList< dType > & operator+= (const iLinkedList< dType > &l)
 Appends all items from a list to this list.
dType & operator[] (int i)
 Gets a reference to the item at the specified index.
const dType & operator[] (int i) const
 Gets a reference to the item at the specified index.

Detailed Description

template<class dType>
class imagen::iLinkedList< dType >

Doubly-linked list template.

A few notes about indexes:
1. The list's index begins at zero.
2. You will be required to specify the index of an item in many of the following functions. The index must be in the range of 0 through getSize()-1. If you specify an index less than zero, the first item in the list will be used. Similarly, if you specify an index greater than getSize()-1 (the last item), the last item in the list will be used.


Constructor & Destructor Documentation

template<class dType>
imagen::iLinkedList< dType >::iLinkedList ( ) [inline]

Default constructor.

Constructs an empty list.

template<class dType>
imagen::iLinkedList< dType >::iLinkedList ( const iLinkedList< dType > &  list) [inline]

Copy constructor.

template<class dType>
imagen::iLinkedList< dType >::~iLinkedList ( ) [inline]

Destructor.


Member Function Documentation

template<class dType>
void imagen::iLinkedList< dType >::append ( const dType &  newData) [inline]

Inserts an item at the end of the list.

Parameters:
newData: The item to insert.
template<class dType>
void imagen::iLinkedList< dType >::prepend ( const dType &  newData) [inline]

Inserts an item at the beginning of the list.

Parameters:
newData: The item to insert.
template<class dType>
void imagen::iLinkedList< dType >::insert ( int  i,
const dType &  newData 
) [inline]

Inserts an item at the specified index.

Parameters:
i: The index at which to insert the item.
newData: The item to insert.
template<class dType>
void imagen::iLinkedList< dType >::removeFirst ( ) [inline]

Removes the first item in the list.

template<class dType>
void imagen::iLinkedList< dType >::removeLast ( ) [inline]

Removes the last item in the list.

template<class dType>
void imagen::iLinkedList< dType >::remove ( int  i) [inline]

Removes the item at the specified index.

Parameters:
i: The index of the item to remove.
template<class dType>
int imagen::iLinkedList< dType >::removeAll ( dType  val) [inline]

Removes all occurences of the specified value.

Parameters:
val: The value to search for.
Returns:
The number of items removed.
template<class dType>
void imagen::iLinkedList< dType >::replace ( int  i,
const dType &  newData 
) [inline]

Replaces the item at the specified index with a new value.

Parameters:
i: The index of the item to be replaced.
newData: The new value of the item.
template<class dType>
dType& imagen::iLinkedList< dType >::getFirst ( ) [inline]

Gets a reference to the first item in the list.

Returns:
The first item in the list.
template<class dType>
const dType& imagen::iLinkedList< dType >::getFirst ( ) const [inline]

Gets a reference to the first item in the list.

This is an overloaded function.

template<class dType>
dType& imagen::iLinkedList< dType >::getLast ( ) [inline]

Gets a reference to the last item in the list.

Returns:
The last item in the list.
template<class dType>
const dType& imagen::iLinkedList< dType >::getLast ( ) const [inline]

Gets a reference to the last item in the list.

This is an overloaded function.

template<class dType>
dType& imagen::iLinkedList< dType >::getItem ( int  i) [inline]

Gets a reference to the item at the specified index.

Parameters:
i: The index of the item to get.
Returns:
The item at the specified index.
template<class dType>
const dType& imagen::iLinkedList< dType >::getItem ( int  i) const [inline]

Gets a reference to the item at the specified index.

This is an overloaded function.

template<class dType>
dType imagen::iLinkedList< dType >::takeFirst ( ) [inline]

Removes the first item in the list and returns it.

Returns:
The first item in the list.
template<class dType>
dType imagen::iLinkedList< dType >::takeLast ( ) [inline]

Removes the last item in the list and returns it.

Returns:
The last item in the list.
template<class dType>
dType imagen::iLinkedList< dType >::takeItem ( int  i) [inline]

Removes the item at the specified index and returns it.

Parameters:
i: The index of the item to take.
Returns:
The item at the specified index.
template<class dType>
void imagen::iLinkedList< dType >::reverse ( ) [inline]

Reverses the order of the items in the list.

This function currently does not work. Calling it will do nothing.

template<class dType>
int imagen::iLinkedList< dType >::countAll ( dType  val) [inline]

Counts the number of occurences of the specified value.

Parameters:
val: The value to search for.
Returns:
The number of items in the list that are equal to val.
template<class dType>
int imagen::iLinkedList< dType >::getSize ( ) [inline]

Gets the number of items in the list.

Returns:
The number of items in the list.
template<class dType>
void imagen::iLinkedList< dType >::clear ( ) [inline]

Removes all of the items from the list.

template<class dType>
bool imagen::iLinkedList< dType >::isMember ( const dType &  val) [inline]

Checks if the specified value exists in the list.

Parameters:
val: The value to look for.
Returns:
True if the value exists in the list, else false.
template<class dType>
bool imagen::iLinkedList< dType >::isEmpty ( ) [inline]

Determines whether or not the list is empty.

Returns:
True if the list is empty, else false.
template<class dType>
iLinkedList<dType>& imagen::iLinkedList< dType >::operator= ( const iLinkedList< dType > &  l) [inline]

Assigns a list to this list.

template<class dType>
iLinkedList<dType>& imagen::iLinkedList< dType >::operator+= ( const iLinkedList< dType > &  l) [inline]

Appends all items from a list to this list.

template<class dType>
dType& imagen::iLinkedList< dType >::operator[] ( int  i) [inline]

Gets a reference to the item at the specified index.

See also:
getItem().
template<class dType>
const dType& imagen::iLinkedList< dType >::operator[] ( int  i) const [inline]

Gets a reference to the item at the specified index.

This is an overloaded function.


The documentation for this class was generated from the following file: