Package org.eclipse.scanning.event.queue
Interface IModifiableIdQueue<E extends IdBean>
- Type Parameters:
E-
- All Superinterfaces:
Collection<E>,Iterable<E>,Queue<E>
- All Known Subinterfaces:
IPersistentModifiableIdQueue<E>
- All Known Implementing Classes:
SynchronizedModifiableIdQueue
A
Queue that provides methods to allow the queue to be modified.
Methods are provided that allow elements to be moved up (closer to the head)
and down (closer to the tail) the queue.
It also identifies elements in the queue by their id, as given by
IdBean.getUniqueId(), i.e. if the queue contains an existing element
with the same id as the element passed into the method as an argument,
that is the element that is affected by the method called.-
Method Summary
Modifier and TypeMethodDescriptionReturn a list of contents of the queue, in the same order as they are in the queue.booleanMoves the element in the queue with the same id as that given down the queue, i.e.booleanMoves the element in the queue with the same id as that given up the queue, i.e.booleanReplaces the existing element in the queue with the same id as the given element with the given element.Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
-
Method Details
-
getElements
Return a list of contents of the queue, in the same order as they are in the queue. Note that the list is a snapshot of the contents of the queue at the time that this method is called, changes to this list will not be reflected in the underlying queue.- Returns:
- a list of the contents of the queue
-
replace
Replaces the existing element in the queue with the same id as the given element with the given element. If the queue does not contain an element with the same id as the one given, the queue is unmodified.- Parameters:
e- the new element- Returns:
trueif the queue was modified as a result of this call (i.e. the queue contained an element with the same id as the that given),falseotherwise
-
moveUp
Moves the element in the queue with the same id as that given up the queue, i.e. towards the head. If the queue does not contain an element with the same id as the one given, the queue is unmodified.- Parameters:
e- the element to move up the queue- Returns:
trueif the queue was modified as a result of this call (i.e. the queue contained an element with the same id as the that given),falseotherwise
-
moveDown
Moves the element in the queue with the same id as that given down the queue, i.e. towards the tail. If the queue does not contain an element with the same id as the one given, the queue is unmodified.- Parameters:
e- the element to move down the queue- Returns:
trueif the queue was modified as a result of this call (i.e. the queue contained an element with the same id as the that given),falseotherwise
-