package rebelsky.linear; /** * Generic linear structures. Linear structures are collections * whose primary operations are put (add something * to the collection) and get (get something from * the collection). The particular type of linear structure * determines the exact meaning of get. * * @author Samuel A. Rebelsky * @version 1.0 of October 2004 */ public interface Linear { /** * Add something to the collection. */ public void put(Object addMe); /** * Get something from the collection, thereby * removing it from the collection. * * @pre * The collection is not empty. * @exception Exception * If the collection is empty. */ public Object get() throws Exception; /** * Determine what get() will next return, but * don't remove it. * * @pre * The collection is not empty. * @exception Exception * If the collection is empty. */ public Object peek() throws Exception; /** * Determine if the collection is empty */ public boolean isEmpty(); } // interface Linear