-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriorityQueueInterface.java
More file actions
31 lines (26 loc) · 1.05 KB
/
PriorityQueueInterface.java
File metadata and controls
31 lines (26 loc) · 1.05 KB
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
/** An interface for the ADT priority queue. */
public interface PriorityQueueInterface<T extends Comparable<? super T>> {
/** Adds a new entry to this priority queue.
* @param newEntry An object to be added.
*/
public void add(T newEntry);
/** Removes and returns the entry having the highest priority.
* @return Either the object having the highest priority or,
* if the priority queue is empty before the operation, null.
*/
public T remove();
/** Retrieves the entry having the highest priority.
* @return Either the object having the highest priority or, if the priority queue is empty, null.
*/
public T peek();
/** Detects whether this priority queue is empty.
* @return True if the priority queue is emtpy, or false otherwise.
*/
public boolean isEmpty();
/** Gets the size of this priority queue.
* @return The number of entries currently in the priority queue.
*/
public int getSize();
/** Removes all entries from this priority queue. */
public void clear();
} // end PriorityQueueInterface