com.mapinfo.midev.index.rtree

## Interface IRTreeNode

    public interface IRTreeNode

This interface represents the responsibilities of a RTree node. Both leaf and index nodes are represented by the same interface.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addChild(Object data)` Adds a child at the end of the child list.
`void` `clear()` Clears the contents of this node, initializes the bounds to emtpy, sets the parent to null, and resets the level to zero.
`Envelope` `getBounds()` Returns the bounds of this node.
`Object` `getChild(int index)` Returns the child at the given position.
`int` `getLevel()` Returns the index level of this node.
`IRTreeNode` `getParent()` Returns the parent of this node.
`boolean` `isLeaf()` Returns true if this node is a leaf node, generally synonymous with getLevel()==0.
`boolean` `isRoot()` Returns true if this node is the root node of the tree.
`void` `removeChild(int index)` Removes the child at the given position.
`void` `setBounds(Envelope bounds)` Alters the bounds of this node to match the parameter.
`void` `setLevel(int newLevel)` Sets the level of this node.
`void` `setParent(IRTreeNode o)` Sets the parent of this node.
`int` `size()` Returns the current number of children this node has.

### Method Detail

#### getBounds

    Envelope getBounds()

Returns the bounds of this node. There is no guarantee of whether the returned envelope is a copy or the actual instance envelope of the implementation. Changes to the envelope must be followed by a call to setBounds() to register the change contractually.

Returns:
  the bounds of this node.

#### setBounds

    void setBounds(Envelope bounds)

Alters the bounds of this node to match the parameter.

Parameters:
  `bounds` - The bounds the node should have.

#### getLevel

    int getLevel()

Returns the index level of this node. The leaf level is always zero, and subsequent levels increase by one up to the root node which has the highest level.

Returns:
  The index level of this node

#### setLevel

    void setLevel(int newLevel)

Sets the level of this node. This call doesn't alter the nodes actual placement in the tree and is used only for the convienence of algorithms that need to know level position in the tree.

Parameters:
  `newLevel` - The level this node should have.

#### isLeaf

    boolean isLeaf()

Returns true if this node is a leaf node, generally synonymous with getLevel()==0.

Returns:
  true if this node is a leaf node

#### size

    int size()

Returns the current number of children this node has.

Returns:
  the current number of children this node has.

#### getChild

    Object getChild(int index)

Returns the child at the given position. Children of leaf nodes will return the Object being stored in the index. Children of index nodes will return other IRTreeNode instances.

Parameters:
  `index` - The index of the child to return.
Returns:
  the child at the given position, either a data object instance or an IRTreeNode instance.

#### addChild

    void addChild(Object data)

Adds a child at the end of the child list. Nodes contents should be consistent, i.e. either all data object instances or all IRTreeNode instances for leaf nodes or index nodes respectively.

Parameters:
  `data` - The child to add.

#### removeChild

    void removeChild(int index)

Removes the child at the given position.

Parameters:
  `index` - The position of the child to remove.

#### isRoot

    boolean isRoot()

Returns true if this node is the root node of the tree. Generally the same as getParent()==null.

Returns:
  true if this node is the root node of the tree.

#### getParent

    IRTreeNode getParent()

Returns the parent of this node. Useful for traversing back towards the root from a leaf.

Returns:
  the parent of this node.

#### setParent

    void setParent(IRTreeNode o)

Sets the parent of this node. This call does not alter the contents of the parent node, and thus a similar call to setChild() should be made on the parent node.

Parameters:
  `o` - The node that will be the parent of this node.

#### clear

    void clear()

Clears the contents of this node, initializes the bounds to emtpy, sets the parent to null, and resets the level to zero.