diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java b/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java index 8ab7e6fc85..baa53ead0e 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/LayerManager.java @@ -121,8 +121,11 @@ public Builder setSupplier(final Supplier supplier) { * tests on whether to reduce the collection of Bloom filters. */ public static final class Cleanup { + /** * A Cleanup that never removes anything. + * + * @param Type of BloomFilter. * @return A Consumer suitable for the LayerManager {@code cleanup} parameter. */ public static Consumer> noCleanup() { @@ -135,6 +138,7 @@ public static Consumer> noCleanup() { * Removes the earliest filters in the list when the the number of filters * exceeds maxSize. * + * @param Type of BloomFilter. * @param maxSize the maximum number of filters for the list. Must be greater * than 0 * @return A Consumer suitable for the LayerManager {@code cleanup} parameter. @@ -155,6 +159,7 @@ public static Consumer> onMaxSize(final int max * Removes the last added target if it is empty. Useful as the first in a chain * of cleanup consumers. (e.g. {@code Cleanup.removeEmptyTarget.andThen( otherConsumer )}) * + * @param Type of BloomFilter. * @return A Consumer suitable for the LayerManager {@code cleanup} parameter. */ public static Consumer> removeEmptyTarget() { @@ -168,6 +173,7 @@ public static Consumer> removeEmptyTarget() { /** * Removes any layer identified by the predicate. * + * @param Type of BloomFilter. * @param test Predicate. * @return A Consumer suitable for the LayerManager {@code cleanup} parameter. */ @@ -188,6 +194,7 @@ public static final class ExtendCheck { * Creates a new target after a specific number of filters have been added to * the current target. * + * @param Type of BloomFilter. * @param breakAt the number of filters to merge into each filter in the list. * @return A Predicate suitable for the LayerManager {@code extendCheck} parameter. * @throws IllegalArgumentException if {@code breakAt <= 0} @@ -212,6 +219,8 @@ public boolean test(final LayerManager filter) { /** * Advances the target once a merge has been performed. + * + * @param Type of BloomFilter. * @return A Predicate suitable for the LayerManager {@code extendCheck} parameter. */ public static Predicate> advanceOnPopulated() { @@ -225,6 +234,7 @@ public static Predicate> advanceOnPopula *

An example usage is advancing on a calculated saturation by calling: * {@code ExtendCheck.advanceOnSaturation(shape.estimateMaxN()) }

* + * @param Type of BloomFilter. * @param maxN the maximum number of estimated items in the filter. * @return A Predicate suitable for the LayerManager {@code extendCheck} parameter. * @throws IllegalArgumentException if {@code maxN <= 0} @@ -242,6 +252,8 @@ public static Predicate> advanceOnSatura /** * Does not automatically advance the target. @{code next()} must be called directly to * perform the advance. + * + * @param Type of BloomFilter. * @return A Predicate suitable for the LayerManager {@code extendCheck} parameter. */ public static Predicate> neverAdvance() { @@ -255,6 +267,7 @@ private ExtendCheck() { * Creates a new Builder with defaults of {@code ExtendCheck.neverAdvance()} and * {@code Cleanup.noCleanup()}. * + * @param Type of BloomFilter. * @return A builder. * @see ExtendCheck#neverAdvance() * @see Cleanup#noCleanup() @@ -262,7 +275,9 @@ private ExtendCheck() { public static Builder builder() { return new Builder<>(); } + private final LinkedList filters = new LinkedList<>(); + private final Consumer> filterCleanup; private final Predicate> extendCheck;