// ListAr.h
// Inherits from AbsList.  This class contains the actual
// definition used.  This array uses Vector from the standard
// library to create a bounded array.  This list uses templates
// and in my program, I made a list of words.  The function add
// puts words in the end of the list.  The function removes from
// the beginning of the list.  Function getFront returns the first
// word in the list.  In this program, getFront takes a word and
// feeds it to an external function wordMixer to create another 
// word that has a different permutation of the original word.
// The names of other functions are self-explanator and the 
// uses of these functions are trivial.

#ifndef __ListAr
#define __ListAr
#include "AbsList.h"
#include "Vector.cpp"

// Array-based List
template <class Etype>
class List : public AbsList<Etype>
{
  public:
    List( ); // constructor
    ~List( ) { } // destructor

	// overloading operator =
    const List & operator=( const List & Rhs ); 

	// add to the end of the list
    void add( const Etype & X ); 

	// remove front the beginning of the list
	// used in conjunction with getFront
    void remove( ); 
					
	// returns the first item in list
    const Etype & getFront( ) const; 

	// checks whether the list is empty
    int isEmpty( ) const   { return currentSize == 0; } 
	
	// returns the size/length of the list
    int sizeOf( );

	// prints the list
    ostream & print( ostream & out );
  private:
    int maxSize;
    int currentSize;
    int front;
    int back;
	// uses Vector to create a vecList of Etype
    Vector<Etype> VecList;

	// Double array
    void doubleList( );             
	
	// Add one with wraparound
    void increment( int & X ) const; 
};
#endif
