Package it.unimi.dsi.fastutil.doubles
Class DoublePriorityQueues.SynchronizedPriorityQueue
java.lang.Object
it.unimi.dsi.fastutil.doubles.DoublePriorityQueues.SynchronizedPriorityQueue
- All Implemented Interfaces:
DoublePriorityQueue,PriorityQueue<Double>
- Enclosing class:
- DoublePriorityQueues
public static class DoublePriorityQueues.SynchronizedPriorityQueue extends Object implements DoublePriorityQueue
A synchronized wrapper class for priority queues.
-
Method Summary
Modifier and Type Method Description voidchanged()Notifies the queue that the first element has changed (optional operation).voidclear()Removes all elements from this queue.DoubleComparatorcomparator()Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.Doubledequeue()Deprecated.doubledequeueDouble()Dequeues the first element from the queue.voidenqueue(double x)Enqueues a new element.voidenqueue(Double x)Deprecated.booleanequals(Object o)Doublefirst()Deprecated.doublefirstDouble()Returns the first element of the queue.inthashCode()booleanisEmpty()Checks whether this queue is empty.Doublelast()Deprecated.doublelastDouble()Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).intsize()Returns the number of elements in this queue.
-
Method Details
-
enqueue
public void enqueue(double x)Description copied from interface:DoublePriorityQueueEnqueues a new element.- Specified by:
enqueuein interfaceDoublePriorityQueue- Parameters:
x- the element to enqueue.- See Also:
PriorityQueue.enqueue(Object)
-
dequeueDouble
public double dequeueDouble()Description copied from interface:DoublePriorityQueueDequeues the first element from the queue.- Specified by:
dequeueDoublein interfaceDoublePriorityQueue- Returns:
- the dequeued element.
- See Also:
DoublePriorityQueue.dequeue()
-
firstDouble
public double firstDouble()Description copied from interface:DoublePriorityQueueReturns the first element of the queue.- Specified by:
firstDoublein interfaceDoublePriorityQueue- Returns:
- the first element.
- See Also:
DoublePriorityQueue.first()
-
lastDouble
public double lastDouble()Description copied from interface:DoublePriorityQueueReturns the last element of the queue, that is, the element the would be dequeued last (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
lastDoublein interfaceDoublePriorityQueue- Returns:
- the last element.
- See Also:
DoublePriorityQueue.last()
-
isEmpty
public boolean isEmpty()Description copied from interface:PriorityQueueChecks whether this queue is empty.This default implementation checks whether
PriorityQueue.size()is zero.- Specified by:
isEmptyin interfacePriorityQueue<Double>- Returns:
- true if this queue is empty.
-
size
public int size()Description copied from interface:PriorityQueueReturns the number of elements in this queue.- Specified by:
sizein interfacePriorityQueue<Double>- Returns:
- the number of elements in this queue.
-
clear
public void clear()Description copied from interface:PriorityQueueRemoves all elements from this queue.- Specified by:
clearin interfacePriorityQueue<Double>
-
changed
public void changed()Description copied from interface:PriorityQueueNotifies the queue that the first element has changed (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
changedin interfacePriorityQueue<Double>
-
comparator
Description copied from interface:DoublePriorityQueueReturns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.Note that this specification strengthens the one given in
PriorityQueue.comparator().- Specified by:
comparatorin interfaceDoublePriorityQueue- Specified by:
comparatorin interfacePriorityQueue<Double>- Returns:
- the comparator associated with this priority queue.
- See Also:
PriorityQueue.comparator()
-
enqueue
Deprecated.Description copied from interface:DoublePriorityQueueEnqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueuein interfaceDoublePriorityQueue- Specified by:
enqueuein interfacePriorityQueue<Double>- Parameters:
x- the element to enqueue.
-
dequeue
Deprecated.Description copied from interface:DoublePriorityQueueDequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeuein interfaceDoublePriorityQueue- Specified by:
dequeuein interfacePriorityQueue<Double>- Returns:
- the dequeued element.
-
first
Deprecated.Description copied from interface:DoublePriorityQueueReturns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
firstin interfaceDoublePriorityQueue- Specified by:
firstin interfacePriorityQueue<Double>- Returns:
- the first element.
-
last
Deprecated.Description copied from interface:DoublePriorityQueueReturns the last element of the queue, that is, the element the would be dequeued last (optional operation).This default implementation just throws an
UnsupportedOperationException.This default implementation delegates to the corresponding type-specific method.
- Specified by:
lastin interfaceDoublePriorityQueue- Specified by:
lastin interfacePriorityQueue<Double>- Returns:
- the last element.
-
hashCode
public int hashCode() -
equals
-