#include <ArrayList.h>
Public Member Functions | |
| List () | |
| ~List () | |
| List (const List &original_copy) | |
| List & | operator= (const List &original_copy) |
| list_type & | operator[] (unsigned long position) |
| void | insert (list_type input, unsigned long position) |
| void | insert (list_type input) |
| void | replace (list_type input, list_type filler, unsigned long position) |
| void | replace (list_type input) |
| void | del (unsigned long position) |
| void | del () |
| unsigned long | getIndexOf (list_type input) |
| const unsigned long | size (void) |
| void | clear (void) |
| void | compress (void) |
Private Attributes | |
| list_type * | array |
| unsigned long | list_size |
| unsigned long | allocation_size |
Has the following member functions [x] - Overloaded: Returns element x (starting at 0) in the list between the brackets. If no x argument is specified it returns the last element on the list. If x is invalid it returns 0 size - returns number of elements in the list insert(item, x) - inserts <item> at position x in the list. If no x argument is specified it adds item to the end of the list replace(item, filler, x) - replaces the element at position x with <item>. If x is greater than the current list size, the list is increased and the other values are assigned filler del(OPTIONAL x) - deletes the element at position x. If no x argument is specified it deletes the last element on the list compress - reallocates memory to fit the number of elements. Best used when the number of elements decreases clear - empties the list and returns storage The assignment and copy constructor operators are defined
EXAMPLE
List<int, 20> A; A.size; // Returns 0 A.insert(10); // Adds 10 to the end of the list A[0]; // Returns 10 A.insert(1,0); // Adds 1 to front of list so list reads 1,10 A.replace(5,0, 1); // Replaces element 1 with a 5. List reads 1,5 A.del(); // Deletes the last item on the list. List reads 1 A.size; // Returns 1
|
|||||||||
|
Default constructor |
|
|||||||||
|
Destructor |
|
||||||||||
|
Copy constructor
|
|
||||||||||
|
Clear the list |
|
||||||||||
|
Compress the list, to meet the current state of the list.
|
|
|||||||||
|
Delete the element at the end of the list |
|
||||||||||
|
Delete the element at position position.
|
|
||||||||||
|
Returns the index of the specified item or MAX_UNSIGNED_LONG if not found
|
|
||||||||||
|
Insert at the end of the list.
|
|
||||||||||||||||
|
Insert an element at position position in the list
|
|
||||||||||
|
|
|
||||||||||
|
Access an element by its index in the array
|
|
||||||||||
|
replace the last element of the list by input
|
|
||||||||||||||||||||
|
replace the value at position by input. If the size of the list is less than position, it increase the capacity of the list and fill slot with filler.
|
|
||||||||||
|
Get the size of the list |
|
|||||
|
Size of array |
|
|||||
|
Store all values |
|
|||||
|
Number of element in the list |
1.4.2