de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants
Class AbstractRStarTreeNode<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.persistent.AbstractPage
      extended by de.lmu.ifi.dbs.elki.index.tree.AbstractNode<E>
          extended by de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.AbstractRStarTreeNode<N,E>
Type Parameters:
N - Node type
E - Entry type
All Implemented Interfaces:
SpatialComparable, Node<E>, SpatialNode<N,E>, Page, Externalizable, Serializable
Direct Known Subclasses:
DeLiCluNode, RStarTreeNode

public abstract class AbstractRStarTreeNode<N extends AbstractRStarTreeNode<N,E>,E extends SpatialEntry>
extends AbstractNode<E>
implements SpatialNode<N,E>

Abstract superclass for nodes in a R*-Tree.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class de.lmu.ifi.dbs.elki.index.tree.AbstractNode
entries, isLeaf, numEntries
 
Constructor Summary
AbstractRStarTreeNode()
          Empty constructor for Externalizable interface.
AbstractRStarTreeNode(int capacity, boolean isLeaf, Class<? super E> eclass)
          Creates a new AbstractRStarTreeNode with the specified parameters.
 
Method Summary
 void adjustEntry(E entry)
          Adjusts the parameters of the entry representing this node.
 E adjustEntryIncremental(E entry, SpatialComparable responsibleMBR)
          Adjusts the parameters of the entry representing this node.
 HyperBoundingBox computeMBR()
          Recomputing the MBR is rather expensive.
 int getDimensionality()
          Returns the dimensionality of the object.
 double getMax(int dimension)
          Returns the maximum coordinate at the specified dimension.
 double getMin(int dimension)
          Returns the minimum coordinate at the specified dimension.
protected
<D extends Distance<D>>
void
initReInsert(int start, DistanceEntry<D,E>[] reInsertEntries)
          * Initializes a reinsert operation.
 void integrityCheck(AbstractRStarTree<N,E> tree)
          Tests this node (for debugging purposes).
protected  void integrityCheckParameters(N parent, int index)
          Tests, if the parameters of the entry representing this node, are correctly set.
 void readExternal(ObjectInput in)
          Reads the id of this node, the numEntries and the entries array from the specified stream.
 void writeExternal(ObjectOutput out)
          Calls the super method and writes the id of this node, the numEntries and the entries array to the specified stream.
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.AbstractNode
addDirectoryEntry, addLeafEntry, children, deleteAllEntries, deleteEntry, equals, getCapacity, getEntries, getEntry, getNumEntries, isLeaf, splitTo, splitTo, toString
 
Methods inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPage
getPageID, hashCode, isDirty, setDirty, setPageID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.index.tree.Node
addDirectoryEntry, addLeafEntry, children, getEntry, getNumEntries, isLeaf
 
Methods inherited from interface de.lmu.ifi.dbs.elki.persistent.Page
getPageID, isDirty, setDirty, setPageID
 

Constructor Detail

AbstractRStarTreeNode

public AbstractRStarTreeNode()
Empty constructor for Externalizable interface.


AbstractRStarTreeNode

public AbstractRStarTreeNode(int capacity,
                             boolean isLeaf,
                             Class<? super E> eclass)
Creates a new AbstractRStarTreeNode with the specified parameters.

Parameters:
capacity - the capacity (maximum number of entries plus 1 for overflow) of this node
isLeaf - indicates whether this node is a leaf node
eclass - Entry class, to initialize array storage
Method Detail

getMin

public double getMin(int dimension)
Description copied from interface: SpatialComparable
Returns the minimum coordinate at the specified dimension.

Specified by:
getMin in interface SpatialComparable
Parameters:
dimension - the dimension for which the coordinate should be returned, where 1 ≤ dimension ≤ getDimensionality()
Returns:
the minimum coordinate at the specified dimension

getMax

public double getMax(int dimension)
Description copied from interface: SpatialComparable
Returns the maximum coordinate at the specified dimension.

Specified by:
getMax in interface SpatialComparable
Parameters:
dimension - the dimension for which the coordinate should be returned, where 1 ≤ dimension ≤ getDimensionality()
Returns:
the maximum coordinate at the specified dimension

computeMBR

public HyperBoundingBox computeMBR()
Recomputing the MBR is rather expensive.

Returns:
MBR

getDimensionality

public int getDimensionality()
Description copied from interface: SpatialComparable
Returns the dimensionality of the object.

Specified by:
getDimensionality in interface SpatialComparable
Returns:
the dimensionality

adjustEntry

public void adjustEntry(E entry)
Adjusts the parameters of the entry representing this node.

Parameters:
entry - the entry representing this node

adjustEntryIncremental

public E adjustEntryIncremental(E entry,
                                SpatialComparable responsibleMBR)
Adjusts the parameters of the entry representing this node. Only applicable if one object was inserted or the size of an existing node increased.

Parameters:
entry - the entry representing this node
responsibleMBR - the MBR of the object or node which is responsible for the call of the method
Returns:
the MBR of the new Node

initReInsert

protected <D extends Distance<D>> void initReInsert(int start,
                                                    DistanceEntry<D,E>[] reInsertEntries)
* Initializes a reinsert operation. Deletes all entries in this node and adds all entries from start index on to this node's children.

Parameters:
start - the start index of the entries that will be reinserted
reInsertEntries - the array of entries to be reinserted

integrityCheck

public final void integrityCheck(AbstractRStarTree<N,E> tree)
Tests this node (for debugging purposes).


integrityCheckParameters

protected void integrityCheckParameters(N parent,
                                        int index)
Tests, if the parameters of the entry representing this node, are correctly set. Subclasses may need to overwrite this method.

Parameters:
parent - the parent holding the entry representing this node
index - the index of the entry in the parents child array

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Calls the super method and writes the id of this node, the numEntries and the entries array to the specified stream.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class AbstractNode<E extends SpatialEntry>
Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Reads the id of this node, the numEntries and the entries array from the specified stream.

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class AbstractNode<E extends SpatialEntry>
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

Release 0.4.0 (2011-09-20_1324)