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