|
||||||||||
| 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.bytes.ByteHeapSemiIndirectPriorityQueue
it.unimi.dsi.fastutil.bytes.ByteHeapIndirectPriorityQueue
it.unimi.dsi.fastutil.bytes.ByteHeapIndirectDoublePriorityQueue
A type-specific heap-based indirect double priority queue.
Instances of this class are based on two 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 | |
ByteHeapIndirectDoublePriorityQueue(byte[] refArray)
Creates a new empty queue with capacity equal to the length of the reference array and natural order as primary comparator. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
ByteComparator c)
Creates a new empty queue with capacity equal to the length of the reference array. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
ByteComparator c,
ByteComparator d)
Creates a new empty queue with capacity equal to the length of the reference array. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int capacity)
Creates a new empty queue with a given capacity and natural order as primary comparator. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a)
Wraps a given array in a queue using the natural order. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
ByteComparator c)
Wraps a given array in a queue using a given comparator. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
ByteComparator c,
ByteComparator d)
Wraps a given array in a queue using the given comparators. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
int size)
Wraps a given array in a queue using the natural order. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
int size,
ByteComparator c)
Wraps a given array in a queue using a given comparator. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
int size,
ByteComparator c,
ByteComparator d)
Wraps a given array in a queue using the given comparators. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int capacity,
ByteComparator c)
Creates a new empty queue with a given capacity. |
|
ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int capacity,
ByteComparator c,
ByteComparator 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 |
changed(int index)
Notifies the queue that the specified 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. |
void |
remove(int index)
Removes the specified element from the queue (optional operation). |
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 ByteHeapSemiIndirectPriorityQueue.size() elements. |
| Methods inherited from class it.unimi.dsi.fastutil.bytes.ByteHeapSemiIndirectPriorityQueue |
comparator, first, size, toString |
| Methods inherited from class it.unimi.dsi.fastutil.AbstractIndirectPriorityQueue |
isEmpty, last |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface it.unimi.dsi.fastutil.IndirectPriorityQueue |
comparator, first, isEmpty, last, size |
| Constructor Detail |
public ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int capacity,
ByteComparator c,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int capacity,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
ByteComparator c,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray)
This constructor uses as secondary comparator the opposite of the natural order.
refArray - the reference array.
public ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
int size,
ByteComparator c,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
ByteComparator c,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
int size,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] refArray,
int[] a,
ByteComparator 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 ByteHeapIndirectDoublePriorityQueue(byte[] 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 ByteHeapIndirectDoublePriorityQueue(byte[] 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 IndirectPriorityQueueenqueue in class ByteHeapIndirectPriorityQueuepublic int dequeue()
IndirectPriorityQueue
dequeue in interface IndirectPriorityQueuedequeue in class ByteHeapIndirectPriorityQueuepublic int secondaryFirst()
IndirectDoublePriorityQueue
secondaryFirst in interface IndirectDoublePriorityQueuepublic int secondaryLast()
IndirectDoublePriorityQueue
secondaryLast in interface IndirectDoublePriorityQueuepublic void changed()
IndirectPriorityQueue
changed in interface IndirectPriorityQueuechanged in class ByteHeapIndirectPriorityQueuepublic void changed(int index)
IndirectPriorityQueueNote that the specified element must belong to the queue.
changed in interface IndirectPriorityQueuechanged in class ByteHeapIndirectPriorityQueuepublic void allChanged()
IndirectPriorityQueue
allChanged in interface IndirectPriorityQueueallChanged in class ByteHeapIndirectPriorityQueuepublic void clear()
IndirectPriorityQueue
clear in interface IndirectPriorityQueueclear in class ByteHeapIndirectPriorityQueuepublic void remove(int index)
IndirectPriorityQueueNote that the specified element must belong to the queue.
remove in interface IndirectPriorityQueueremove in class ByteHeapIndirectPriorityQueuepublic void trim()
ByteHeapSemiIndirectPriorityQueue.size() elements.
trim in class ByteHeapSemiIndirectPriorityQueuepublic Comparator secondaryComparator()
secondaryComparator in interface IndirectDoublePriorityQueuesecondaryFirst()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||