|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractSet
edu.stanford.nlp.util.BinaryHeapPriorityQueue
PriorityQueue with explicit double priority values. Larger doubles are higher priorities. BinaryHeap-backed.
Constructor Summary | |
BinaryHeapPriorityQueue()
|
|
BinaryHeapPriorityQueue(MapFactory mapFactory)
|
Method Summary | |
boolean |
add(Object key)
Adds an object to the queue with the minimum priority (Double.NEGATIVE_INFINITY). |
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. |
void |
clear()
Clears the queue. |
boolean |
contains(Object key)
Returns whether the queue contains the given key. |
boolean |
decreasePriority(Object key,
double priority)
Demotes a key in the queue, adding it if it wasn't there already. |
BinaryHeapPriorityQueue |
deepCopy()
|
BinaryHeapPriorityQueue |
deepCopy(MapFactory mapFactory)
|
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 -- if the key is not in the queue, Double.NEGATIVE_INFINITY is returned. |
boolean |
hasNext()
|
boolean |
isEmpty()
Checks if the queue is empty. |
Iterator |
iterator()
|
static void |
main(String[] args)
|
Object |
next()
|
boolean |
relaxPriority(Object key,
double priority)
Promotes a key in the queue, adding it if it wasn't there already. |
void |
remove()
|
boolean |
remove(Object key)
|
Object |
removeFirst()
Finds the object with the highest priority, removes it, and returns it. |
int |
size()
Get the number of elements in the queue. |
List |
toSortedList()
|
String |
toString()
|
Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
addAll, containsAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
public BinaryHeapPriorityQueue()
public BinaryHeapPriorityQueue(MapFactory mapFactory)
Method Detail |
public boolean hasNext()
hasNext
in interface Iterator
public Object next()
next
in interface Iterator
public void remove()
remove
in interface Iterator
public Object removeFirst()
removeFirst
in interface PriorityQueue
public Object getFirst()
getFirst
in interface PriorityQueue
public double getPriority(Object key)
getPriority
in interface PriorityQueue
key
-
public boolean add(Object key)
add
in interface Set
key
- an Object
value
public boolean add(Object key, double priority)
add
in interface PriorityQueue
public boolean remove(Object key)
remove
in interface Set
public boolean relaxPriority(Object key, double priority)
relaxPriority
in interface PriorityQueue
key
- an Object
valuepriority
-
public boolean decreasePriority(Object key, double priority)
key
- an Object
value
public boolean changePriority(Object key, double priority)
changePriority
in interface PriorityQueue
key
- an Object
value
public boolean isEmpty()
isEmpty
in interface Set
boolean
valuepublic int size()
size
in interface Set
public boolean contains(Object key)
contains
in interface Set
public List toSortedList()
toSortedList
in interface PriorityQueue
public BinaryHeapPriorityQueue deepCopy(MapFactory mapFactory)
public BinaryHeapPriorityQueue deepCopy()
public Iterator iterator()
iterator
in interface Set
public void clear()
clear
in interface Set
public String toString()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |