Interface ForStDBCachingPriorityQueueSet.OrderedByteArraySetCache
- All Known Implementing Classes:
TreeOrderedSetCache
- Enclosing class:
- ForStDBCachingPriorityQueueSet<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
public static interface ForStDBCachingPriorityQueueSet.OrderedByteArraySetCache
Cache that is organized as an ordered set for byte-arrays. The byte-arrays are sorted in
lexicographic order of their content. Caches typically have a bounded size.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(byte[] toAdd) Adds the given element, if it was not already contained.voidbulkLoadFromOrderedIterator(Iterator<byte[]> orderedIterator) Clears the cache and adds up tomaxSize()elements from the iterator to the cache.booleanisEmpty()Returnssize() == 0.booleanisFull()Returnssize() == maxSize().intmaxSize()Returns the maximum number of elements that can be stored in the cache.byte[]Returns the first element ornullif empty.byte[]peekLast()Returns the last element ornullif empty.byte[]Returns and removes the first element or returnsnullif empty.byte[]pollLast()Returns and removes the last element or returnsnullif empty.booleanremove(byte[] toRemove) Removes the given element, if it is contained.intsize()Returns the number of contained elements.
-
Field Details
-
LEXICOGRAPHIC_BYTE_COMPARATOR
Comparator for byte arrays.
-
-
Method Details
-
size
int size()Returns the number of contained elements. -
maxSize
int maxSize()Returns the maximum number of elements that can be stored in the cache. -
isEmpty
boolean isEmpty()Returnssize() == 0. -
isFull
boolean isFull()Returnssize() == maxSize(). -
add
boolean add(@Nonnull byte[] toAdd) Adds the given element, if it was not already contained. Returnstrueiff the cache was modified. -
remove
boolean remove(@Nonnull byte[] toRemove) Removes the given element, if it is contained. Returnstrueiff the cache was modified. -
peekFirst
@Nullable byte[] peekFirst()Returns the first element ornullif empty. -
peekLast
@Nullable byte[] peekLast()Returns the last element ornullif empty. -
pollFirst
@Nullable byte[] pollFirst()Returns and removes the first element or returnsnullif empty. -
pollLast
@Nullable byte[] pollLast()Returns and removes the last element or returnsnullif empty. -
bulkLoadFromOrderedIterator
Clears the cache and adds up tomaxSize()elements from the iterator to the cache. Iterator must be ordered in the same order as this cache.- Parameters:
orderedIterator- iterator with elements in-order.
-