Class LayerManager.Cleanup

  • Enclosing class:
    LayerManager<T extends BloomFilter<T>>

    public static final class LayerManager.Cleanup
    extends java.lang.Object
    Static methods to create a Consumer of a List of BloomFilter perform tests on whether to reduce the collection of Bloom filters.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends BloomFilter<T>>
      java.util.function.Consumer<java.util.Deque<T>>
      noCleanup()
      A Cleanup that never removes anything.
      static <T extends BloomFilter<T>>
      java.util.function.Consumer<java.util.Deque<T>>
      onMaxSize​(int maxSize)
      Removes the earliest filters in the list when the the number of filters exceeds maxSize.
      static <T extends BloomFilter<T>>
      java.util.function.Consumer<java.util.Deque<T>>
      removeEmptyTarget()
      Removes the last added target if it is empty.
      static <T extends BloomFilter<T>>
      java.util.function.Consumer<java.util.Deque<T>>
      removeIf​(java.util.function.Predicate<? super T> test)
      Removes any layer identified by the predicate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • noCleanup

        public static <T extends BloomFilter<T>> java.util.function.Consumer<java.util.Deque<T>> noCleanup()
        A Cleanup that never removes anything.
        Type Parameters:
        T - Type of BloomFilter.
        Returns:
        A Consumer suitable for the LayerManager cleanup parameter.
      • onMaxSize

        public static <T extends BloomFilter<T>> java.util.function.Consumer<java.util.Deque<T>> onMaxSize​(int maxSize)
        Removes the earliest filters in the list when the the number of filters exceeds maxSize.
        Type Parameters:
        T - Type of BloomFilter.
        Parameters:
        maxSize - the maximum number of filters for the list. Must be greater than 0
        Returns:
        A Consumer suitable for the LayerManager cleanup parameter.
        Throws:
        java.lang.IllegalArgumentException - if maxSize <= 0.
      • removeEmptyTarget

        public static <T extends BloomFilter<T>> java.util.function.Consumer<java.util.Deque<T>> removeEmptyTarget()
        Removes the last added target if it is empty. Useful as the first in a chain of cleanup consumers. (for example Cleanup.removeEmptyTarget.andThen( otherConsumer ))
        Type Parameters:
        T - Type of BloomFilter.
        Returns:
        A Consumer suitable for the LayerManager cleanup parameter.
      • removeIf

        public static <T extends BloomFilter<T>> java.util.function.Consumer<java.util.Deque<T>> removeIf​(java.util.function.Predicate<? super T> test)
        Removes any layer identified by the predicate.
        Type Parameters:
        T - Type of BloomFilter.
        Parameters:
        test - Predicate.
        Returns:
        A Consumer suitable for the LayerManager cleanup parameter.