com.vividsolutions.jts.index.quadtree
Class NodeBase

java.lang.Object
  extended by com.vividsolutions.jts.index.quadtree.NodeBase
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Node, Root

public abstract class NodeBase
extends Object
implements Serializable

The base class for nodes in a Quadtree.

Version:
1.7
See Also:
Serialized Form

Field Summary
protected  List items
           
protected  Node[] subnode
          subquads are numbered as follows:
 
Constructor Summary
NodeBase()
           
 
Method Summary
 void add(Object item)
           
 List addAllItems(List resultItems)
           
 void addAllItemsFromOverlapping(Envelope searchEnv, List resultItems)
           
 List getItems()
           
static int getSubnodeIndex(Envelope env, double centrex, double centrey)
          Gets the index of the subquad that wholly contains the given envelope.
 boolean hasChildren()
           
 boolean hasItems()
           
 boolean isEmpty()
           
 boolean isPrunable()
           
protected abstract  boolean isSearchMatch(Envelope searchEnv)
           
 boolean remove(Envelope itemEnv, Object item)
          Removes a single item from this subtree.
 void visit(Envelope searchEnv, ItemVisitor visitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

protected List items

subnode

protected Node[] subnode
subquads are numbered as follows:
  2 | 3
  --+--
  0 | 1
 

Constructor Detail

NodeBase

public NodeBase()
Method Detail

getSubnodeIndex

public static int getSubnodeIndex(Envelope env,
                                  double centrex,
                                  double centrey)
Gets the index of the subquad that wholly contains the given envelope. If none does, returns -1.

Returns:
the index of the subquad that wholly contains the given envelope or -1 if no subquad wholly contains the envelope

getItems

public List getItems()

hasItems

public boolean hasItems()

add

public void add(Object item)

remove

public boolean remove(Envelope itemEnv,
                      Object item)
Removes a single item from this subtree.

Parameters:
itemEnv - the envelope containing the item
item - the item to remove
Returns:
true if the item was found and removed

isPrunable

public boolean isPrunable()

hasChildren

public boolean hasChildren()

isEmpty

public boolean isEmpty()

addAllItems

public List addAllItems(List resultItems)

isSearchMatch

protected abstract boolean isSearchMatch(Envelope searchEnv)

addAllItemsFromOverlapping

public void addAllItemsFromOverlapping(Envelope searchEnv,
                                       List resultItems)

visit

public void visit(Envelope searchEnv,
                  ItemVisitor visitor)


Copyright © 2012. All Rights Reserved.