|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.AbstractIndirectPriorityQueue<java.lang.Short>
it.unimi.dsi.fastutil.shorts.ShortArrayIndirectPriorityQueue
it.unimi.dsi.fastutil.shorts.ShortArrayIndirectDoublePriorityQueue
public class ShortArrayIndirectDoublePriorityQueue
A type-specific array-based indirect double priority queue.
Instances of this class are based on a single array. This implementation
is extremely inefficient, but it is difficult to beat when the size of the
queue is very small. The array is enlarged as needed, but it is never
shrunk. Use the ShortArrayIndirectPriorityQueue.trim()
method to reduce its 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 | |
---|---|
ShortArrayIndirectDoublePriorityQueue(short[] refArray)
Creates a new empty queue with capacity equal to the length of the reference array and natural order as primary comparator. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int capacity)
Creates a new empty queue with a given capacity and natural order as primary comparator. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int[] a)
Wraps a given array in a queue using the natural order and its opposite. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int[] a,
int size)
Wraps a given array in a queue using the natural order and its opposite. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int[] a,
int size,
ShortComparator c)
Wraps a given array in a queue using a given comparator and its opposite. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int[] a,
int size,
ShortComparator c,
ShortComparator d)
Wraps a given array in a queue using the given comparators. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int[] a,
ShortComparator c)
Wraps a given array in a queue using a given comparator and its opposite. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int[] a,
ShortComparator c,
ShortComparator d)
Wraps a given array in a queue using the given comparators. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int capacity,
ShortComparator c)
Creates a new empty queue with a given capacity. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
int capacity,
ShortComparator c,
ShortComparator d)
Creates a new empty queue with a given capacity. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
ShortComparator c)
Creates a new empty queue with capacity equal to the length of the reference array. |
|
ShortArrayIndirectDoublePriorityQueue(short[] refArray,
ShortComparator c,
ShortComparator d)
Creates a new empty queue with capacity equal to the length of the reference array. |
Method Summary | |
---|---|
void |
changed(int i)
Notifies the queue that the specified element has changed (optional operation). Note that for efficiency reasons this method will not throw an exception when index is not in the queue. |
ShortComparator |
secondaryComparator()
Returns the secondary comparator of this queue. |
int |
secondaryFirst()
Returns the first element of this queue with respect to the secondary comparator. |
int |
secondaryFront(int[] a)
Retrieves the secondary front of the queue in a given array (optional operation). |
int |
secondaryLast()
Returns the last element of this queue with respect to the secondary comparator (optional operation). |
Methods inherited from class it.unimi.dsi.fastutil.shorts.ShortArrayIndirectPriorityQueue |
---|
allChanged, changed, clear, comparator, dequeue, enqueue, first, front, last, remove, size, toString, trim |
Methods inherited from class it.unimi.dsi.fastutil.AbstractIndirectPriorityQueue |
---|
isEmpty |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortIndirectPriorityQueue |
---|
comparator |
Methods inherited from interface it.unimi.dsi.fastutil.IndirectPriorityQueue |
---|
allChanged, changed, clear, dequeue, enqueue, first, front, isEmpty, last, remove, size |
Methods inherited from interface it.unimi.dsi.fastutil.IndirectPriorityQueue |
---|
allChanged, changed, clear, dequeue, enqueue, first, front, isEmpty, last, remove, size |
Constructor Detail |
---|
public ShortArrayIndirectDoublePriorityQueue(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 ShortArrayIndirectDoublePriorityQueue(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 ShortArrayIndirectDoublePriorityQueue(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 ShortArrayIndirectDoublePriorityQueue(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 ShortArrayIndirectDoublePriorityQueue(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 ShortArrayIndirectDoublePriorityQueue(short[] refArray)
This constructor uses as secondary comparator the opposite of the natural order.
refArray
- the reference array.public ShortArrayIndirectDoublePriorityQueue(short[] refArray, int[] a, int size, ShortComparator c, ShortComparator d)
The queue returned by this method will be backed by the given array.
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 ShortArrayIndirectDoublePriorityQueue(short[] refArray, int[] a, ShortComparator c, ShortComparator d)
The queue returned by this method will be backed by the given array.
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 ShortArrayIndirectDoublePriorityQueue(short[] refArray, int[] a, int size, ShortComparator c)
The queue returned by this method will be backed by the given array.
refArray
- the reference array.a
- an array of indices into refArray
.size
- the number of elements to be included in the queue.c
- the comparator used in this queue, or null
for the natural order.public ShortArrayIndirectDoublePriorityQueue(short[] refArray, int[] a, ShortComparator c)
The queue returned by this method will be backed by the given array.
refArray
- the reference array.a
- an array of indices into refArray
.c
- the comparator used in this queue, or null
for the natural order.public ShortArrayIndirectDoublePriorityQueue(short[] refArray, int[] a, int size)
The queue returned by this method will be backed by the given array.
refArray
- the reference array.a
- an array of indices into refArray
.size
- the number of elements to be included in the queue.public ShortArrayIndirectDoublePriorityQueue(short[] refArray, int[] a)
The queue returned by this method will be backed by the given array.
refArray
- the reference array.a
- an array of indices into refArray
.Method Detail |
---|
public int secondaryFirst()
IndirectDoublePriorityQueue
secondaryFirst
in interface IndirectDoublePriorityQueue<java.lang.Short>
public int secondaryLast()
IndirectDoublePriorityQueue
secondaryLast
in interface IndirectDoublePriorityQueue<java.lang.Short>
public int secondaryFront(int[] a)
IndirectDoublePriorityQueue
secondaryFront
in interface IndirectDoublePriorityQueue<java.lang.Short>
a
- an array large enough to hold the secondary front (e.g., at least long as the reference array).
a
).IndirectPriorityQueue.front(int[])
public void changed(int i)
ShortArrayIndirectPriorityQueue
Note that the specified element must belong to the queue.
Note that for efficiency reasons this method will not throw an exception
when index
is not in the queue.
changed
in interface IndirectPriorityQueue<java.lang.Short>
changed
in class ShortArrayIndirectPriorityQueue
i
- the element that has changed.public ShortComparator secondaryComparator()
secondaryComparator
in interface IndirectDoublePriorityQueue<java.lang.Short>
secondaryComparator
in interface ShortIndirectDoublePriorityQueue
secondaryFirst()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |