public class FixedCapacityLongFloatMinHeap extends Object implements Long2FloatMapEntryIterable
| Constructor and Description |
|---|
FixedCapacityLongFloatMinHeap(int capacity)
Initialize the heap with desired capacity
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(long key,
float value)
Add a key value pair
|
void |
clear()
Clear the heap
|
protected int |
compare(long key1,
float value1,
long key2,
float value2)
Comapre two (key, value) entries
|
void |
forEachLongFloat(LongFloatConsumer f)
Traverse all elements of the heap, calling given function on each element.
|
boolean |
forEachWhileLongFloat(LongFloatPredicate f)
Traverse all elements of the heap, calling given function on each element,
or until predicate returns false.
|
int |
getCapacity()
Get capacity of the heap
|
long |
getMinKey() |
float |
getMinValue() |
boolean |
isEmpty()
Check if the heap is empty
|
it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.longs.Long2FloatMap.Entry> |
iterator()
Get the iterator.
|
static FixedCapacityLongFloatMinHeap |
read(FixedCapacityLongFloatMinHeap heap,
DataInput in)
Deserializes an object from data input.
|
void |
removeMin()
Removes the (key, value) pair that corresponds to the minimum value
currently in the heap.
|
int |
size()
Get the size of this iterable
|
static void |
write(FixedCapacityLongFloatMinHeap heap,
DataOutput out)
Serializes an object into data output.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic FixedCapacityLongFloatMinHeap(int capacity)
capacity - Capacitypublic void clear()
public void add(long key,
float value)
key - Keyvalue - Valuepublic long getMinKey()
NoSuchElementException - if the heap is empty.public float getMinValue()
NoSuchElementException - if the heap is empty.public void removeMin()
protected int compare(long key1,
float value1,
long key2,
float value2)
key1 - First keyvalue1 - First valuekey2 - Second keyvalue2 - Second valuepublic it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.longs.Long2FloatMap.Entry> iterator()
Long2FloatMapEntryIterableiterator in interface it.unimi.dsi.fastutil.objects.ObjectIterable<it.unimi.dsi.fastutil.longs.Long2FloatMap.Entry>iterator in interface Iterable<it.unimi.dsi.fastutil.longs.Long2FloatMap.Entry>iterator in interface Long2FloatMapEntryIterablepublic int size()
Long2FloatMapEntryIterablesize in interface Long2FloatMapEntryIterablepublic boolean isEmpty()
public int getCapacity()
public static void write(FixedCapacityLongFloatMinHeap heap, DataOutput out) throws IOException
heap - Object instance to serializeout - Data outputIOExceptionpublic static FixedCapacityLongFloatMinHeap read(FixedCapacityLongFloatMinHeap heap, DataInput in) throws IOException
heap - Object to reuse if possiblein - Data inputIOExceptionpublic void forEachLongFloat(LongFloatConsumer f)
f - Function to call on each element.public boolean forEachWhileLongFloat(LongFloatPredicate f)
f - Function to call on each element.Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.