|
||||||||||
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.doubles.DoubleHeapSemiIndirectPriorityQueue
it.unimi.dsi.fastutil.doubles.DoubleHeapSesquiIndirectDoublePriorityQueue
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 | |
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray)
Creates a new empty queue with capacity equal to the length of the reference array and natural order as primary comparator. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
DoubleComparator c)
Creates a new empty queue with capacity equal to the length of the reference array. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
DoubleComparator c,
DoubleComparator d)
Creates a new empty queue with capacity equal to the length of the reference array. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int capacity)
Creates a new empty queue with a given capacity and natural order as primary comparator. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int[] a)
Wraps a given array in a queue using the natural order. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int[] a,
DoubleComparator c)
Wraps a given array in a queue using a given comparator. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int[] a,
DoubleComparator c,
DoubleComparator d)
Wraps a given array in a queue using the given comparators. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int[] a,
int size)
Wraps a given array in a queue using the natural order. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int[] a,
int size,
DoubleComparator c)
Wraps a given array in a queue using a given comparator. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int[] a,
int size,
DoubleComparator c,
DoubleComparator d)
Wraps a given array in a queue using the given comparators. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int capacity,
DoubleComparator c)
Creates a new empty queue with a given capacity. |
|
DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray,
int capacity,
DoubleComparator c,
DoubleComparator d)
Creates a new empty queue with a given capacity. |
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 DoubleHeapSemiIndirectPriorityQueue.size() elements. |
Methods inherited from class it.unimi.dsi.fastutil.doubles.DoubleHeapSemiIndirectPriorityQueue |
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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, int capacity, DoubleComparator c, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, int capacity, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, DoubleComparator c, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray)
This constructor uses as secondary comparator the opposite of the natural order.
refArray
- the reference array.public DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, int[] a, int size, DoubleComparator c, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, int[] a, DoubleComparator c, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, int[] a, int size, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] refArray, int[] a, DoubleComparator 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] 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 DoubleHeapSesquiIndirectDoublePriorityQueue(double[] 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 DoubleHeapSemiIndirectPriorityQueue
public int dequeue()
IndirectPriorityQueue
dequeue
in interface IndirectPriorityQueue
dequeue
in class DoubleHeapSemiIndirectPriorityQueue
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 DoubleHeapSemiIndirectPriorityQueue
public void allChanged()
IndirectPriorityQueue
allChanged
in interface IndirectPriorityQueue
allChanged
in class DoubleHeapSemiIndirectPriorityQueue
public void clear()
IndirectPriorityQueue
clear
in interface IndirectPriorityQueue
clear
in class DoubleHeapSemiIndirectPriorityQueue
public void trim()
DoubleHeapSemiIndirectPriorityQueue.size()
elements.
trim
in class DoubleHeapSemiIndirectPriorityQueue
public Comparator secondaryComparator()
secondaryComparator
in interface IndirectDoublePriorityQueue
secondaryFirst()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |