import java.util.Iterator;
/**
* ListInterface
provides the user interface for the general list.
*
* @author
* Mark Boshart
* @version 1.0
*/
public interface ListInterface
{
/**
* Determines whether a list is empty.
* Precondition: None.
* Postcondition: Returns true if the list is empty, otherwise returns false.
* Throws: None.
*/
public boolean isEmpty();
/**
* Determines the length of a list.
* Precondition: None.
* Postcondition: Returns the number of items that are currently in the list.
* Throws: None.
*/
public int size();
/**
* Adds an item to the list at position index.
* Precondition: index indicates the position at which the item should be inserted in the list.
* Postcondition: If insertion is successful, item is at position index in the list, and other items are renumbered accordingly.
* Throws: ListException if index < 1 or index > size()+1.
* Throws: ListException if item cannot be placed on the list.
*
* @param index int
position to insert the object.
* @param item Object
object to be inserted.
*/
public void add(int index, Object item) throws ListException;
/**
* Retrieves a list item by position.
* Precondition: index is the number of the item to be retrieved.
* Postcondition: If 1 <= index <= size(), the item at position index in the list is returned.
* Throws: ListException if index < 1 or index > size().
*
* @param index int
position to retrieve the object.
*/
public Object get(int index) throws ListException;
/**
* Deletes an item from the list at a given position.
* Precondition: index indicates where the deletion should occur.
* Postcondition: If 1 <= index <= size(), the item at position index in the list is deleted, and other items are renumbered accordingly.
* Throws: ListException if index < 1 or index > size().
*
* @param index int
position to remove the object.
*/
public void remove(int index) throws ListException;
/**
* Deletes all the items from the list.
* Precondition: None.
* Postcondition: The list is empty.
* Throws: None.
*/
public void removeAll();
/**
* Returns an Iterator for the list.
* Precondition: None.
* Postcondition: An Iterator is returned.
* Throws: None.
*/
public Iterator iterator();
} // end ListInterface