Class PointTreeNode.Default

java.lang.Object
org.apache.sis.index.tree.PointTreeNode
org.apache.sis.index.tree.PointTreeNode.Default
All Implemented Interfaces:
Serializable, Cloneable
Enclosing class:
PointTreeNode

static final class PointTreeNode.Default extends PointTreeNode
Default implementation of PointTreeNode when no specialized class is available. This default implementation stores children in an array. The usage of arrays allows arbitrary lengths, but implies one more object to be created for each node instance. Since this class should be used only for relatively large numbers of dimensions, the cost of arrays creation should be less significant compared to array length.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.sis.index.tree.PointTreeNode

    PointTreeNode.Default
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Object[]
    The nodes or element values in each quadrant/octant of this node.
    private static final long
    For cross-version compatibility.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    (package private)
    Default(int n)
    Constructs an initially empty PointTree node.
    private
    Creates a new node initialized to a copy of the given node.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) final void
    Removes all elements from this node.
    protected Object
    Returns a clone of this node.
    (package private) final Object
    getChild(int quadrant)
    Returns the child of this node that resides in the specified quadrant/octant.
    (package private) final PointTreeNode
    Creates a new instance of the same class than this node.
    (package private) final void
    setChild(int quadrant, Object child)
    Sets the node's quadrant/octant to the specified child.

    Methods inherited from class org.apache.sis.index.tree.PointTreeNode

    enterQuadrant, factor, quadrant

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • children

      private final Object[] children
      The nodes or element values in each quadrant/octant of this node. Each array element can be null or an instance of one of the classes documented in PointTreeNode.getChild(int).
  • Constructor Details

    • Default

      Default(int n)
      Constructs an initially empty PointTree node.
      Parameters:
      n - must be 2k where k is the number of dimensions.
    • Default

      private Default(PointTreeNode.Default other)
      Creates a new node initialized to a copy of the given node.
      See Also:
  • Method Details

    • newInstance

      final PointTreeNode newInstance()
      Creates a new instance of the same class than this node.
      Specified by:
      newInstance in class PointTreeNode
    • clear

      final void clear()
      Removes all elements from this node.
      Specified by:
      clear in class PointTreeNode
      See Also:
    • getChild

      final Object getChild(int quadrant)
      Returns the child of this node that resides in the specified quadrant/octant.
      Specified by:
      getChild in class PointTreeNode
      Parameters:
      quadrant - quadrant/octant of child to get.
      Returns:
      child in the specified quadrant/octant.
    • setChild

      final void setChild(int quadrant, Object child)
      Sets the node's quadrant/octant to the specified child.
      Specified by:
      setChild in class PointTreeNode
      Parameters:
      quadrant - quadrant/octant where the child resides.
      child - child of this node in the specified quadrant/octant.
    • clone

      protected Object clone()
      Returns a clone of this node. This is invoked when creating a copy of PointTree.
      Overrides:
      clone in class PointTreeNode