|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.datatypes.IntSet javatools.datatypes.IdPriorityQueue
public class IdPriorityQueue
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class implements a priority queue, whose elements are integers (ids) and whose priorities are doubles.
Constructor Summary | |
---|---|
IdPriorityQueue()
Constructor with capacity 10 |
|
IdPriorityQueue(int capacity)
Constructor with initial capacity |
Method Summary | |
---|---|
boolean |
add(int v)
Adds the element |
void |
add(int i,
double priority)
Adds an id to the queue or updates its priority |
void |
addAll(IdPriorityQueue s)
|
void |
clear(int capacity)
|
double |
highestPriority()
Returns the highest priority |
static void |
main(java.lang.String[] args)
Test |
int |
peek()
Returns the id with the highest priority |
int |
poll()
Returns and removes the id with highest priority |
void |
put(long id,
double priority)
Truncates the id to int, then adds (linear time) |
boolean |
remove(int i)
Removes one element, returns TRUE if the set was modified |
java.lang.String |
toString()
|
Methods inherited from class javatools.datatypes.IntSet |
---|
add, add, add, addAll, addAll, addAll, addTo, clear, contains, contains, contains, containsAll, enhancedBy, enhancedBy, isEmpty, iterator, of, remove, remove, removeAll, removeAll, removeAll, retainAll, setTo, shrunkBy, shrunkBy, size, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
equals, hashCode |
Constructor Detail |
---|
public IdPriorityQueue(int capacity)
public IdPriorityQueue()
Method Detail |
---|
public void add(int i, double priority)
public void put(long id, double priority)
public int poll()
poll
in class IntSet
public double highestPriority()
public int peek()
public boolean remove(int i)
IntSet
remove
in class IntSet
public void clear(int capacity)
clear
in class IntSet
public void addAll(IdPriorityQueue s)
public boolean add(int v)
IntSet
add
in class IntSet
public java.lang.String toString()
toString
in class IntSet
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |