com.metsci.glimpse.util.quadtree
Class QuadTreeXys<V extends Xy>

java.lang.Object
  extended by com.metsci.glimpse.util.quadtree.QuadTree<java.util.Collection<V>>
      extended by com.metsci.glimpse.util.quadtree.QuadTreeXys<V>

public class QuadTreeXys<V extends Xy>
extends QuadTree<java.util.Collection<V>>

Like QuadTreeObjects, but sacrificing generality for search speed. Values inserted into a QuadTreeXys must be instances of the Xy interface. HotSpot does a better job optimizing v.x() than this.x(v). This can improve search speed by 10% or more.

Author:
hogye

Nested Class Summary
 
Nested classes/interfaces inherited from class com.metsci.glimpse.util.quadtree.QuadTree
QuadTree.Accumulator<B>, QuadTree.Node<B>
 
Constructor Summary
QuadTreeXys(int maxBucketSize)
           
 
Method Summary
 void add(V v)
          If v.x() or v.y() returns NaN, this method returns immediately without adding v to the tree.
 void remove(V v)
           
 java.util.Collection<V> search(float xMin, float xMax, float yMin, float yMax)
           
 int search(float xMin, float xMax, float yMin, float yMax, java.util.Collection<V> results)
           
 java.util.Collection<V> search(float xMin, float xMax, float yMin, float yMax, FilterObject<V> vFilter)
           
 int search(float xMin, float xMax, float yMin, float yMax, FilterObject<V> vFilter, java.util.Collection<V> results)
           
 
Methods inherited from class com.metsci.glimpse.util.quadtree.QuadTree
accumulate, leaf, quadrant, truncInf
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadTreeXys

public QuadTreeXys(int maxBucketSize)
Method Detail

search

public java.util.Collection<V> search(float xMin,
                                      float xMax,
                                      float yMin,
                                      float yMax)

search

public int search(float xMin,
                  float xMax,
                  float yMin,
                  float yMax,
                  java.util.Collection<V> results)
Returns:
The number of elements appended to results.

search

public java.util.Collection<V> search(float xMin,
                                      float xMax,
                                      float yMin,
                                      float yMax,
                                      FilterObject<V> vFilter)

search

public int search(float xMin,
                  float xMax,
                  float yMin,
                  float yMax,
                  FilterObject<V> vFilter,
                  java.util.Collection<V> results)
Returns:
The number of elements appended to results.

add

public void add(V v)
If v.x() or v.y() returns NaN, this method returns immediately without adding v to the tree.


remove

public void remove(V v)


Copyright © 2012 Metron, Inc.. All Rights Reserved.