T
- class of objects stored in this collectionpublic class DistanceRankedSortedCollection<T extends DistanceRankedObject<?>> extends SortedCollection<T>
SortedCollection
that is specific for distance-ranked objects.DEFAULT_INITIAL_CAPACITY, UNLIMITED_CAPACITY
Constructor and Description |
---|
DistanceRankedSortedCollection()
Constructs an empty collection.
|
DistanceRankedSortedCollection(java.util.Comparator<? super T> comparator)
Constructs an empty collection.
|
DistanceRankedSortedCollection(int initialCapacity,
int maximalCapacity)
Constructs an empty collection with the specified initial and maximal capacity.
|
DistanceRankedSortedCollection(int initialCapacity,
int maximalCapacity,
java.util.Comparator<? super T> comparator)
Constructs an empty collection with the specified initial and maximal capacity.
|
Modifier and Type | Method and Description |
---|---|
float |
getLastDistance()
Returns the distance of the last object in this collection.
|
float |
getThresholdDistance()
Returns the threshold distance for this collection.
|
java.util.Iterator<T> |
iteratorDistanceRestricted(float maxDistance)
Returns a distance-restricted iterator.
|
java.util.Iterator<T> |
iteratorDistanceRestricted(float minDistance,
float maxDistance)
Returns a distance-restricted iterator.
|
add, add, addAll, addAllSortedArray, clear, clone, clone, compare, contains, containsAll, element, get, getComparator, getMaximalCapacity, isEmpty, isFull, iterator, iterator, offer, peek, poll, popLast, remove, remove, remove, removeAll, removeAll, removeFirst, removeFirstN, removeLast, retainAll, setMaximalCapacity, size, toArray, toArray, toString
binarySearch, first, fullSearch, indexOf, last, mergeSort
public DistanceRankedSortedCollection(int initialCapacity, int maximalCapacity, java.util.Comparator<? super T> comparator) throws java.lang.IllegalArgumentException
initialCapacity
- the initial capacity of the collectionmaximalCapacity
- the maximal capacity of the collectioncomparator
- the comparator that defines orderingjava.lang.IllegalArgumentException
- if the specified initial or maximal capacity is invalidpublic DistanceRankedSortedCollection(int initialCapacity, int maximalCapacity) throws java.lang.IllegalArgumentException
initialCapacity
- the initial capacity of the collectionmaximalCapacity
- the maximal capacity of the collectionjava.lang.IllegalArgumentException
- if the specified initial or maximal capacity is invalidpublic DistanceRankedSortedCollection(java.util.Comparator<? super T> comparator)
comparator
- the comparator that defines orderingpublic DistanceRankedSortedCollection()
SortedCollection.DEFAULT_INITIAL_CAPACITY
and maximal capacity is not limited.public float getLastDistance() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if this collection is emptypublic float getThresholdDistance()
LocalAbstractObject.MAX_DISTANCE
is returned.
Otherwise, the distance of the last object of this collection is returned.LocalAbstractObject.MAX_DISTANCE
if there are not enough objects.public java.util.Iterator<T> iteratorDistanceRestricted(float minDistance, float maxDistance)
minDistance
- the minimal distance of the ranked objects to returnmaxDistance
- the maximal distance of the ranked objects to returnpublic java.util.Iterator<T> iteratorDistanceRestricted(float maxDistance)
maxDistance
- the maximal distance of the ranked objects to return