Package io.github.jbellis.jvector.util
Class BoundedLongHeap
java.lang.Object
io.github.jbellis.jvector.util.AbstractLongHeap
io.github.jbellis.jvector.util.BoundedLongHeap
An AbstractLongHeap with a fixed maximum size, allocated at construction time.
-
Field Summary
Fields inherited from class io.github.jbellis.jvector.util.AbstractLongHeap
heap, size -
Constructor Summary
ConstructorsConstructorDescriptionBoundedLongHeap(int maxSize) Create an empty Heap of the configured initial size.BoundedLongHeap(int initialSize, int maxSize) -
Method Summary
Modifier and TypeMethodDescriptionbooleanpush(long value) Adds a value to an LongHeap in log(size) time.
-
Constructor Details
-
BoundedLongHeap
public BoundedLongHeap(int maxSize) Create an empty Heap of the configured initial size.- Parameters:
maxSize- the maximum size of the heap
-
BoundedLongHeap
public BoundedLongHeap(int initialSize, int maxSize)
-
-
Method Details
-
push
public boolean push(long value) Description copied from class:AbstractLongHeapAdds a value to an LongHeap in log(size) time.- Specified by:
pushin classAbstractLongHeap- Returns:
- true if the new value was added. (A fixed-size heap will not add the new value if it is full, and the new value is worse than the existing ones.)
-