|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.introspect.SemanticDistanceModel.BoundedPrioQueue
Implementation of a priority queue of bound
.
This is an internal class. Do not use outside
SemanticDistanceModel
.
Nested Class Summary | |
---|---|
static class |
SemanticDistanceModel.BoundedPrioQueue.TupleComparator
|
Constructor Summary | |
---|---|
SemanticDistanceModel.BoundedPrioQueue(InputBuffer buffer)
|
|
SemanticDistanceModel.BoundedPrioQueue(int initBound)
New bounded prio queue |
Method Summary | |
---|---|
int |
getBound()
Get the max number of elements allowed in the queue. |
Distance |
getDistance(QuickSerializable to)
Get the distance value to type to . |
SemanticDistanceModel.Tuple |
getTuple(QuickSerializable key)
Get the tuple to type key |
Iterator |
iterator()
Iterator of tuples in ascending order. |
SemanticDistanceModel.Tuple |
remove(QuickSerializable key)
Remove a tuple. |
void |
removeLast()
Remove the last element in the prio queue |
void |
serialize(OutputBuffer buffer)
Add the object to the buffer . |
void |
setBound(int bound)
Set the max number of elements allowed in the queue. |
int |
size()
Number of elements in the queue |
String |
toString()
Warning: this method runs in O(n) time. |
boolean |
update(SemanticDistanceModel.Tuple tuple)
Update (or add) the tuple <t,d,num>. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SemanticDistanceModel.BoundedPrioQueue(int initBound)
initBound
- the intial bound on the number of elementspublic SemanticDistanceModel.BoundedPrioQueue(InputBuffer buffer) throws QSException
Method Detail |
public void serialize(OutputBuffer buffer)
QuickSerializable
buffer
.
serialize
in interface QuickSerializable
buffer
- the output buffer to add the object topublic void setBound(int bound)
public int getBound()
public boolean update(SemanticDistanceModel.Tuple tuple)
FIXME: Java's fucking stupid TreeSet implementation has no removeLast/update function, so you MUST remove the tuple from the queue first, then update it, then add it again using this method.
tuple
- the tuple to update (add if not already in the queue)
public SemanticDistanceModel.Tuple getTuple(QuickSerializable key)
key
public SemanticDistanceModel.Tuple remove(QuickSerializable key)
public Distance getDistance(QuickSerializable to)
to
. Null if it is not
in the prio queue.
public Iterator iterator()
public int size()
public void removeLast()
public String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |