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
    Modifier and Type
    Field
    Description
    static final Comparator<byte[]>
    Comparator for byte arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(byte[] toAdd)
    Adds the given element, if it was not already contained.
    void
    bulkLoadFromOrderedIterator(Iterator<byte[]> orderedIterator)
    Clears the cache and adds up to maxSize() elements from the iterator to the cache.
    boolean
    Returns size() == 0.
    boolean
    Returns size() == maxSize().
    int
    Returns the maximum number of elements that can be stored in the cache.
    byte[]
    Returns the first element or null if empty.
    byte[]
    Returns the last element or null if empty.
    byte[]
    Returns and removes the first element or returns null if empty.
    byte[]
    Returns and removes the last element or returns null if empty.
    boolean
    remove(byte[] toRemove)
    Removes the given element, if it is contained.
    int
    Returns the number of contained elements.
  • Field Details

    • LEXICOGRAPHIC_BYTE_COMPARATOR

      static final Comparator<byte[]> 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()
      Returns size() == 0.
    • isFull

      boolean isFull()
      Returns size() == maxSize().
    • add

      boolean add(@Nonnull byte[] toAdd)
      Adds the given element, if it was not already contained. Returns true iff the cache was modified.
    • remove

      boolean remove(@Nonnull byte[] toRemove)
      Removes the given element, if it is contained. Returns true iff the cache was modified.
    • peekFirst

      @Nullable byte[] peekFirst()
      Returns the first element or null if empty.
    • peekLast

      @Nullable byte[] peekLast()
      Returns the last element or null if empty.
    • pollFirst

      @Nullable byte[] pollFirst()
      Returns and removes the first element or returns null if empty.
    • pollLast

      @Nullable byte[] pollLast()
      Returns and removes the last element or returns null if empty.
    • bulkLoadFromOrderedIterator

      void bulkLoadFromOrderedIterator(@Nonnull Iterator<byte[]> orderedIterator)
      Clears the cache and adds up to maxSize() 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.