goldman.collection.priority
Interface PriorityQueueLocator<E>

All Superinterfaces:
Cloneable, Iterator<E>, Locator<E>
All Known Implementing Classes:
BinaryHeap.BinaryHeapLocator, LeftistHeap.Tracker, PairingHeap.Tracker

public interface PriorityQueueLocator<E>
extends Locator<E>

The PriorityQueueLocator interface extends the Locator interface to add methods that are specific to a priority queue.


Method Summary
 void decreasePriority(E element)
          Replaces the element associated with this priority queue locator by the given lower priority element.
 void increasePriority(E element)
          Replaces the element associated with this priority queue locator by the given higher priority element.
 void update(E element)
          Replaces the element associated with this priority queue locator by the given element.
 
Methods inherited from interface goldman.collection.Locator
advance, get, ignoreConcurrentModifications, ignorePriorConcurrentModifications, inCollection, retreat
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

decreasePriority

void decreasePriority(E element)
Replaces the element associated with this priority queue locator by the given lower priority element. This method requires that the given parameter is less than e, or that e is the parameter being passed and its value has been mutated to have a lower priority than it had previously. That is, it is acceptable practice to mutate the element to have a lower priority and then immediately call decreasePriority to restore the properties of the priority queue.


increasePriority

void increasePriority(E element)
Replaces the element associated with this priority queue locator by the given higher priority element. This method requires that the given parameter is greater than e, or that e is the parameter being passed and its value has been mutated to have a greater priority than it had previously. That is, it is acceptable practice to mutate the element to have a greater priority and then immediately call increasePriority to restore the properties of the priority queue.


update

void update(E element)
Replaces the element associated with this priority queue locator by the given element. This method requires that the parameter is not the same object as e. This is necessary because the method compares the old and the new values to decide whether the priority must be decreased or increased. Therefore, it would be an error to mutate the element referenced by the locator and then call update.