de.lmu.ifi.dbs.elki.utilities.datastructures.heap
Class TopBoundedHeap<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap<E>
de.lmu.ifi.dbs.elki.utilities.datastructures.heap.TopBoundedHeap<E>
- Type Parameters:
E
- Element type. Should be Comparable
or a Comparator
needs to be given.
- All Implemented Interfaces:
- Serializable, Iterable<E>, Collection<E>, Queue<E>
- Direct Known Subclasses:
- TiedTopBoundedHeap
public class TopBoundedHeap<E>
- extends Heap<E>
Heap class that is bounded in size from the top.
It will keep the bottom k
Elements only.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap |
Heap.Itr |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap |
modCount, size |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.heap.Heap |
castQueueElement, clear, compare, compareExternal, compareExternalExternal, contains, heapifyDown, heapifyUp, heapifyUpParent, iterator, peek, poll, putInQueue, removeAt, size, swap, toSortedArrayList |
serialVersionUID
private static final long serialVersionUID
- Serial version
- See Also:
- Constant Field Values
maxsize
protected int maxsize
- Maximum size
TopBoundedHeap
public TopBoundedHeap(int maxsize)
- Constructor with maximum size only.
- Parameters:
maxsize
- Maximum size
TopBoundedHeap
public TopBoundedHeap(int maxsize,
Comparator<? super E> comparator)
- Constructor with maximum size and
Comparator
.
- Parameters:
maxsize
- Maximum sizecomparator
- Comparator
offer
public boolean offer(E e)
- Specified by:
offer
in interface Queue<E>
- Overrides:
offer
in class Heap<E>
handleOverflow
protected void handleOverflow(E e)
- Handle an overflow in the structure.
This function can be overridden to get overflow treatment.
- Parameters:
e
- Overflowing element.
getMaxSize
public int getMaxSize()
- Returns:
- the maximum size