net.sourceforge.hatbox
Class Node

java.lang.Object
  extended by net.sourceforge.hatbox.AbstractNode
      extended by net.sourceforge.hatbox.Node

public class Node
extends AbstractNode

An rtree node composed of entries with an envelope and an id. A node is either an index node (the entries point to other rtree nodes) or a leaf node (the entries point to rows in a spatial table).

Nodes are stored in binary database columns. This implementation is focused on keeping the object count low.

Author:
Peter Yuill

Field Summary
 
Fields inherited from class net.sourceforge.hatbox.AbstractNode
BOUNDS_MAX_X_OFFSET, BOUNDS_MAX_Y_OFFSET, BOUNDS_MIN_X_OFFSET, BOUNDS_MIN_Y_OFFSET, COUNT_OFFSET, data, dirty, ENTRY_KEY_SIZE, ENTRY_LIST_OFFSET, ENTRY_ORDINATE_SIZE, id, LEVEL_OFFSET, MAX_OFFSET, PARENT_OFFSET
 
Constructor Summary
Node(int level, long parentId, int entriesMax)
           
Node(long id, byte[] data)
           
 
Method Summary
 void addEntry(Entry entry)
           
 void changeEntryEnvelope(Entry entry)
          Find the entry for this id and change its bounds
 Envelope getBounds()
           
 int getEntriesCount()
           
 int getEntriesMax()
           
 Entry getEntry(int i)
           
 long getEntryId(int i)
           
 double getEntryMaxX(int i)
           
 double getEntryMaxY(int i)
           
 double getEntryMinX(int i)
           
 double getEntryMinY(int i)
           
 int getLevel()
           
 int getMinNodeEntries(double minNodeSplit)
           
 Entry getMyEntry()
           
 long getParentId()
           
 boolean intersects(Envelope search, int entryIndex)
           
 boolean isDirty()
           
 boolean isIdAllocated()
           
 boolean isLeaf()
           
 double populateEnvelope(Envelope envelope, int entryIndex)
           
 void putEntryId(long id, int i)
           
 void putEntryMaxX(double maxX, int i)
           
 void putEntryMaxY(double maxY, int i)
           
 void putEntryMinX(double minX, int i)
           
 void putEntryMinY(double minY, int i)
           
 void removeEntry(long entryId)
           
 void resetEntries()
           
 void setDirty(boolean dirty)
           
 void setLevel(int level)
           
 void setParentId(long parentId)
           
 Node split()
           
 java.lang.String toString()
           
 
Methods inherited from class net.sourceforge.hatbox.AbstractNode
equals, getBoolean, getByte, getChar, getData, getDouble, getId, getIndexNodeSize, getInt, getLong, getShort, hashCode, putBoolean, putByte, putChar, putDouble, putInt, putLong, putShort, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(long id,
            byte[] data)

Node

public Node(int level,
            long parentId,
            int entriesMax)
Method Detail

split

public Node split()

getParentId

public long getParentId()

setParentId

public void setParentId(long parentId)

isIdAllocated

public boolean isIdAllocated()

getBounds

public Envelope getBounds()

getMyEntry

public Entry getMyEntry()

resetEntries

public void resetEntries()

addEntry

public void addEntry(Entry entry)

changeEntryEnvelope

public void changeEntryEnvelope(Entry entry)
Find the entry for this id and change its bounds

Parameters:
envelope -
id -

removeEntry

public void removeEntry(long entryId)

isLeaf

public boolean isLeaf()

getLevel

public int getLevel()

setLevel

public void setLevel(int level)

getEntriesCount

public int getEntriesCount()

getEntriesMax

public int getEntriesMax()

populateEnvelope

public double populateEnvelope(Envelope envelope,
                               int entryIndex)

intersects

public final boolean intersects(Envelope search,
                                int entryIndex)

getEntryId

public final long getEntryId(int i)

getEntryMinX

public final double getEntryMinX(int i)

getEntryMaxX

public final double getEntryMaxX(int i)

getEntryMinY

public final double getEntryMinY(int i)

getEntryMaxY

public final double getEntryMaxY(int i)

putEntryId

public final void putEntryId(long id,
                             int i)

putEntryMinX

public final void putEntryMinX(double minX,
                               int i)

putEntryMaxX

public final void putEntryMaxX(double maxX,
                               int i)

putEntryMinY

public final void putEntryMinY(double minY,
                               int i)

putEntryMaxY

public final void putEntryMaxY(double maxY,
                               int i)

getEntry

public Entry getEntry(int i)

getMinNodeEntries

public int getMinNodeEntries(double minNodeSplit)

isDirty

public boolean isDirty()
Overrides:
isDirty in class AbstractNode

setDirty

public void setDirty(boolean dirty)
Overrides:
setDirty in class AbstractNode

toString

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


Copyright © 2010. All Rights Reserved.