/** * Interface for Queue * Names follow textbook rather than Java standard * @author gtowell * Created: Sep 2019 * Modified: Oct 20, 2020 * Modified: mar 26, 2021 * Modified: Aug 9, 2021 */ public interface QueueInterface { /** * The number of items in the queue * @return the number of items in the queue * **/ int size(); /** * returns true iff the queue contains no items * @return true iff the queue contains no items */ boolean isEmpty(); /** * The next item in the queue. This is distinct from poll in that this returns * the next items in the queue but DOES NOT remove it from the queue. * @return the next item in the queue or NULL if the queue is empty */ E getFront(); /** * Add an item to the queue. * @param e the item to be added * @return true if the item could be added to the queue. False otherwise */ boolean enqueue(E e); /** * Remove and return the item from the front of the queue. Distinst from peek in that * this removes the first item in addition to returning it. * @return the first item, or null iff the queue is empty. */ E dequeue(); // remove from, and return the first item in q /** * Remove all elements from the queue * As a result, after executing this method, isEmpty() will return true */ void clear(); }