Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

List Class Template Reference

List of all members.

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
Elemlistarray

template<class Elem>
class List< Elem >


Constructor & Destructor Documentation

template<class Elem>
List< Elem >::List int    sz = LIST_SIZE
 

Definition at line 30 of file LADTTEX.C.

00030                        {  // Constructor: initialize
00031   msize = sz; numinlist = curr = 0;
00032   listarray = new Elem[sz];
00033 }

template<class Elem>
List< Elem >::~List  
 

Definition at line 36 of file LADTTEX.C.

00036                                        : return array space
00037   { delete [] listarray; }

template<class Elem>
List< Elem >::List int    = LIST_SIZE
 

template<class Elem>
List< Elem >::~List  
 


Member Function Documentation

template<class Elem>
void List< Elem >::append const    Elem
 

template<class Elem>
void List< Elem >::append const Elem    item
 

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 }

template<class Elem>
void List< Elem >::clear  
 

template<class Elem>
void List< Elem >::clear  
 

Definition at line 40 of file LADTTEX.C.

00041   { numinlist = curr = 0; } // Simply reinitialize values

template<class Elem>
Elem List< Elem >::currValue   const
 

template<class Elem>
Elem List< Elem >::currValue   const
 

Referenced by build_tree(), print(), and read_freqs().

template<class Elem>
bool List< Elem >::find int   
 

template<class Elem>
bool List< Elem >::find int   
 

template<class Elem>
void List< Elem >::insert const    Elem
 

template<class Elem>
void List< Elem >::insert const Elem    item
 

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 }

template<class Elem>
bool List< Elem >::isEmpty   const
 

template<class Elem>
bool List< Elem >::isEmpty   const
 

Referenced by print(), and remove().

template<class Elem>
bool List< Elem >::isInList   const
 

template<class Elem>
bool List< Elem >::isInList   const
 

Referenced by build_tree(), print(), read_freqs(), and remove().

template<class Elem>
int List< Elem >::length   const
 

template<class Elem>
int List< Elem >::length   const
 

Definition at line 82 of file LADTTEX.C.

00083   { return numinlist; }

template<class Elem>
void List< Elem >::next  
 

template<class Elem>
void List< Elem >::next  
 

Definition at line 79 of file LADTTEX.C.

Referenced by build_tree(), main(), print(), and read_freqs().

00079 { curr++; } // Move to next position

template<class Elem>
void List< Elem >::prev  
 

template<class Elem>
void List< Elem >::prev  
 

Definition at line 76 of file LADTTEX.C.

00076 { curr--; } // Move to previous pos

template<class Elem>
Elem List< Elem >::remove  
 

template<class Elem>
Elem List< Elem >::remove  
 

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 }

template<class Elem>
void List< Elem >::setFirst  
 

template<class Elem>
void List< Elem >::setFirst  
 

Definition at line 72 of file LADTTEX.C.

Referenced by build_tree(), main(), print(), and read_freqs().

00073   { curr = 0; }

template<class Elem>
void List< Elem >::setPos int   
 

template<class Elem>
void List< Elem >::setPos int    pos
 

Definition at line 86 of file LADTTEX.C.

Referenced by build_tree().

00087   {curr = pos; }

template<class Elem>
void List< Elem >::setValue const    Elem
 

template<class Elem>
void List< Elem >::setValue const    Elem
 


Member Data Documentation

template<class Elem>
int List::curr [private]
 

Definition at line 8 of file LADTTEX.C.

template<class Elem>
Elem* List::listarray [private]
 

Definition at line 9 of file LADTTEX.C.

template<class Elem>
int List::msize [private]
 

Definition at line 6 of file LADTTEX.C.

template<class Elem>
int List::numinlist [private]
 

Definition at line 7 of file LADTTEX.C.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:14 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001