mtree
Class SearchQueue<T extends java.io.Serializable>

java.lang.Object
  extended by mtree.SearchQueue<T>
All Implemented Interfaces:
java.io.Serializable

public class SearchQueue<T extends java.io.Serializable>
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
SearchQueue()
          Create a new instance of SearchQueue.
SearchQueue(int initialSize)
          Create a new instance of SearchQueue.
 
Method Summary
 void add(T object, float mainDistance)
          Add object to the queue using the sorting of mainDistance and secondaryDistance.
 void add(T object, float mainDistance, float secondaryDistance)
          Add object to the queue using the sorting of mainDistance and secondaryDistance.
 void compact()
          Compact the memory used by internal array of this queue.
 float getHeadMainDistance()
          Returns the main sort key of the current queue head.
 float getHeadSecondaryDistance()
          Returns the secondary sort key of the current queue head.
 int getSize()
          Returns the actual number of elements in this queue.
 boolean isEmpty()
          Returns true if this queue contains no elements.
 T remove()
          Retrieves and removes the head of this queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchQueue

public SearchQueue(int initialSize)
Create a new instance of SearchQueue.

Parameters:
initialSize - the initial size of the queue

SearchQueue

public SearchQueue()
Create a new instance of SearchQueue. Initial size is set to 10.

Method Detail

getSize

public int getSize()
Returns the actual number of elements in this queue.

Returns:
the actual number of elements in this queue

isEmpty

public boolean isEmpty()
Returns true if this queue contains no elements.

Returns:
true if this queue contains no elements

getHeadMainDistance

public float getHeadMainDistance()
                          throws java.lang.IndexOutOfBoundsException
Returns the main sort key of the current queue head.

Returns:
the main sort key of the current queue head
Throws:
java.lang.IndexOutOfBoundsException - if the queue is empty

getHeadSecondaryDistance

public float getHeadSecondaryDistance()
                               throws java.lang.IndexOutOfBoundsException
Returns the secondary sort key of the current queue head.

Returns:
the secondary sort key of the current queue head
Throws:
java.lang.IndexOutOfBoundsException - if the queue is empty

add

public void add(T object,
                float mainDistance,
                float secondaryDistance)
Add object to the queue using the sorting of mainDistance and secondaryDistance.

Parameters:
object - the data to associate with the keys
mainDistance - the main sort key
secondaryDistance - the secondary sort key

add

public void add(T object,
                float mainDistance)
Add object to the queue using the sorting of mainDistance and secondaryDistance.

Parameters:
object - the data to associate with the keys
mainDistance - the main sort key

remove

public T remove()
                                      throws java.util.NoSuchElementException
Retrieves and removes the head of this queue. This method does not free the memory allocated for array - use compact() method.

Returns:
the head of this queue
Throws:
java.util.NoSuchElementException - if this queue is empty

compact

public void compact()
Compact the memory used by internal array of this queue.