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