/** * An interface for linear objects. Designed to support both * static and dynamic implementation. * * @author Samuel A. Rebelsky * @version 1.1 of November 1999 */ public interface Linear { /** * Add an element. * Pre: There is space for another element. * Pre: The element to be added is not null. * Post: The element is added to the linear collection. * Post: The size of the collection increases by 1. */ public void add(Object elt); /** * Delete and return an element. Which element is removed is determined * by the ``deletion strategy'' of the particular linear collection. * Pre: The collection is not empty. * Post: Returns an element in the collection. * Post: Deletes an element from the collection. * Post: The size of the collection decreases by 1. */ public Object get(); /** * Determine the next object we will get when we call get. * Pre: The collection is not empty. * Post: Returns the ``first'' element in the collection. * Post: Does not otherwise affect the collection. */ public Object peek(); /** * Is the collection full? (That is, it has no space remaining.) */ public boolean isFull(); /** * Is the collection empty? (That is, it has no elements.) */ public boolean isEmpty(); } // interface Linear