
Cytoscape 2.8.0 API  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object cytoscape.geom.rtree.RTree
public final class RTree
An inmemory Rtree over real numbers in two dimensions.
An instance of this class is serializable; however, serialized instances of this class should not be stored in a persistent manner because the serialization implemented in this class makes no attempt at handling class versioning.
Field Summary  

static int 
DEFAULT_MAX_BRANCHES
Deprecated. Use the noarg constructor. 
Constructor Summary  

RTree()
Instantiates a new Rtree. 

RTree(int maxBranches)
Deprecated. Use the noarg constructor instead. 
Method Summary  

boolean 
delete(int objKey)
Deletes the specified data entry from this tree. 
void 
empty()
Empties this Rtree of all entries. 
boolean 
exists(int objKey,
float[] extentsArr,
int offset)
Determines whether or not a given entry exists in this Rtree structure, and conditionally retrieves the extents of that entry. 
void 
insert(int objKey,
float xMin,
float yMin,
float xMax,
float yMax)
Inserts a new data entry into this tree; the entry's extents are specified by the input parameters. 
SpacialEntry2DEnumerator 
queryOverlap(float xMin,
float yMin,
float xMax,
float yMax,
float[] extentsArr,
int offset,
boolean reverse)
Returns an enumeration of entries whose extents intersect the specified axisaligned rectangular area. 
int 
size()
Returns the number of entries currently in this Rtree. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final int DEFAULT_MAX_BRANCHES
Constructor Detail 

public RTree()
public RTree(int maxBranches)
maxBranches
 the maximum branching factor of this tree.
IllegalArgumentException
 if maxBranches is less than three.Method Detail 

public final void empty()
empty
in interface MutableSpacialIndex2D
public final int size()
NOTE: To retrieve an enumeration of all entries in this Rtree, call queryOverlap() with Float.NEGATIVE_INFINITY minimum values and Float.POSITIVE_INFINITY maximum values.
size
in interface SpacialIndex2D
public final void insert(int objKey, float xMin, float yMin, float xMax, float yMax)
insert
in interface MutableSpacialIndex2D
objKey
 a userdefined unique identifier used to refer to the entry
being inserted in later operations; this identifier must be
nonnegative.xMin
 the minimum X coordinate of the entry's extents rectangle.yMin
 the minimum Y coordinate of the entry's extents rectangle.xMax
 the maximum X coordinate of the entry's extents rectangle.yMax
 the maximum Y coordinate of the entry's extents rectangle.
IllegalStateException
 if objKey is already used for an
existing entry in this Rtree.
IllegalArgumentException
 if objKey is negative,
if xMin is not less than or equal to xMax, or
if yMin is not less than or equal to yMax.public final boolean exists(int objKey, float[] extentsArr, int offset)
The values written into extentsArr are exactly the same ones that were previously passed to insert() using the same objKey.
array index value if objKey exists offset xMin of MBR offset+1 yMin of MBR offset+2 xMax of MBR offset+3 yMax of MBR
exists
in interface SpacialIndex2D
objKey
 a userdefined identifier that was [potentially] used in
a previous insertion.extentsArr
 an array to which extent values will be written by this
method; may be null.offset
 specifies the beginning index of where to write extent
values into extentsArr; exactly four entries are written starting at
this index (see above table); if extentsArr is null then this offset
is ignored.
ArrayIndexOutOfBoundsException
 if objKey exists, if
extentsArr is not null, and if extentsArr cannot be written
to in the index range [offset, offset+3].public final boolean delete(int objKey)
delete
in interface MutableSpacialIndex2D
objKey
 a userdefined identifier that was potentially used in a
previous insertion.
public final SpacialEntry2DEnumerator queryOverlap(float xMin, float yMin, float xMax, float yMax, float[] extentsArr, int offset, boolean reverse)
The parameter extentsArr is written into by this method if it is not null. It provides a way for this method to communicate additional information to the caller of this method. If not null, extentsArr is populated with information regarding the minimum bounding rectangle (MBR) that contains all returned entries. The following table describes what is written to extentsArr if it is not null:
array index value if query generates results value if query does not generate results offset xMin of MBR Float.POSITIVE_INFINITY offset+1 yMin of MBR Float.POSITIVE_INFINITY offset+2 xMax of MBR Float.NEGATIVE_INFINITY offset+3 yMax of MBR Float.NEGATIVE_INFINITY
This Rtree has the subquery orderpreserving property, which can be described as follows. Suppose we query the Rtree using this queryOverlap() method, specifying the maximum possible query rectangle (spanned by Float.NEGATIVE_INFINITY and Float.POSITIVE_INFINITY values); we get back all entries currently in this Rtree; the entries returned have a certain order to them. Let's remember this order. Now if we immediately perform any further query, specifying a different (or the same) query rectangle, then the entries that are returned in the query are returned in the same order as they were returned in the "all" query. This phenomenon continues to hold true with any additional queries until the Rtree undergoes a mutating operation such as insert() or delete(). The order of entries returned is in fact a lefttoright order in the underlying tree structure; in the future, if additional query methods are implemented, then they will also return entries in this same order.
IMPORTANT: The returned enumeration becomes invalid as soon as any structuremodifying operation (insert or delete) is performed on this Rtree. Accessing an invalid enumeration's methods will result in unpredictable and illdefined behavior in that enumeration, but will have no effect on the integrity of the underlying tree structure.
NOTE: It may be possible to provide a more optimized version of this algorithm for point queries. Such a public method may be a future addition to this class.
queryOverlap
in interface SpacialIndex2D
xMin
 the minimum X coordinate of the query rectangle.yMin
 the minimum Y coordinate of the query rectangle.xMax
 the maximum X coordinate of the query rectangle.yMax
 the maximum Y coordinate of the query rectangle.extentsArr
 an array to which
extent values will be written by this method; may be null.offset
 specifies the beginning index of where to write extent
values into extentsArr; exactly four entries are written starting at
this index (see table above); if extentsArr is null then this offset
is ignored.reverse
 if true, the order in which the query hits
are returned is reversed.
IllegalArgumentException
 if xMin is not less than or equal to
xMax or if yMin is not less than or equal to yMax.
ArrayIndexOutOfBoundsException
 if extentsArr is not null
and if it cannot be written to in the index range
[offset, offset+3].

Cytoscape 2.8.0 API  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 