import java.util.*;

/**
 * The MyQueue class is a FIFO list.  Elements are added to the end of the queue
 * and removed from the beginning of the queue.
 */
public class MyQueue
{
    
    // Remember that protected means its private, but subclasses can still access it.
    protected Vector list;
    
    /** 
     * Constructor
     */
    public MyQueue()
    {
	list = new Vector();
    }
    
    /**
     * Add an element to the queue.
     *
     * @param o the object to add to the END of the queue.
     */
    public void add(Object o)
    {
	if (o != null)
	    list.add(o);
    }
    
    /**
     * Remove and element from the beginning of the queue.
     *
     * @return the first element in the list, or null if there are no more elements.
     */
    public Object remove()
    {
	// Make sure we have elements to return.
	if (list.size() == 0)
	    return null;
	return list.remove(0);
    }
    
    /**
     * This method is ONLY for this demo.  It's usually a BAD THING to provide
     * a handle to your private contents like this.  However, for this example, we
     * needed to be able to list the contents easily.
     * <p>
     * The REAL way to do this would have been to return an Enumeration of the Vector.
     *
     * @return the contents as Vector.
     */ 
    public Vector getList()
    {
	return list;
	// We *should* return list.elements(), an Enumeration.  But we're lazy!
    }

}
