Package com.esri.core.geometry
Class BucketSort
- java.lang.Object
-
- com.esri.core.geometry.BucketSort
-
final class BucketSort extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AttributeStreamOfInt32
m_bucketed_indices
(package private) AttributeStreamOfInt32
m_buckets
(package private) double
m_dy
(package private) double
m_max_value
(package private) double
m_min_value
(package private) static int
MAXBUCKETS
-
Constructor Summary
Constructors Constructor Description BucketSort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
getBucket(double value)
Adds new element to the bucket builder.private int
getBucketCount()
Returns the bucket count.private boolean
reset(int bucket_count, double min_value, double max_value, int capacity)
Clears and resets Bucket_sort to the new state, preparing for the accumulation of new data.void
sort(AttributeStreamOfInt32 indices, int begin, int end, ClassicSort sorter)
Executes sort on the Bucket_sort.
-
-
-
Field Detail
-
m_buckets
AttributeStreamOfInt32 m_buckets
-
m_bucketed_indices
AttributeStreamOfInt32 m_bucketed_indices
-
m_min_value
double m_min_value
-
m_max_value
double m_max_value
-
m_dy
double m_dy
-
MAXBUCKETS
static int MAXBUCKETS
-
-
Method Detail
-
sort
public void sort(AttributeStreamOfInt32 indices, int begin, int end, ClassicSort sorter)
Executes sort on the Bucket_sort. The result is fed into the indices array in the range between begin (inclusive) and end (exclusive). Uses user supplied sorter to execute sort on each bucket. Users either supply the sorter and use this method of Bucket_sort class, or use other methods to form the buckets and take care of bucket sorting themselves.
-
reset
private boolean reset(int bucket_count, double min_value, double max_value, int capacity)
Clears and resets Bucket_sort to the new state, preparing for the accumulation of new data.- Parameters:
bucket_count
- - the number of buckets. Usually equal to the number of elements to sort.min_value
- - the minimum value of elements to sort.max_value
- - the maximum value of elements to sort.capacity
- - the number of elements to sort (-1 if not known). The bucket_count are usually equal.- Returns:
- Returns False, if the bucket sort cannot be used with the given parameters. The method also can throw out of memory exception. In the later case, one should fall back to the regular sort.
-
getBucket
private int getBucket(double value)
Adds new element to the bucket builder. The value must be between min_value and max_value.- Parameters:
The
- value used for bucketing.The
- index of the element to store in the buffer. Usually it is an index into some array, where the real elements are stored.
-
getBucketCount
private int getBucketCount()
Returns the bucket count.
-
-