/** * * Interface for a queue for an array implementation * * Author Alex Rudniy */ public interface ArrayQueue { /** * enqueue: adds a new element to the end of the queue * N - number of elements in the array * * @param item The element to be inserted * @pre size() < N * @post size() == size()@pre + 1 */ public void enqueue(Object item); /** * dequeue: removes the element at the front of the queue and returns the element * * @pre size() > 0 * @post size() == size()@pre - 1 * @post @result == first()@pre; */ public Object dequeue(); /** * size: returns the number of elements in the queue * * @pre true * @post @nochange */ public int size(); /** * first: returns the element at the front of the queue * * @pre size() > 0 * @post @nochange */ public Object first(); /** * last: returns the element at the end of the queue * * @pre size() > 0 * @post = @nochange */ public Object last(); }