net.obsearch.index.ghs
Class FastPriorityQueueLong

java.lang.Object
  extended by net.obsearch.index.ghs.FastPriorityQueueLong

public final class FastPriorityQueueLong
extends Object

This data structure simulates a priority queue of objects sorted by their distance to some other object. It assumes several things for performance reasons: 1)Distances are discrete. 2) Objects to be stored are longs 3) The maximum distance value is a value m that is very small (64 for example :)). This priority queue uses a lot of memory if queueSize is too large.

Author:
Arnoldo Jose Muller Molina

Constructor Summary
FastPriorityQueueLong(int maxDistance, int queueSize)
          Creates the queue
 
Method Summary
 void add(long object, int distance)
          Add an object that is at a certain distance.
 long[] get()
          Return the closest long objects We do not include the original distances to reduce the creation of objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastPriorityQueueLong

public FastPriorityQueueLong(int maxDistance,
                             int queueSize)
Creates the queue

Parameters:
maxDistance - maximum distance that will be inserted in the queue. (from 0 to maxDistance)
queueSize - size of the queue (number of closest elements to be obtained).
Method Detail

add

public void add(long object,
                int distance)
Add an object that is at a certain distance.

Parameters:
object - the object to add
distance - the distance of the object.

get

public long[] get()
Return the closest long objects We do not include the original distances to reduce the creation of objects.

Returns:
the closest long objects


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.