/*
 * SimpleList.java
 *
 * Version:
 *    $Id: SimpleList.java,v 1.2 2001/11/28 14:39:39 ptt Exp $
 *
 * Revisions:
 *    $Log: SimpleList.java,v $
 *    Revision 1.2  2001/11/28 14:39:39  ptt
 *    Added get method
 *
 *    Revision 1.1  2001/11/27 18:36:28  ptt
 *    INITIAL COMMIT
 *
 */

import java.util.Iterator;

/**
 * Interface for a simple list.
 *
 * @author Paul Tymann
 */

public interface SimpleList {

    /**
     * Add a new element to the end of the list.
     *
     * @param data the element to add to the list.
     */

    public void add( Object data );

    /**
     * Inserts the specified element at the specified position in the list.
     * The elements in the list will be shifted to the right to make room
     * for the new element.
     *
     * @param pos position at which element is to be inserted.
     * @param data the element to add to the list.
     *
     * @exception IndexOutOfBoundsException thrown if pos is invalid.
     */

    public void add( int pos, Object data ) throws IndexOutOfBoundsException;

    /**
     * Determine if the specified element is in the list.
     *
     * @param target the element to look for.
     *
     * @returns true if the element is in the list and false otherwise.
     */

    public boolean contains( Object target );

    /**
     * Returns the index of the first occurence of the specified element
     * in the list or -1 if the element is not in the list.
     *
     * @param target the element to look for.
     *
     * @returns the index of the specified element or -1 if the element
     *          is not in the list.
     */

    public int indexOf( Object target );

    /**
     * Returns the element at the specified position in the list.
     *
     * @param pos the position of the element to return.
     *
     * @return the specified element in the list.
     *
     * @exception IndexOutOfBoundsException if pos is invalid.
     */

    public Object get( int pos ) throws IndexOutOfBoundsException;

    /**
     * Remove the element at the specified position from the list.
     *
     * @param pos position of the element to remove
     *
     * @exception IndexOutOfBoundsException if pos is invalid.
     */

    public void remove( int pos ) throws IndexOutOfBoundsException;

    /**
     * Remove the first occurance of the specified element from the
     * list.
     *
     * @param target the element to remove.
     */

    public void remove( Object target );

    /**
     * Remove all of the elements from the list.
     */

    public void clear();

    /**
     * Returns an iterator over the elements in the list.
     *
     * @returns an iterator over the elements in the list.
     */

    public Iterator iterator();

    /**
     * Return the number of elements currently in the list.
     *
     * @return the number of elements in the list.
     */

    public int size();

    /**
     * Return true if the list is empty.
     *
     * @return true if the list is empty.
     */

    public boolean isEmpty();

} // SimpleList

