import java.util.*;

/**
 * A class that represents a list of Snakes and Ladders players.
 * @author Derek Bridge 666 d.bridge@cs.ucc.ie
 */
public class ListOfPlayers
{
/* =======================================================================
       CONSTRUCTORS
   =======================================================================
*/
    /**
     * Allocates a new, empty list of players.
     */
    public ListOfPlayers()
    {   list = new ArrayList(2);
    }

/* =======================================================================
       PUBLIC INTERFACE
   =======================================================================
*/
/* --Getters----------------------------------------------------------- */

    /**
     * Returns whether the list is empty
     * @return true if the list is empty; false otherwise
     */
    public boolean isEmpty()
    {   return list.isEmpty();
    }

    /**
     * Returns whether a player is in the list
     * @param thePlayer the player we're looking for
     * @return true if the player is in the list; false otherwise
     */
    public boolean contains(Player thePlayer)
    {   return list.contains(thePlayer);
    }

    /**
     * Returns an iteratir over the list.
     */
    public Iterator iterator()
    {   return list.iterator();
    }

/* --Setters----------------------------------------------------------- */

    /**
     * Insert a player into the list.
     * @param thePlayer the player being inserted
     */
    public void add(Player thePlayer)
    {   list.add(thePlayer);
    }

    /**
     * Remove a player from the list.
     * @param thePlayer the player being removed
     */
    public void remove(Player thePlayer)
    {   list.remove(thePlayer);
    }

/* =======================================================================
       INSTANCE VARIABLES & CLASS VARIABLES
   =======================================================================
*/
    /**
     * The list in which the players are stored.
     */
    private List list;
}
