/** * Initializes the AbstractQueue. * * @param maxSize Maximum queue size. * * @exception IllegalArgumentException Illegal size. */ protected AbstractQueue(final int maxSize) { setMaximumSize(maxSize); }
/** * Check if the queue is full. * * @return True if the queue is full. */ public boolean isFull() { if (maximumSize != UNLIMITED_MAXIMUM_SIZE && size() >= maximumSize) return true; return false; }
/** * Remove and return the first object in the queue. * * @return Dequeued object. * * @exception EmptyCollectionException The queue is empty. */ public E remove() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException(); return removeFirst(); }
/** * Append and object to the underling list. * * @param obj Object to enqueue. * @return True if collection was modified. * * @exception FullCollectionException The queue is full. */ public boolean add(E obj) throws FullCollectionException { if (isFull()) throw new FullCollectionException(); return addLast(obj); }
/** * Check if the queue is empty. * * @return True if the queue is empty. */ public boolean isEmpty() { if (size() <= 0) return true; return false; }