add(long id,
O obj,
int distance)
Add the given object, object id and distance of type int to the
queue.

void

addMax(long id,
O obj,
int distance)
Add the given object, object id and distance of type int to the
queue.

boolean

isCandidate(int d)
Returns true if the given distance can be a candidate for adding it into
the queue.

int

updateRange(int r)
If queue.size() == k, then if the user's range is greater than the
greatest element of the queue, we can reduce the range to the biggest
element of the priority queue, that is its queue.peek() element.

updateRange

public int updateRange(int r)

If queue.size() == k, then if the user's range is greater than the
greatest element of the queue, we can reduce the range to the biggest
element of the priority queue, that is its queue.peek() element.

Parameters:

r - The new range we want to calculate.

Returns:

the new range or the old range if the above condition is not
met

isCandidate

public boolean isCandidate(int d)

Returns true if the given distance can be a candidate for adding it into
the queue. The parameter d is an estimation of the real distance, and
this method is used to decide if we should calculate the real distance.

Parameters:

d - The lower resolution distance.

Returns:

True if we should calculate the real distance and attempt add the
corresponding object into this queue.