public class ChangelogKeyGroupedPriorityQueue<T> extends Object implements KeyGroupedInternalPriorityQueue<T>
KeyGroupedInternalPriorityQueue
that keeps state on the underlying delegated KeyGroupedInternalPriorityQueue
as well as on the state change log.Constructor and Description |
---|
ChangelogKeyGroupedPriorityQueue(KeyGroupedInternalPriorityQueue<T> delegatedPriorityQueue) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T toAdd)
Adds the given element to the set, if it is not already contained.
|
void |
addAll(Collection<? extends T> toAdd)
Adds all the given elements to the set.
|
Set<T> |
getSubsetForKeyGroup(int keyGroupId)
Returns the subset of elements in the priority queue that belongs to the given key-group,
within the operator's key-group range.
|
boolean |
isEmpty()
Check if the set contains any elements.
|
CloseableIterator<T> |
iterator()
Iterator over all elements, no order guaranteed.
|
T |
peek()
Retrieves, but does not remove, the element (w.r.t.
|
T |
poll()
Retrieves and removes the first element (w.r.t.
|
boolean |
remove(T toRemove)
Removes the given element from the set, if is contained in the set.
|
int |
size()
Returns the number of elements in this set.
|
public ChangelogKeyGroupedPriorityQueue(KeyGroupedInternalPriorityQueue<T> delegatedPriorityQueue)
public Set<T> getSubsetForKeyGroup(int keyGroupId)
KeyGroupedInternalPriorityQueue
getSubsetForKeyGroup
in interface KeyGroupedInternalPriorityQueue<T>
@Nullable public T poll()
InternalPriorityQueue
null
if this set is empty.poll
in interface InternalPriorityQueue<T>
null
if this set is empty.@Nullable public T peek()
InternalPriorityQueue
null
if this set is empty.peek
in interface InternalPriorityQueue<T>
null
if this set is
empty.public boolean add(T toAdd)
InternalPriorityQueue
add
in interface InternalPriorityQueue<T>
toAdd
- the element to add to the set.true
if the operation changed the head element or if it is unclear if
the head element changed. Only returns false
if the head element was not
changed by this operation.public boolean remove(T toRemove)
InternalPriorityQueue
remove
in interface InternalPriorityQueue<T>
toRemove
- the element to remove.true
if the operation changed the head element or if it is unclear if
the head element changed. Only returns false
if the head element was not
changed by this operation.public boolean isEmpty()
InternalPriorityQueue
isEmpty
in interface InternalPriorityQueue<T>
public int size()
InternalPriorityQueue
size
in interface InternalPriorityQueue<T>
public void addAll(@Nullable Collection<? extends T> toAdd)
InternalPriorityQueue
addAll
in interface InternalPriorityQueue<T>
public CloseableIterator<T> iterator()
InternalPriorityQueue
iterator
in interface InternalPriorityQueue<T>
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.