Public Methods | |
List (int=LIST_SIZE) | |
~List () | |
void | clear () |
void | insert (const Elem) |
void | append (const Elem) |
Elem | remove () |
void | setFirst () |
void | prev () |
void | next () |
int | length () const |
void | setPos (int) |
void | setValue (const Elem) |
Elem | currValue () const |
bool | isEmpty () const |
bool | isInList () const |
bool | find (int) |
List (int=LIST_SIZE) | |
~List () | |
void | clear () |
void | insert (const Elem) |
void | append (const Elem) |
Elem | remove () |
void | setFirst () |
void | prev () |
void | next () |
int | length () const |
void | setPos (int) |
void | setValue (const Elem) |
Elem | currValue () const |
bool | isEmpty () const |
bool | isInList () const |
bool | find (int) |
Private Attributes | |
int | msize |
int | numinlist |
int | curr |
Elem * | listarray |
|
Definition at line 30 of file LADTTEX.C. 00030 { // Constructor: initialize 00031 msize = sz; numinlist = curr = 0; 00032 listarray = new Elem[sz]; 00033 } |
|
|
|
|
|
|
|
|
|
Definition at line 56 of file LADTTEX.C. Referenced by build_tree(), main(), and read_freqs().
00056 { // Insert at tail 00057 assert(numinlist < msize); // List must not be full 00058 listarray[numinlist++] = item; // Increment list size 00059 } |
|
|
|
Definition at line 40 of file LADTTEX.C. 00041 { numinlist = curr = 0; } // Simply reinitialize values |
|
|
|
Referenced by build_tree(), print(), and read_freqs().
|
|
|
|
|
|
|
|
Definition at line 45 of file LADTTEX.C. Referenced by build_tree(), main(), and read_freqs().
00045 { 00046 // Array must not be full and curr must be a legal position 00047 assert((numinlist < msize) && (curr >=0) 00048 && (curr <= numinlist)); 00049 for(int i=numinlist; i>curr; i--) // Shift up to make room 00050 listarray[i] = listarray[i-1]; 00051 listarray[curr] = item; 00052 numinlist++; // Increment current list size 00053 } |
|
|
|
Referenced by print(), and remove().
|
|
|
|
Referenced by build_tree(), print(), read_freqs(), and remove().
|
|
|
|
Definition at line 82 of file LADTTEX.C. 00083 { return numinlist; } |
|
|
|
Definition at line 79 of file LADTTEX.C. Referenced by build_tree(), main(), print(), and read_freqs().
00079 { curr++; } // Move to next position |
|
|
|
Definition at line 76 of file LADTTEX.C. 00076 { curr--; } // Move to previous pos |
|
|
|
Definition at line 62 of file LADTTEX.C. Referenced by build_tree().
00062 { // Remove and return current Elem 00063 assert(!isEmpty() && isInList()); // Must be Elem to remove 00064 Elem temp = listarray[curr]; // Store removed Elem 00065 for(int i=curr; i<numinlist-1; i++) // Shift elements down 00066 listarray[i] = listarray[i+1]; 00067 numinlist--; // Decrement current list size 00068 return temp; 00069 } |
|
|
|
Definition at line 72 of file LADTTEX.C. Referenced by build_tree(), main(), print(), and read_freqs().
00073 { curr = 0; } |
|
|
|
Definition at line 86 of file LADTTEX.C. Referenced by build_tree().
00087 {curr = pos; } |
|
|
|
|
|
|
|
|
|
|
|
|