All Packages Class Hierarchy This Package Previous Next Index
Interface structure.PriorityQueue
- public interface PriorityQueue
Interface describing an queue of prioritized values.
This linear-like structure has values that
are inserted in such a way as to allow them to be removed in
increasing order.
add(Comparable)
- Add a value to the priority queue.
clear()
- Remove all the elements from the queue.
isEmpty()
- Determine if the queue is empty.
peek()
- Fetch lowest valued (highest priority) item from queue.
remove()
- Returns the minimum value from the queue.
size()
- Determine the size of the queue.
peek
public abstract Comparable peek()
- Fetch lowest valued (highest priority) item from queue.
- Precondition:
- !isEmpty()
- Postcondition:
- returns the minimum value in priority queue
- Returns:
- The smallest value from queue.
remove
public abstract Comparable remove()
- Returns the minimum value from the queue.
- Precondition:
- !isEmpty()
- Postcondition:
- returns and removes minimum value from queue
- Returns:
- The minimum value in the queue.
add
public abstract void add(Comparable value)
- Add a value to the priority queue.
- Precondition:
- value is non-null comparable
- Postcondition:
- value is added to priority queue
- Parameters:
- value - The value to be added.
isEmpty
public abstract boolean isEmpty()
- Determine if the queue is empty.
- Postcondition:
- returns true iff no elements are in queue
- Returns:
- True if the queue is empty.
size
public abstract int size()
- Determine the size of the queue.
- Postcondition:
- returns number of elements within queue
- Returns:
- The number of elements within the queue.
clear
public abstract void clear()
- Remove all the elements from the queue.
- Postcondition:
- removes all elements from queue
All Packages Class Hierarchy This Package Previous Next Index