|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldman.collection.tagged.TaggedCollectionWrapper<T,E>
goldman.collection.tagged.priority.TaggedPriorityQueueWrapper<T,E>
public abstract class TaggedPriorityQueueWrapper<T,E>
The tagged priority queue wrapper can wrap any priority queue
implementation, where each element in the priority queue is
a tagged element. It is required that the comparator depends only
on the tag, and the tag is immutable except through the use of the
update
method.
Field Summary |
---|
Fields inherited from class goldman.collection.tagged.TaggedCollectionWrapper |
---|
pairs, target |
Constructor Summary | |
---|---|
TaggedPriorityQueueWrapper(Collection<TaggedElement<T,E>> pairs)
|
Method Summary | |
---|---|
TaggedElement<T,E> |
extractMax()
Removes a tagged element with a highest priority tag |
PriorityQueueLocator<TaggedElement<T,E>> |
getLocator(T tag)
Returns a locator that has been initialized to a tagged element with an equivalent tag. |
Iterator<TaggedElement<T,E>> |
iterator()
Creates and returns new iterator initialized to FORE. |
TaggedElement<T,E> |
max()
Returns a tagged element with a highest priority tag. |
void |
put(T tag,
E data)
Creates a new tagged element with the given values, and inserts this tagged element into this collection. |
PriorityQueueLocator<TaggedElement<T,E>> |
putTracked(T tag,
E data)
Creates a new tagged element with the given values, and inserts this tagged element into this collection |
void |
updateTag(T tag,
PriorityQueueLocator<TaggedElement<T,E>> loc)
Replaces the tag of the tagged element at the locator position by tag ,
and makes any required updates in the wrapped priority queue. |
Methods inherited from class goldman.collection.tagged.TaggedCollectionWrapper |
---|
accept, clear, contains, elements, ensureCapacity, get, getCapacity, getSize, isEmpty, putAll, remove, tags, toString, trimToSize, values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface goldman.collection.tagged.TaggedCollection |
---|
accept, clear, contains, elements, ensureCapacity, get, getCapacity, getSize, isEmpty, putAll, remove, tags, toString, trimToSize, values |
Constructor Detail |
---|
public TaggedPriorityQueueWrapper(Collection<TaggedElement<T,E>> pairs)
Method Detail |
---|
public TaggedElement<T,E> max()
TaggedPriorityQueue
NoSuchElementException
when this collection is empty.
max
in interface TaggedPriorityQueue<T,E>
NoSuchElementException
- this collection is empty.public PriorityQueueLocator<TaggedElement<T,E>> getLocator(T tag)
TaggedCollection
iterator
method, this method enables
navigation, but from a specified starting point. This method
throws a NoSuchElementException
if there is no tagged element with an equivalent tag
in the collection.
getLocator
in interface TaggedPriorityQueue<T,E>
getLocator
in interface TaggedCollection<T,E>
getLocator
in class TaggedCollectionWrapper<T,E>
tag
- the target tag
NoSuchElementException
- there is no element
with an equivalent tagpublic void put(T tag, E data)
put
in interface TaggedCollection<T,E>
put
in class TaggedCollectionWrapper<T,E>
tag
- the tag for the tagged element to adddata
- the associated data
AtCapacityException
- the
collection is already at capacity.public PriorityQueueLocator<TaggedElement<T,E>> putTracked(T tag, E data)
putTracked
in interface TaggedPriorityQueue<T,E>
tag
- the tag for the tagged element to adddata
- the associated data
AtCapacityException
- the
collection is already at capacity.public TaggedElement<T,E> extractMax()
extractMax
in interface TaggedPriorityQueue<T,E>
NoSuchElementException
- this collection is empty.public void updateTag(T tag, PriorityQueueLocator<TaggedElement<T,E>> loc)
tag
,
and makes any required updates in the wrapped priority queue.
updateTag
in interface TaggedPriorityQueue<T,E>
tag
- the new tagloc
- a priority queue locator specifying the tagged element to updatepublic Iterator<TaggedElement<T,E>> iterator()
iterator
in interface TaggedPriorityQueue<T,E>
iterator
in interface TaggedCollection<T,E>
iterator
in interface Iterable<TaggedElement<T,E>>
iterator
in class TaggedCollectionWrapper<T,E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |