Class QuadTreeNode<T>

java.lang.Object
org.aksw.commons.collections.quadtree.QuadTreeNode<T>

public class QuadTreeNode<T> extends Object
  • Field Details

    • TOP_LEFT

      public static final int TOP_LEFT
      See Also:
    • TOP_RIGHT

      public static final int TOP_RIGHT
      See Also:
    • BOTTOM_LEFT

      public static final int BOTTOM_LEFT
      See Also:
    • BOTTOM_RIGHT

      public static final int BOTTOM_RIGHT
      See Also:
    • parent

      protected QuadTreeNode<T> parent
    • children

      protected QuadTreeNode<T>[] children
    • parentChildIndex

      protected final int parentChildIndex
    • bounds

      protected final org.locationtech.jts.geom.Envelope bounds
    • maxDepth

      protected final int maxDepth
    • k

      protected final float k
    • depth

      protected final int depth
    • isLoaded

      protected boolean isLoaded
    • minItemCount

      protected Long minItemCount
      Explicit number of minimum items set on this node
    • infMinItemCount

      protected long infMinItemCount
      Inferred minimum item count (recurses to the parents)
    • data

      protected Set<T> data
  • Constructor Details

    • QuadTreeNode

      public QuadTreeNode(QuadTreeNode<T> parent, int parentChildIndex, org.locationtech.jts.geom.Envelope bounds, int maxDepth, int depth, float k)
  • Method Details

    • getParent

      public QuadTreeNode<T> getParent()
    • getChildren

      public QuadTreeNode<T>[] getChildren()
    • getData

      public Set<T> getData()
    • isLoaded

      public boolean isLoaded()
    • setLoaded

      public void setLoaded(boolean isLoaded)
    • getInfMinItemCount

      public long getInfMinItemCount()
    • getDepth

      public int getDepth()
    • getId

      public String getId()
      Build a string that represents the path to this node from the root
    • isLeaf

      public boolean isLeaf()
    • addItem

      public void addItem(T item)
    • removeItem

      public void removeItem(Object id)
    • setMinItemCount

      public void setMinItemCount(long value)
      Sets the minimum item count on this node and recursively updates the inferred minimum item count (.infMinItemCount) on its parents.
      Parameters:
      value -
    • getMinItemCount

      public Long getMinItemCount()
    • isCountComplete

      public boolean isCountComplete()
      True if either the minItemCount is set, or all children have it set FIXME This description is not concise - mention the transitivity
    • updateInfMinItemCount

      public void updateInfMinItemCount()
      Update the inferred minimum item count of this node. It's the sum of the children's inferred minimum item counts.
    • getBounds

      public org.locationtech.jts.geom.Envelope getBounds()
    • getCenter

      public org.locationtech.jts.geom.Coordinate getCenter()
    • newNode

      public QuadTreeNode<T> newNode(int parentChildIndex, org.locationtech.jts.geom.Envelope bounds)
    • subdivide

      public void subdivide()
    • query

      public List<QuadTreeNode<T>> query(org.locationtech.jts.geom.Envelope bounds, int depth)
      Return loaded and leaf nodes within the bounds
      Parameters:
      bounds -
      depth - The maximum number of levels to go beyond the level derived from the size of bounds
    • queryRec

      public void queryRec(org.locationtech.jts.geom.Envelope queryBounds, Collection<QuadTreeNode<T>> result, int depth)
    • splitFor

      public void splitFor(org.locationtech.jts.geom.Envelope splitBounds, int depth, Collection<QuadTreeNode<T>> result)
      If the node'size is above a certain ratio of the size of the bounds, it is placed into result. Otherwise, it is recursively split until the child nodes' ratio to given bounds has become large enough. Use example: If the screen is centered on a certain location, then this method picks tiles (quad-tree-nodes) of appropriate size (not too big and not too small).
      Parameters:
      bounds -
      depth -
      result -
    • acquireNodes

      public Collection<QuadTreeNode<T>> acquireNodes(org.locationtech.jts.geom.Envelope splitBounds, int depth)
      Returns the collection of leaf nodes for the given bounds
    • unlink

      public void unlink()
      If there is a parent, replace this node with an empty one
    • toString

      public String toString()
      Overrides:
      toString in class Object