|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.AbstractIndirectPriorityQueue
it.unimi.dsi.fastutil.shorts.ShortHeapSemiIndirectPriorityQueue
it.unimi.dsi.fastutil.shorts.ShortHeapSesquiIndirectDoublePriorityQueue
A type-specific heap-based sesqui-indirect double priority queue.
Instances of this class are based on a semi-indirect and an indirect
heap-based queues. The queues are enlarged as needed, but they are never
shrunk. Use the trim()
method to reduce their size, if necessary.
Either comparator may be null
, indicating that natural comparison should take place. Of course,
it makes little sense having them equal.
Constructor Summary | |
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray)
Creates a new empty queue with capacity equal to the length of the reference array and natural order as primary comparator. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int capacity)
Creates a new empty queue with a given capacity and natural order as primary comparator. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int[] a)
Wraps a given array in a queue using the natural order. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int[] a,
int size)
Wraps a given array in a queue using the natural order. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int[] a,
int size,
ShortComparator c)
Wraps a given array in a queue using a given comparator. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int[] a,
int size,
ShortComparator c,
ShortComparator d)
Wraps a given array in a queue using the given comparators. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int[] a,
ShortComparator c)
Wraps a given array in a queue using a given comparator. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int[] a,
ShortComparator c,
ShortComparator d)
Wraps a given array in a queue using the given comparators. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int capacity,
ShortComparator c)
Creates a new empty queue with a given capacity. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
int capacity,
ShortComparator c,
ShortComparator d)
Creates a new empty queue with a given capacity. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
ShortComparator c)
Creates a new empty queue with capacity equal to the length of the reference array. |
|
ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray,
ShortComparator c,
ShortComparator d)
Creates a new empty queue with capacity equal to the length of the reference array. |
Method Summary | |
void |
allChanged()
Notifies the queue that the all elements have changed (optional operation). |
void |
changed()
Notifies the queue that the first element has changed (optional operation). |
void |
clear()
Removes all elements from this queue. |
int |
dequeue()
Dequeues the first element from the queue. |
void |
enqueue(int x)
Enqueues a new element. |
Comparator |
secondaryComparator()
Returns the secondary comparator of this queue. |
int |
secondaryFirst()
Returns the first element of this queue with respect to the secondary comparator. |
int |
secondaryLast()
Returns the last element of this queue with respect to the secondary comparator (optional operation). |
void |
trim()
Trims the underlying queues so they have exactly ShortHeapSemiIndirectPriorityQueue.size() elements. |
Methods inherited from class it.unimi.dsi.fastutil.shorts.ShortHeapSemiIndirectPriorityQueue |
comparator, first, size, toString |
Methods inherited from class it.unimi.dsi.fastutil.AbstractIndirectPriorityQueue |
changed, isEmpty, last, remove |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.fastutil.IndirectPriorityQueue |
changed, comparator, first, isEmpty, last, remove, size |
Constructor Detail |
public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int capacity, ShortComparator c, ShortComparator d)
refArray
- the reference array.capacity
- the initial capacity of this queue.c
- the primary comparator used in this queue, or null
for the natural order.d
- the secondary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int capacity, ShortComparator c)
This constructor uses as secondary comparator the opposite order of c
.
refArray
- the reference array.capacity
- the initial capacity of this queue.c
- the primary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int capacity)
This constructor uses as secondary comparator the opposite of the natural order.
refArray
- the reference array.capacity
- the initial capacity of this queue.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, ShortComparator c, ShortComparator d)
refArray
- the reference array.c
- the primary comparator used in this queue, or null
for the natural order.d
- the secondary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, ShortComparator c)
This constructor uses as secondary comparator the opposite order of c
.
refArray
- the reference array.c
- the primary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray)
This constructor uses as secondary comparator the opposite of the natural order.
refArray
- the reference array.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int[] a, int size, ShortComparator c, ShortComparator d)
The queue returned by this method will be backed by the given array.
The first size
element of the array will be rearranged so to form a heap, and
moreover the array will be cloned and wrapped in a secondary queue (this is
more efficient than enqueing the elements of a
one by one).
refArray
- the reference array.a
- an array of indices into refArray
.size
- the number of elements to be included in the queue.c
- the primary comparator used in this queue, or null
for the natural order.d
- the secondary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int[] a, ShortComparator c, ShortComparator d)
The queue returned by this method will be backed by the given array.
The first elements of the array will be rearranged so to form a heap, and
moreover the array will be cloned and wrapped in a secondary queue (this is
more efficient than enqueing the elements of a
one by one).
refArray
- the reference array.a
- an array of indices into refArray
.c
- the primary comparator used in this queue, or null
for the natural order.d
- the secondary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int[] a, int size, ShortComparator c)
The queue returned by this method will be backed by the given array.
The first size
element of the array will be rearranged so to form a heap, and
moreover the array will be cloned and wrapped in a secondary queue (this is
more efficient than enqueing the elements of a
one by one).
This constructor uses as secondary comparator the opposite order of c
.
refArray
- the reference array.a
- an array of indices into refArray
.size
- the number of elements to be included in the queue.c
- the primary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int[] a, ShortComparator c)
The queue returned by this method will be backed by the given array.
The elements of the array will be rearranged so to form a heap, and
moreover the array will be cloned and wrapped in a secondary queue (this is
more efficient than enqueing the elements of a
one by one).
This constructor uses as secondary comparator the opposite order of c
.
refArray
- the reference array.a
- an array of indices into refArray
.c
- the primary comparator used in this queue, or null
for the natural order.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int[] a, int size)
The queue returned by this method will be backed by the given array.
The first size
element of the array will be rearranged so to form a heap, and
moreover the array will be cloned and wrapped in a secondary queue (this is
more efficient than enqueing the elements of a
one by one).
This constructor uses as secondary comparator the opposite of the natural order.
refArray
- the reference array.a
- an array of indices into refArray
.size
- the number of elements to be included in the queue.public ShortHeapSesquiIndirectDoublePriorityQueue(short[] refArray, int[] a)
The queue returned by this method will be backed by the given array.
The elements of the array will be rearranged so to form a heap, and
moreover the array will be cloned and wrapped in a secondary queue (this is
more efficient than enqueing the elements of a
one by one).
This constructor uses as secondary comparator the opposite of the natural order.
refArray
- the reference array.a
- an array of indices into refArray
.Method Detail |
public void enqueue(int x)
IndirectPriorityQueue
enqueue
in interface IndirectPriorityQueue
enqueue
in class ShortHeapSemiIndirectPriorityQueue
public int dequeue()
IndirectPriorityQueue
dequeue
in interface IndirectPriorityQueue
dequeue
in class ShortHeapSemiIndirectPriorityQueue
public int secondaryFirst()
IndirectDoublePriorityQueue
secondaryFirst
in interface IndirectDoublePriorityQueue
public int secondaryLast()
IndirectDoublePriorityQueue
secondaryLast
in interface IndirectDoublePriorityQueue
public void changed()
IndirectPriorityQueue
changed
in interface IndirectPriorityQueue
changed
in class ShortHeapSemiIndirectPriorityQueue
public void allChanged()
IndirectPriorityQueue
allChanged
in interface IndirectPriorityQueue
allChanged
in class ShortHeapSemiIndirectPriorityQueue
public void clear()
IndirectPriorityQueue
clear
in interface IndirectPriorityQueue
clear
in class ShortHeapSemiIndirectPriorityQueue
public void trim()
ShortHeapSemiIndirectPriorityQueue.size()
elements.
trim
in class ShortHeapSemiIndirectPriorityQueue
public Comparator secondaryComparator()
secondaryComparator
in interface IndirectDoublePriorityQueue
secondaryFirst()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |