goodslib
Class Rtree

java.lang.Object
  extended bygoodsjpi.Persistent
      extended bygoodslib.Rtree
All Implemented Interfaces:
java.io.Serializable

public class Rtree
extends Persistent

See Also:
Serialized Form

Field Summary
 
Fields inherited from class goodsjpi.Persistent
defaultMetaobject, metaobject
 
Method Summary
 void clear()
          Remove all objects from the index
 SpatialObject[] get(Rectangle r)
          Find all objects located in the selected rectangle
 java.util.ArrayList getList(Rectangle r)
          Find all objects located in the selected rectangle
 Rectangle getWrappingRectangle()
          Get wrapping rectangle
 java.util.Iterator iterator()
          Get iterator through all members of the index
 java.util.Iterator iterator(Rectangle r)
          Get objects which rectangle intersects with specified rectangle
 void put(SpatialObject obj)
          Put new spatial object in the index.
 boolean remove(SpatialObject obj)
          Remove spatial object from the tree.
 int size()
          Get number of objects in the index
 SpatialObject[] toArray()
          Get array of all members of the index
 SpatialObject[] toArray(SpatialObject[] arr)
          Get all objects in the index.
 
Methods inherited from class goodsjpi.Persistent
attachToStorage, clone, clusterWith, finalize, getDatabase, getOid, getStorageId, hashCode, onLoad
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

put

public void put(SpatialObject obj)
Put new spatial object in the index.

Parameters:
obj - spatial object with specified bounded rectangle

size

public int size()
Get number of objects in the index

Returns:
number of objects in the index

remove

public boolean remove(SpatialObject obj)
Remove spatial object from the tree.

Parameters:
obj - spatial object with specified bounded rectangle
Returns:
true if object was sucessfully deleted, false oif object not found in tree

get

public SpatialObject[] get(Rectangle r)
Find all objects located in the selected rectangle

Parameters:
r - selected rectangle
Returns:
array of objects which enveloping rectangle intersects with specified rectangle

getList

public java.util.ArrayList getList(Rectangle r)
Find all objects located in the selected rectangle

Parameters:
r - selected rectangle
Returns:
array list of objects which enveloping rectangle intersects with specified rectangle

toArray

public SpatialObject[] toArray()
Get array of all members of the index

Returns:
array of index members

toArray

public SpatialObject[] toArray(SpatialObject[] arr)
Get all objects in the index. The runtime type of the returned array is that of the specified array. If the index fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this index.

If this index fits in the specified array with room to spare (i.e., the array has more elements than this index), the element in the array immediately following the end of the index is set to null. This is useful in determining the length of this index only if the caller knows that this index does not contain any null elements.)

Parameters:
arr - specified array
Returns:
array of all objects in the index

getWrappingRectangle

public Rectangle getWrappingRectangle()
Get wrapping rectangle

Returns:
minimal rectangle containing all rectangles in the index, null if index is empty

clear

public void clear()
Remove all objects from the index


iterator

public java.util.Iterator iterator()
Get iterator through all members of the index

Returns:
iterator through all objects in the index

iterator

public java.util.Iterator iterator(Rectangle r)
Get objects which rectangle intersects with specified rectangle

Parameters:
r - selected rectangle
Returns:
iterator for objects which enveloping rectangle overlaps with specified rectangle