E
- public class BoundedPriorityQueue<E extends VPPoint>
extends java.util.PriorityQueue<E>
Constructor and Description |
---|
BoundedPriorityQueue(VPPoint center,
int maxSize) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element)
Attempts to add an element to the bounded queue.
|
boolean |
addAll(java.util.Collection<? extends E> collection)
Attempts to add
Collection of elements to the bounded
queue. |
double |
getFurthestDistance()
Finds the distance of the element who is furthest from the center.
|
java.util.List<E> |
toSortedList(VPPoint queryPoint)
Returns a list of the points in this result set sorted in order of
increasing distance from the query point provided at construction time.
|
clear, comparator, contains, iterator, offer, peek, poll, remove, size, spliterator, toArray, toArray
containsAll, isEmpty, removeAll, retainAll, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public BoundedPriorityQueue(VPPoint center, int maxSize)
center
- the query point to measure versus; i.e. the center of the
initial querymaxSize
- the maximum capacity (upper bound) on the number of
elements that can be stored in the queuepublic boolean add(E element)
add
in interface java.util.Collection<E extends VPPoint>
add
in interface java.util.Queue<E extends VPPoint>
add
in class java.util.PriorityQueue<E extends VPPoint>
element
- the element to be added to the queuepublic boolean addAll(java.util.Collection<? extends E> collection)
Collection
of elements to the bounded
queue. If the queue is full and the element(s) to add are further away
from the vantage point, the element(s) will be discarded.public double getFurthestDistance()
center.getDistanceTo(peek())
Double.POSITIVE_INFINITY
if the queue is
empty.public java.util.List<E> toSortedList(VPPoint queryPoint)
queryPoint
-