spatial
Class MemoryRTree

java.lang.Object
  |
  +--spatial.MemoryRTree
All Implemented Interfaces:
SpatialSearchTree

public class MemoryRTree
extends java.lang.Object
implements SpatialSearchTree

A memory-based R-tree.


Field Summary
protected  int dim
          number of dimensions.
protected  RegionQuery moveQuery
          query to move objects.
protected  RegionQuery removeQuery
          query to remove objects.
protected  MemoryRTreeNode root
          the root node.
protected  RTreeStrategy strategy
          strategy used by the memory r-tree.
protected  int totalnum
          number of objects.
 
Constructor Summary
MemoryRTree()
          Constructor.
MemoryRTree(int dim, int nodecapacity)
          Constructor.
 
Method Summary
 void close()
          Dummy operation.
 int computeNumberOfEntries()
          Returns the number of entries of the tree.
 int computeNumberOfNodes()
          Returns the number of nodes of the tree.
 void debugPrint()
          Debug print of the tree.
 void draw(java.awt.Graphics g, java.awt.Rectangle clip, int scale, int minHeight, int maxHeight)
          Draws the tree.
 int getHeight()
          Returns the height of the tree.
 int getNumOfDimensions()
          Returns the number of dimensions.
 SpatialSearchTreeNode getRoot()
          Returns the root.
 int getTotalNumberOfObjects()
          Returns the total number of entries in the tree.
 void insert(SpatialSearchTreeObject obj)
          Inserts the object into the r-tree.
 boolean remove(SpatialSearchTreeObject obj)
          Removes an object.
 void setSplitStrategy(RTreeStrategy str)
          Sets the split strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dim

protected int dim
number of dimensions.


strategy

protected RTreeStrategy strategy
strategy used by the memory r-tree.


root

protected MemoryRTreeNode root
the root node.


totalnum

protected int totalnum
number of objects.


removeQuery

protected RegionQuery removeQuery
query to remove objects.


moveQuery

protected RegionQuery moveQuery
query to move objects.

Constructor Detail

MemoryRTree

public MemoryRTree()
Constructor.


MemoryRTree

public MemoryRTree(int dim,
                   int nodecapacity)
Constructor.

Parameters:
dim - number of dimensions
nodecapacity - capacity of the nodes
Method Detail

close

public void close()
Dummy operation.

Specified by:
close in interface SpatialSearchTree

computeNumberOfEntries

public int computeNumberOfEntries()
Returns the number of entries of the tree.

Returns:
number of entries

computeNumberOfNodes

public int computeNumberOfNodes()
Returns the number of nodes of the tree.

Returns:
number of nodes

debugPrint

public void debugPrint()
Debug print of the tree.


draw

public void draw(java.awt.Graphics g,
                 java.awt.Rectangle clip,
                 int scale,
                 int minHeight,
                 int maxHeight)
Draws the tree.

Parameters:
g - graphic context
clip - clipping rectangle
scale - scale
minHeight - minimum height (root = 0)
maxHeight - maximum height

getHeight

public int getHeight()
Returns the height of the tree.

Specified by:
getHeight in interface SpatialSearchTree
Returns:
height

getNumOfDimensions

public int getNumOfDimensions()
Returns the number of dimensions.

Specified by:
getNumOfDimensions in interface SpatialSearchTree
Returns:
the number of dimensions

getRoot

public SpatialSearchTreeNode getRoot()
Returns the root.

Specified by:
getRoot in interface SpatialSearchTree
Returns:
the root

getTotalNumberOfObjects

public int getTotalNumberOfObjects()
Returns the total number of entries in the tree.

Returns:
total number of entries

insert

public void insert(SpatialSearchTreeObject obj)
Inserts the object into the r-tree.

Specified by:
insert in interface SpatialSearchTree
Parameters:
obj - spatial searchtree object
Returns:
new r-tree node

remove

public boolean remove(SpatialSearchTreeObject obj)
Removes an object.

Specified by:
remove in interface SpatialSearchTree
Parameters:
obj - the object
Returns:
was an object removed?

setSplitStrategy

public void setSplitStrategy(RTreeStrategy str)
Sets the split strategy.

Parameters:
str - the new split strategy