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 TypeMethodDescriptionvoid
changed()
Notifies the queue that the first element has changed (optional operation).void
clear()
Removes all elements from this queue.Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.dequeue()
Deprecated.double
Dequeues the first element from the queue.void
enqueue
(double x) Enqueues a new element.void
Deprecated.boolean
first()
Deprecated.double
Returns the first element of the queue.int
hashCode()
boolean
isEmpty()
Checks whether this queue is empty.last()
Deprecated.double
Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).int
size()
Returns the number of elements in this queue.
-
Method Details
-
enqueue
public void enqueue(double x) Description copied from interface:DoublePriorityQueue
Enqueues a new element.- Specified by:
enqueue
in interfaceDoublePriorityQueue
- Parameters:
x
- the element to enqueue.- See Also:
-
dequeueDouble
public double dequeueDouble()Description copied from interface:DoublePriorityQueue
Dequeues the first element from the queue.- Specified by:
dequeueDouble
in interfaceDoublePriorityQueue
- Returns:
- the dequeued element.
- See Also:
-
firstDouble
public double firstDouble()Description copied from interface:DoublePriorityQueue
Returns the first element of the queue.- Specified by:
firstDouble
in interfaceDoublePriorityQueue
- Returns:
- the first element.
- See Also:
-
lastDouble
public double lastDouble()Description copied from interface:DoublePriorityQueue
Returns 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:
lastDouble
in interfaceDoublePriorityQueue
- Returns:
- the last element.
- See Also:
-
isEmpty
public boolean isEmpty()Description copied from interface:PriorityQueue
Checks whether this queue is empty.This default implementation checks whether
PriorityQueue.size()
is zero.- Specified by:
isEmpty
in interfacePriorityQueue<Double>
- Returns:
- true if this queue is empty.
-
size
public int size()Description copied from interface:PriorityQueue
Returns the number of elements in this queue.- Specified by:
size
in interfacePriorityQueue<Double>
- Returns:
- the number of elements in this queue.
-
clear
public void clear()Description copied from interface:PriorityQueue
Removes all elements from this queue.- Specified by:
clear
in interfacePriorityQueue<Double>
-
changed
public void changed()Description copied from interface:PriorityQueue
Notifies the queue that the first element has changed (optional operation).This default implementation just throws an
UnsupportedOperationException
.- Specified by:
changed
in interfacePriorityQueue<Double>
-
comparator
Description copied from interface:DoublePriorityQueue
Returns the comparator associated with this priority queue, or null if it uses its elements' natural ordering.- Specified by:
comparator
in interfaceDoublePriorityQueue
- Specified by:
comparator
in interfacePriorityQueue<Double>
- Returns:
- the comparator associated with this priority queue.
- See Also:
-
enqueue
Deprecated.Description copied from interface:DoublePriorityQueue
Enqueues a new element.This default implementation delegates to the corresponding type-specific method.
- Specified by:
enqueue
in interfaceDoublePriorityQueue
- Specified by:
enqueue
in interfacePriorityQueue<Double>
- Parameters:
x
- the element to enqueue.
-
dequeue
Deprecated.Description copied from interface:DoublePriorityQueue
Dequeues the first element from the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
dequeue
in interfaceDoublePriorityQueue
- Specified by:
dequeue
in interfacePriorityQueue<Double>
- Returns:
- the dequeued element.
-
first
Deprecated.Description copied from interface:DoublePriorityQueue
Returns the first element of the queue.This default implementation delegates to the corresponding type-specific method.
- Specified by:
first
in interfaceDoublePriorityQueue
- Specified by:
first
in interfacePriorityQueue<Double>
- Returns:
- the first element.
-
last
Deprecated.Description copied from interface:DoublePriorityQueue
Returns 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:
last
in interfaceDoublePriorityQueue
- Specified by:
last
in interfacePriorityQueue<Double>
- Returns:
- the last element.
-
hashCode
public int hashCode() -
equals
-