类 TripleLongPriorityQueue
java.lang.Object
org.apache.pulsar.common.util.collections.TripleLongPriorityQueue
- 所有已实现的接口:
AutoCloseable
Provides a priority-queue implementation specialized on items composed by 3 longs.
This class is not thread safe and the items are stored in direct memory.
-
构造器概要
构造器构造器说明Create a new priority queue with default initial capacity.TripleLongPriorityQueue(int initialCapacity) Create a new priority queue with a given initial capacity.TripleLongPriorityQueue(long initialCapacity, float shrinkFactor) -
方法概要
修饰符和类型方法说明voidadd(long n1, long n2, long n3) Add a tuple of 3 long items to the priority queue.longThe amount of memory used to back the priority queue.voidclear()Clear all items.voidclose()Close the priority queue and free the memory associated.booleanisEmpty()Returns whether the priority queue is empty.longpeekN1()Read the 1st long item in the top tuple in the priority queue.longpeekN2()Read the 2nd long item in the top tuple in the priority queue.longpeekN3()Read the 3rd long item in the top tuple in the priority queue.voidpop()Removes the first item from the queue.longsize()Returns the number of tuples in the priority queue.
-
构造器详细资料
-
TripleLongPriorityQueue
public TripleLongPriorityQueue()Create a new priority queue with default initial capacity. -
TripleLongPriorityQueue
public TripleLongPriorityQueue(long initialCapacity, float shrinkFactor) -
TripleLongPriorityQueue
public TripleLongPriorityQueue(int initialCapacity) Create a new priority queue with a given initial capacity.- 参数:
initialCapacity-
-
-
方法详细资料
-
close
public void close()Close the priority queue and free the memory associated.- 指定者:
close在接口中AutoCloseable
-
add
public void add(long n1, long n2, long n3) Add a tuple of 3 long items to the priority queue.- 参数:
n1-n2-n3-
-
peekN1
public long peekN1()Read the 1st long item in the top tuple in the priority queue.The tuple will not be extracted
-
peekN2
public long peekN2()Read the 2nd long item in the top tuple in the priority queue.The tuple will not be extracted
-
peekN3
public long peekN3()Read the 3rd long item in the top tuple in the priority queue.The tuple will not be extracted
-
pop
public void pop()Removes the first item from the queue. -
isEmpty
public boolean isEmpty()Returns whether the priority queue is empty. -
size
public long size()Returns the number of tuples in the priority queue. -
bytesCapacity
public long bytesCapacity()The amount of memory used to back the priority queue. -
clear
public void clear()Clear all items.
-