T
- type of the objectpublic class ObjectDoubleTopN<T> extends AbstractTopN<Tuple2od<T>>
capacity, size
Constructor and Description |
---|
ObjectDoubleTopN(int capacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T object,
double value)
Tries to add an object-double pair to the heap.
|
protected int |
compare(int i,
int j)
Compares the i-th element of the heap with the j-th element in the heap.
|
protected int |
compare(int i,
Tuple2od<T> e)
Compares the i-th element of the heap with the element
|
protected Tuple2od<T> |
get(int i)
Returns the i-th element in the heap.
|
protected void |
set(int i,
Tuple2od<T> e)
Sets the element in the i-th position of the heap.
|
protected void |
swap(int i,
int j)
Swaps the elements in the i-th and j-th element in the heap.
|
add, iterator, peek, reverseIterator, reverseStream, size, sort
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
public ObjectDoubleTopN(int capacity)
capacity
- maximum capacity of the heappublic boolean add(T object, double value)
object
- object to be addedvalue
- double to be addedprotected Tuple2od<T> get(int i)
AbstractTopN
get
in class AbstractTopN<Tuple2od<T>>
i
- index of the elementprotected void set(int i, Tuple2od<T> e)
AbstractTopN
set
in class AbstractTopN<Tuple2od<T>>
i
- indexe
- elementprotected int compare(int i, Tuple2od<T> e)
AbstractTopN
compare
in class AbstractTopN<Tuple2od<T>>
i
- indexe
- elementprotected int compare(int i, int j)
AbstractTopN
compare
in class AbstractTopN<Tuple2od<T>>
i
- indexj
- indexprotected void swap(int i, int j)
AbstractTopN
swap
in class AbstractTopN<Tuple2od<T>>
i
- indexj
- indexCopyright © 2016. All rights reserved.