Interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache

  • All Known Implementing Classes:
    TreeOrderedSetCache
    Enclosing class:
    RocksDBCachingPriorityQueueSet<E extends HeapPriorityQueueElement>

    public static interface RocksDBCachingPriorityQueueSet.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.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      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 isEmpty()
      Returns size() == 0.
      boolean isFull()
      Returns size() == maxSize().
      int maxSize()
      Returns the maximum number of elements that can be stored in the cache.
      byte[] peekFirst()
      Returns the first element or null if empty.
      byte[] peekLast()
      Returns the last element or null if empty.
      byte[] pollFirst()
      Returns and removes the first element or returns null if empty.
      byte[] pollLast()
      Returns and removes the last element or returns null if empty.
      boolean remove​(byte[] toRemove)
      Removes the given element, if it is contained.
      int size()
      Returns the number of contained elements.
    • Field Detail

      • LEXICOGRAPHIC_BYTE_COMPARATOR

        static final Comparator<byte[]> LEXICOGRAPHIC_BYTE_COMPARATOR
        Comparator for byte arrays.
    • Method Detail

      • 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.