edu.stanford.nlp.util
Interface PriorityQueue

All Superinterfaces:
Collection, Set
All Known Implementing Classes:
BinaryHeapPriorityQueue

public interface PriorityQueue
extends Set

Created by IntelliJ IDEA. User: Teg Grenager Date: Dec 11, 2003 Time: 11:31:51 AM To change this template use Options | File Templates.


Method Summary
 boolean add(Object key, double priority)
          Convenience method for if you want to pretend increaseKey doesn't exist, or if you really want add's return conditions.
 boolean changePriority(Object key, double priority)
          Changes a priority, either up or down, adding the key it if it wasn't there already.
 Object getFirst()
          Finds the object with the highest priority and returns it, without modifying the queue.
 double getPriority(Object key)
          Get the priority of a key.
 boolean relaxPriority(Object key, double priority)
          Increases the priority of the Object key to the new priority if the old priority was lower than the new priority.
 Object removeFirst()
          Finds the object with the highest priority, removes it, and returns it.
 List toSortedList()
           
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

removeFirst

public Object removeFirst()
Finds the object with the highest priority, removes it, and returns it.

Returns:
the object with highest priority

getFirst

public Object getFirst()
Finds the object with the highest priority and returns it, without modifying the queue.

Returns:
the object with minimum key

getPriority

public double getPriority(Object key)
Get the priority of a key.

Parameters:
key - The object to assess
Returns:
A key's priority. If the key is not in the queue, Double.NEGATIVE_INFINITY is returned.

add

public boolean add(Object key,
                   double priority)
Convenience method for if you want to pretend increaseKey doesn't exist, or if you really want add's return conditions.

Returns:
true if this set did not already contain the specified element.

changePriority

public boolean changePriority(Object key,
                              double priority)
Changes a priority, either up or down, adding the key it if it wasn't there already.

Parameters:
key - an Object value
Returns:
whether the priority actually changed.

relaxPriority

public boolean relaxPriority(Object key,
                             double priority)
Increases the priority of the Object key to the new priority if the old priority was lower than the new priority. Otherwise, does nothing.

Parameters:
key -
priority -
Returns:

toSortedList

public List toSortedList()


Stanford NLP Group