-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueueInterface.java
51 lines (46 loc) · 1.26 KB
/
QueueInterface.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* @author Skully (https://github.com/ImSkully)
* @email [email protected]
*/
public interface QueueInterface {
/**
* isEmpty()
* Checks if the queue is empty.
*
* @return true if the queue is empty, false otherwise.
*/
public boolean isEmpty();
/**
* enqueue(Object newItem)
* Adds a new item to the back of the queue.
*
* @param newItem The item to be added to the queue.
* @returns true if the item was successfully added, false otherwise.
* @throws QueueException if the queue is full.
*/
public void enqueue(Object newItem) throws QueueException;
/**
* dequeue()
* Removes the front item from the queue.
*
* @returns The item that was removed from the queue.
* @throws QueueException if the queue is empty.
*/
public Object dequeue() throws QueueException;
/**
* dequeueAll()
* Removes all items from the queue.
*
* @returns true if the queue was successfully emptied, false otherwise.
* @throws QueueException if the queue is empty.
*/
public void dequeueAll();
/**
* peek()
* Returns the front item in the queue.
*
* @returns The front item in the queue.
* @throws QueueException if the queue is empty.
*/
public Object peek() throws QueueException;
}