|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--TreeJuxtaposer.RangeTree
A class representing a two-dimensional orthogonal range tree. RangeTree is a class that can answer range query in time (log n)^2. It implements the data structure of 2D range tree. Nodes of this tree are objects of type RangeNode.
RangeNode
,
Tree2Tree
,
AccordionDrawer.Tree
,
AccordionDrawer.TreeNode
Constructor Summary | |
RangeTree(TreeJuxtaposer.Point[] A,
int dim)
Constructor: calls RangeTreeBuild to build the tree |
|
RangeTree(Tree treeA,
Tree treeB,
TreeJuxtaposer.Tree2Tree t2t)
constructor: builds a 2D RangeTree data structure. |
Method Summary | |
RangeNode |
build2D(TreeJuxtaposer.Point[] A,
int start,
int end)
builds a 2D range tree using points from A[start] to A[end]. |
int |
getElement()
|
RangeNode |
getRoot()
|
boolean |
isEmpty()
|
static void |
mergeSort(TreeJuxtaposer.Point[] A,
int dim)
This implements a regular merge sort algorithm. |
int |
query2D(int xlow,
int xhigh,
int ylow,
int yhigh)
Query2D returns the total number of points contained in the window [xlow, xhigh] X [ylow, yhigh]. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RangeTree(Tree treeA, Tree treeB, TreeJuxtaposer.Tree2Tree t2t)
treeA
- the first treetreeB
- the second treet2t
- we're using the function getBestCorrNode of class Tree2Treepublic RangeTree(TreeJuxtaposer.Point[] A, int dim)
dim
- dim = 0 represents a 2D range tree, dim = 1 represents a
1D range tree. This notation is not intuitive.A
- an array of pointsMethod Detail |
public boolean isEmpty()
public RangeNode getRoot()
public int getElement()
public RangeNode build2D(TreeJuxtaposer.Point[] A, int start, int end)
A
- an array of pointsstart
- the start position from the arrayend
- the end position from the arraypublic int query2D(int xlow, int xhigh, int ylow, int yhigh)
xlow
- the leftmost value of x coordinatexhigh
- the rightmost value of x coordinateylow
- the lowest value of y coordinateyhigh
- the highest value of y coordinate
public static void mergeSort(TreeJuxtaposer.Point[] A, int dim)
A
- an array to be sorteddim
- the corresponding coordinate that sorting is based on
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |