Doubly-linked list template. More...
#include <gelLinkedList.h>
Public Member Functions | |
GelLinkedList () | |
Default constructor. | |
GelLinkedList (const GelLinkedList< dType > &list) | |
Copy constructor. | |
~GelLinkedList () | |
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. | |
GelLinkedList< dType > & | operator= (const GelLinkedList< dType > &l) |
Assigns a list to this list. | |
GelLinkedList< dType > & | operator+= (const GelLinkedList< 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. |
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.
gel::GelLinkedList< dType >::GelLinkedList | ( | ) | [inline] |
Default constructor.
Constructs an empty list.
gel::GelLinkedList< dType >::GelLinkedList | ( | const GelLinkedList< dType > & | list | ) | [inline] |
Copy constructor.
gel::GelLinkedList< dType >::~GelLinkedList | ( | ) | [inline] |
Destructor.
void gel::GelLinkedList< dType >::append | ( | const dType & | newData | ) | [inline] |
Inserts an item at the end of the list.
newData | : The item to insert. |
void gel::GelLinkedList< dType >::prepend | ( | const dType & | newData | ) | [inline] |
Inserts an item at the beginning of the list.
newData | : The item to insert. |
void gel::GelLinkedList< dType >::insert | ( | int | i, |
const dType & | newData | ||
) | [inline] |
Inserts an item at the specified index.
i | : The index at which to insert the item. |
newData | : The item to insert. |
void gel::GelLinkedList< dType >::removeFirst | ( | ) | [inline] |
Removes the first item in the list.
void gel::GelLinkedList< dType >::removeLast | ( | ) | [inline] |
Removes the last item in the list.
void gel::GelLinkedList< dType >::remove | ( | int | i | ) | [inline] |
Removes the item at the specified index.
i | : The index of the item to remove. |
int gel::GelLinkedList< dType >::removeAll | ( | dType | val | ) | [inline] |
Removes all occurences of the specified value.
val | : The value to search for. |
void gel::GelLinkedList< dType >::replace | ( | int | i, |
const dType & | newData | ||
) | [inline] |
Replaces the item at the specified index with a new value.
i | : The index of the item to be replaced. |
newData | : The new value of the item. |
dType& gel::GelLinkedList< dType >::getFirst | ( | ) | [inline] |
Gets a reference to the first item in the list.
const dType& gel::GelLinkedList< dType >::getFirst | ( | ) | const [inline] |
Gets a reference to the first item in the list.
This is an overloaded function.
dType& gel::GelLinkedList< dType >::getLast | ( | ) | [inline] |
Gets a reference to the last item in the list.
const dType& gel::GelLinkedList< dType >::getLast | ( | ) | const [inline] |
Gets a reference to the last item in the list.
This is an overloaded function.
dType& gel::GelLinkedList< dType >::getItem | ( | int | i | ) | [inline] |
Gets a reference to the item at the specified index.
i | : The index of the item to get. |
const dType& gel::GelLinkedList< dType >::getItem | ( | int | i | ) | const [inline] |
Gets a reference to the item at the specified index.
This is an overloaded function.
dType gel::GelLinkedList< dType >::takeFirst | ( | ) | [inline] |
Removes the first item in the list and returns it.
dType gel::GelLinkedList< dType >::takeLast | ( | ) | [inline] |
Removes the last item in the list and returns it.
dType gel::GelLinkedList< dType >::takeItem | ( | int | i | ) | [inline] |
Removes the item at the specified index and returns it.
i | : The index of the item to take. |
void gel::GelLinkedList< dType >::reverse | ( | ) | [inline] |
Reverses the order of the items in the list.
This function currently does not work. Calling it will do nothing.
int gel::GelLinkedList< dType >::countAll | ( | dType | val | ) | [inline] |
Counts the number of occurences of the specified value.
val | : The value to search for. |
int gel::GelLinkedList< dType >::getSize | ( | ) | [inline] |
Gets the number of items in the list.
void gel::GelLinkedList< dType >::clear | ( | ) | [inline] |
Removes all of the items from the list.
bool gel::GelLinkedList< dType >::isMember | ( | const dType & | val | ) | [inline] |
Checks if the specified value exists in the list.
val | : The value to look for. |
bool gel::GelLinkedList< dType >::isEmpty | ( | ) | [inline] |
Determines whether or not the list is empty.
GelLinkedList<dType>& gel::GelLinkedList< dType >::operator= | ( | const GelLinkedList< dType > & | l | ) | [inline] |
Assigns a list to this list.
GelLinkedList<dType>& gel::GelLinkedList< dType >::operator+= | ( | const GelLinkedList< dType > & | l | ) | [inline] |
Appends all items from a list to this list.
dType& gel::GelLinkedList< dType >::operator[] | ( | int | i | ) | [inline] |
Gets a reference to the item at the specified index.
const dType& gel::GelLinkedList< dType >::operator[] | ( | int | i | ) | const [inline] |
Gets a reference to the item at the specified index.
This is an overloaded function.
API Documentation by Mark D. Procarione | Generated by |