|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.kdtree.TwoDNode
algs.model.kdtree.VerticalNode
public class VerticalNode
Represents a node in the 2D-tree that partitions the space by means of a vertical line at the given x-coordinate.
This class is intended as a simpler, optimized implementation of DimensionalNode
for two dimensional KD trees.
Ancestors via the left son are those points which are to the left of the point represented by this node. Ancestors via the right son are those points which are to the right of the point represented by this node.
Field Summary |
---|
Fields inherited from class algs.model.kdtree.TwoDNode |
---|
coord, point |
Constructor Summary | |
---|---|
VerticalNode(IPoint point)
X-coordinate is taken from the IPoint. |
Method Summary | |
---|---|
TwoDNode |
construct(IPoint value)
This method constructs the node of the appropriate class based upon the vertical property of this node. |
protected boolean |
inAboveRange(IRectangle r)
Helper method for search algorithm, implemented in the Horizontal and Vertical subclasses. |
protected boolean |
inBelowRange(IRectangle r)
Helper method for search algorithm, implemented in the Horizontal and Vertical subclasses. |
boolean |
isBelow(IPoint point)
Returns whether the point is below the line represented by this node. |
boolean |
isVertical()
Determines whether node splits plane vertically |
protected void |
split(TwoDNode child,
boolean above)
Manipulates child node's region accordingly, based on our own. |
Methods inherited from class algs.model.kdtree.TwoDNode |
---|
getAbove, getBelow, getRegion, search, search, setAbove, setBelow, specialUpdateRectangle, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VerticalNode(IPoint point)
point
- Point being stored.Method Detail |
---|
public boolean isVertical()
TwoDNode
isVertical
in class TwoDNode
TwoDNode.isVertical()
public TwoDNode construct(IPoint value)
In short, this acts as a factory for the nodes in the next level of the tree.
construct
in class TwoDNode
value
- IPoint
object to be stored with the constructed node
protected void split(TwoDNode child, boolean above)
TwoDNode
For VerticalNode
, below is clear. For HorizontalNode
, a true value
for below is interpreted as being left.
split
in class TwoDNode
child
- child node to be affected by splitabove
- Determines whether to return left- or bottom- sideTwoDNode.split(TwoDNode, boolean)
protected boolean inBelowRange(IRectangle r)
TwoDNode
inBelowRange
in class TwoDNode
r
- query rectangleTwoDNode.inBelowRange(IRectangle)
protected boolean inAboveRange(IRectangle r)
TwoDNode
inAboveRange
in class TwoDNode
r
- query rectangleTwoDNode.inAboveRange(IRectangle)
public boolean isBelow(IPoint point)
TwoDNode
For vertical nodes, below is clear. For horizontal nodes, a true value for below is interpreted as being left.
isBelow
in class TwoDNode
TwoDNode.isBelow(IPoint)
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |