/** * Interface to define an abstract Quack (Stack + Queue) * @author Jay Summet - Georgia Tech */ public interface Quack { /** * Add an element onto the tail of the Quack * Throws a RuntimeException if the underlying storage mechanism is out of room * @param element the element to add to the end of the Quack */ public void enqueue(E element) throws java.lang.RuntimeException; /** * Push an element onto the top (head) of the Quack * Throws a RuntimeException if the underlying storage mechanism is out of room * @param element the element to add to the top of the Quack */ public void push(E element) throws java.lang.RuntimeException; /** * Peek at, but don't remove, the head of the Quack * @return the head of the Quack (top) - Returns null if the Quack is empty */ public E peek(); /** * Pop an object from the Quack * * @return the head (top) of the Quack and * remove it from the Quack - Returns null if the Quack is empty */ public E pop(); /** * Dequeue an object from the Quack (Note: Same behavior as Pop!) * * @return the head (top) of the Quack and * remove it from the Quack - Returns null if the Quack is empty */ public E dequeue(); /** * Return the size of the Quack * @return the number of elements in the Quack */ public int size(); /** * Method to see if the Quack is empty * @return true if the Quack is empty, else false */ public boolean isEmpty(); }