public class KdTreePartitioner extends Partitioner
| Constructor and Description |
|---|
KdTreePartitioner()
A default constructor to be able to dynamically instantiate it
and deserialize it
|
| Modifier and Type | Method and Description |
|---|---|
void |
createFromPoints(Rectangle mbr,
Point[] points,
int numPartitions)
Populate this partitioner for a set of points and number of partitions
|
static int |
getNumberOfSignificantBits(int x)
Get number of significant bits.
|
CellInfo |
getPartition(int id)
Returns the details of a specific partition given its ID.
|
CellInfo |
getPartitionAt(int index)
Returns the detail of a partition given its position starting from zero
and ending at partitionCount() - 1
|
int |
getPartitionCount()
Returns total number of partitions
|
static void |
main(java.lang.String[] args) |
int |
overlapPartition(Shape shape)
Returns only one overlapping partition.
|
void |
overlapPartitions(Shape shape,
ResultCollector<java.lang.Integer> matcher)
Overlap a shape with partitions and calls a matcher for each overlapping
partition.
|
static <T> void |
partialQuickSort(T[] a,
int fromIndex,
int toIndex,
int desiredIndex,
java.util.Comparator<T> c)
Reorders the given subrange of the array so that the element at the
desiredIndex is at its correct position.
|
void |
readFields(java.io.DataInput in) |
void |
write(java.io.DataOutput out) |
getPartitioner, setPartitionerpublic KdTreePartitioner()
public void createFromPoints(Rectangle mbr, Point[] points, int numPartitions)
PartitionercreateFromPoints in class Partitionerpublic static <T> void partialQuickSort(T[] a,
int fromIndex,
int toIndex,
int desiredIndex,
java.util.Comparator<T> c)
a - - the array to sortfromIndex - - the index of the first element in the subrangetoIndex - - the index after the last element in the subrangedesiredIndex - - the index which needs to be adjustedc - - the comparator used to compare array elementspublic void write(java.io.DataOutput out)
throws java.io.IOException
java.io.IOExceptionpublic void readFields(java.io.DataInput in)
throws java.io.IOException
java.io.IOExceptionpublic int getPartitionCount()
PartitionergetPartitionCount in class Partitionerpublic void overlapPartitions(Shape shape, ResultCollector<java.lang.Integer> matcher)
PartitioneroverlapPartitions in class Partitionerpublic int overlapPartition(Shape shape)
PartitioneroverlapPartition in class Partitionershape - public CellInfo getPartitionAt(int index)
PartitionergetPartitionAt in class Partitionerpublic CellInfo getPartition(int id)
PartitionergetPartition in class Partitionerpublic static int getNumberOfSignificantBits(int x)
x - public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException