Difference between revisions of "Computer Science/61b/Homework/hw8/list/Queue.java"
< Computer Science | 61b | Homework | hw8 | list
m (Lensovet moved page CS/61b/Homework/hw8/list/Queue.java to Computer Science/61b/Homework/hw8/list/Queue.java) |
|
(One intermediate revision by the same user not shown) | |
(No difference)
|
Latest revision as of 03:51, 20 February 2023
- This page contains computer code. Unlike all articles on the lensowiki, which are released under the GFDL, this code is released under the GPL.
Copyright 2006, 2007 Paul Borokhov. All rights reserved.
This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
The code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Queue.java */ package list; public interface Queue { /** * size() returns the size of this Queue. * @return the size of this Queue. * Performance: runs in O(1) time. **/ public int size(); /** * isEmpty() returns true if this Queue is empty, false otherwise. * @return true if this Queue is empty, false otherwise. * Performance: runs in O(1) time. **/ public boolean isEmpty(); /** * enqueue() inserts an object at the end of the Queue. * @param item the item to be enqueued. **/ public void enqueue(Object item); /** * dequeue() removes and returns the object at the front of the Queue. * @return the item dequeued. * @throws a QueueEmptyException if the Queue is empty. **/ public Object dequeue() throws QueueEmptyException; /** * dequeue() returns the object at the front of the Queue. * @return the item at the front of the Queue. * @throws a QueueEmptyException if the Queue is empty. **/ public Object front() throws QueueEmptyException; }