

import java.util.Iterator;

public interface List {

	// these methods are implemented in NodeList.java

	/** Returns the number of elements in this list. */
	public int size();

	/** Returns whether the list is empty. */
	public boolean isEmpty();

	/** Returns the first node in the list. */
	public Position first();

	/** Returns the last node in the list. */
	public Position last();

	/** Returns the node after a given node in the list. */
	public Position next(Position p) throws ExceptionInvalidPosition, ExceptionBoundaryViolation;

	/** Returns the node before a given node in the list. */
	public Position prev(Position p) throws ExceptionInvalidPosition, ExceptionBoundaryViolation;

	/** Inserts an element at the front of the list. */
	public Position insertFirst(Object e);

	/** Inserts and element at the back of the list. */
	public Position insertLast(Object e);

	/** Inserts an element after the given node in the list. */
	public Position insertAfter(Position p, Object e) throws ExceptionInvalidPosition;

	/** Inserts an element before the given node in the list. */
	public Position insertBefore(Position p, Object e) throws ExceptionInvalidPosition;

	/** Removes a node from the list. */
	public Object remove(Position p) throws ExceptionInvalidPosition;

	/** Replaces the element stored at the given node. */
	public Object replace(Position p, Object e) throws ExceptionInvalidPosition;
	
	//public Iterator positions();
  	/** Returns an iterator of all the elements in the list. */
  	public Iterator elements();

}