import java.util.ArrayList; // needed or ArrayList class not found
/**
*  This class shows an implementation of the queue abstract data type (ADT)
*  as an ArrayList.  Because it uses the ArrayList ADT, it has access to 
*  its methods. It will enqueue an element if the queue 
*  is not full; dequeue an element if the queue is not empty; test the queue
*  for emptyness and fullness; and it will return the value stored in the
*  element at the end of the list
*
*/

public class QueueAsArrayList
{
      // chose to make this a queue of Customers
   private ArrayList<Customer> myALqueue;
	
   // constructor	
   public QueueAsArrayList ()
	{
	   myALqueue = new ArrayList <Customer> ();
	}
	
	/**
	* 
	*  tells whether queue is empty
	* 
	* @return true if empty, false otherwise
	*
	*/	
	public boolean isEmpty()
	{
	    boolean response;
		 
		 response = false; // assuming not empty
		 if (this.myALqueue.isEmpty()) // using ArrayList method
		    response = true;  // it was empty
		 return response;	 
	}
	
	/** 
	* tells whether queue is full
	*
	* @return  always false because ArrayList is implementation
	*
	*/
	public boolean isFull()
	{
	  return false;
	}    
	
	/**
	*   tells the value in the first element if it exists
	*
	*   @return  value in first element or "queue empty"
	*
	*/
	public String first ()
	{
	   String firstElement;
		if (this.isEmpty())
		   firstElement = " empty queue ";
		else
		{
		  firstElement = " " +  myALqueue.get(0); // need to force it to be a String
	   }
  	   return firstElement;
    }
 	 
	 /**
	  *  enQueue method adds a given value to the end of the queue
	  *  if the queue is not full.  Otherwise, it does nothing
	  * 
	  *  @param value to be added to the queue
	  */
     public void enqueue (Customer cName)
	  {
		    myALqueue.add(cName);
	  }

     /**
	  *  deQueue method removes the first item in the queue
	  *  if there is a first item.  Otherwise it does nothing
	  *
	  */
     public void dequeue()
	  {
	     if (this.isEmpty())
		  { 
		    // do nothing 
		  }
		  else
		  {
		     myALqueue.remove(0); // using ArrayList method
	 	  }	
		} // end dequeue  
} // end QueueAsArrayList	
		 