Package dsa.lab09.base
Interface PriorityQueue<Priority extends Comparable<Priority>,Item> 
- Type Parameters:
- Priority- the priority type
- Item- the item type
- All Superinterfaces:
- Container<PriorityQueueItem<Priority,,- Item>> - Iterable<PriorityQueueItem<Priority,- Item>> 
- All Known Implementing Classes:
- ArrayPriorityQueue,- ArrayPriorityQueue,- BinaryHeapPriorityQueue,- BinaryHeapPriorityQueue,- SortedArrayPriorityQueue,- SortedArrayPriorityQueue
public interface PriorityQueue<Priority extends Comparable<Priority>,Item> 
extends Container<PriorityQueueItem<Priority,Item>> 
A priority queue.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classPriorityQueue.ItemIterator<Priority extends Comparable<Priority>,Item> An iterator over the items in a priority queue.
- 
Method SummaryModifier and TypeMethodDescriptionvoidinsert(PriorityQueueItem<Priority, Item> item) Insert the given prioritised item.default voidInsert the given prioritised item.items()Get a forward iterable that yields each prioritised item once.Get a reverse iterable that yields each item once.max()Get the item with the greatest priority.Remove the item with the greatest priority.reversed()Get a reverse iterable that yields each prioritised item once.Get a reverse iterable that yields each item once.Methods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
maxPriorityQueueItem<Priority,Item> max()Get the item with the greatest priority.- Returns:
- the maximum priority item, or nullif empty
 
- 
insertInsert the given prioritised item.- Parameters:
- item- the prioritised item
 
- 
insertInsert the given prioritised item.- Parameters:
- priority- the priority
- item- the item
 
- 
removeMaxPriorityQueueItem<Priority,Item> removeMax()Remove the item with the greatest priority.- Returns:
- the maximum priority item, or nullif empty
 
- 
itemsIterable<PriorityQueueItem<Priority,Item>> items()Get a forward iterable that yields each prioritised item once.The items are iterated over in max-to-min order (by priority). - Specified by:
- itemsin interface- Container<Priority extends Comparable<Priority>>
- Returns:
- an iterable over the prioritised items
 
- 
reversedIterable<PriorityQueueItem<Priority,Item>> reversed()Get a reverse iterable that yields each prioritised item once.The items are iterated over in min-to-max order (by priority). - Returns:
- an iterable over the prioritised items
 
- 
itemsOnlyGet a reverse iterable that yields each item once.The items are iterated over in max-to-min order (by priority). - Returns:
- an iterable over just the items (not the priorities)
 
- 
reversedItemsOnlyGet a reverse iterable that yields each item once.The items are iterated over in min-to-max order (by priority). - Returns:
- an iterable over just the items (not the priorities)
 
 
-