public class IntDoubleTopN extends AbstractTopN<Tuple2id>
capacity, size
Constructor and Description |
---|
IntDoubleTopN(int capacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(int key,
double value)
Tries to add an integer-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,
Tuple2id e)
Compares the i-th element of the heap with the element
|
protected Tuple2id |
get(int i)
Returns the i-th element in the heap.
|
protected void |
set(int i,
Tuple2id 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 IntDoubleTopN(int capacity)
capacity
- maximum capacity of the heappublic boolean add(int key, double value)
key
- integer to be addedvalue
- double to be addedprotected Tuple2id get(int i)
AbstractTopN
get
in class AbstractTopN<Tuple2id>
i
- index of the elementprotected void set(int i, Tuple2id e)
AbstractTopN
set
in class AbstractTopN<Tuple2id>
i
- indexe
- elementprotected int compare(int i, Tuple2id e)
AbstractTopN
compare
in class AbstractTopN<Tuple2id>
i
- indexe
- elementprotected int compare(int i, int j)
AbstractTopN
compare
in class AbstractTopN<Tuple2id>
i
- indexj
- indexprotected void swap(int i, int j)
AbstractTopN
swap
in class AbstractTopN<Tuple2id>
i
- indexj
- indexCopyright © 2016. All rights reserved.