/** * Simple collections that allow you to add elements and * grab the occasional element. Different subinterfaces * provide different policies for which element you get * when you grab an element. * * @author Samuel A. Rebelsky */ public interface Linear { // +-------------------------------------------------- // | Design Notes | // +---------------+ /* At Arjun's request, we're making the key methods throw exceptions rather than expecting users to check preconditions. */ // +-------------------------------------------------- // | Methods | // +---------+ /** * Add a new element to the structure. * * @exception FullStructureException * When there is no room for another element. */ public void add(Object element) throws FullStructureException; /** * Get an element from the structure, deleting the element * from the structure. * * @exception EmptyStructureException */ public Object get() throws EmptyStructureException; /** * Determine the next value to be returned by get. * * @exception EmptyStructureException */ public Object peek() throws EmptyStructureException; /** * Determine if the structure is empty. */ public boolean isEmpty(); } // interface Linear