org.geotools.caching.grid.spatialindex
Class GridNode

java.lang.Object
  extended by org.geotools.caching.grid.spatialindex.GridNode
All Implemented Interfaces:
java.io.Serializable, Entry, Node
Direct Known Subclasses:
GridRootNode

public class GridNode
extends java.lang.Object
implements Node, java.io.Serializable

A node in the grid.

Data objects are stored in an HashSet.

Author:
Christophe Rousson, SoC 2007, CRG-ULAVAL
See Also:
Serialized Form

Field Summary
protected  java.util.HashSet<GridData> data
           
protected  RegionNodeIdentifier id
           
 
Constructor Summary
protected GridNode()
          No-arg constructor for serialization purpose.
protected GridNode(RegionNodeIdentifier id)
           
 
Method Summary
 void clear()
          Erase all data referenced by this node and clears the valid field of associated node id.
protected  void deleteData(GridData data)
           
 NodeIdentifier getChildIdentifier(int index)
           
 int getChildrenCount()
           
 java.util.HashSet<GridData> getData()
           
 int getDataCount()
           
 NodeIdentifier getIdentifier()
           
 int getLevel()
           
 Shape getShape()
           
protected  boolean insertData(GridData data)
          Insert new data in this node.
 boolean isIndex()
           
 boolean isLeaf()
          If the node is a leaf node (has no children)
 void setIdentifier(NodeIdentifier id)
           
 java.lang.String toReadableText()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.util.HashSet<GridData> data

id

protected transient RegionNodeIdentifier id
Constructor Detail

GridNode

protected GridNode()
No-arg constructor for serialization purpose. Note: after deserialized you need to call setIdentifier(NodeIdentifier) to setup the node properly.


GridNode

protected GridNode(RegionNodeIdentifier id)
Method Detail

setIdentifier

public void setIdentifier(NodeIdentifier id)
Specified by:
setIdentifier in interface Node
Parameters:
id - sets the id of the node

getChildIdentifier

public NodeIdentifier getChildIdentifier(int index)
                                  throws java.lang.IndexOutOfBoundsException
Specified by:
getChildIdentifier in interface Node
Returns:
the child node identifier at the given index
Throws:
java.lang.IndexOutOfBoundsException

getChildrenCount

public int getChildrenCount()
Specified by:
getChildrenCount in interface Node
Returns:
the number of child nodes

getLevel

public int getLevel()
Specified by:
getLevel in interface Node

isIndex

public boolean isIndex()
Specified by:
isIndex in interface Node

isLeaf

public boolean isLeaf()
Description copied from interface: Node
If the node is a leaf node (has no children)

Specified by:
isLeaf in interface Node
Returns:

getIdentifier

public NodeIdentifier getIdentifier()
Specified by:
getIdentifier in interface Node
Returns:
the id of the node

getShape

public Shape getShape()
Specified by:
getShape in interface Entry

insertData

protected boolean insertData(GridData data)
Insert new data in this node.

Parameters:
id - of data
data -

deleteData

protected void deleteData(GridData data)

clear

public void clear()
Erase all data referenced by this node and clears the valid field of associated node id.

Specified by:
clear in interface Node

getDataCount

public int getDataCount()
Specified by:
getDataCount in interface Node
Returns:
the amount of data stored in the node

getData

public java.util.HashSet<GridData> getData()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toReadableText

public java.lang.String toReadableText()


Copyright © 1996-2010 Geotools. All Rights Reserved.