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.
Since:
1.1
Version:
1.1
  • 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