Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jun 15, 2024
1 parent 08f7ffa commit c1e02af
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ public Builder<T> setSupplier(final Supplier<T> supplier) {
* tests on whether to reduce the collection of Bloom filters.
*/
public static final class Cleanup {

/**
* A Cleanup that never removes anything.
*
* @param <T> Type of BloomFilter.
* @return A Consumer suitable for the LayerManager {@code cleanup} parameter.
*/
public static <T extends BloomFilter> Consumer<Deque<T>> noCleanup() {
Expand All @@ -135,6 +138,7 @@ public static <T extends BloomFilter> Consumer<Deque<T>> noCleanup() {
* Removes the earliest filters in the list when the the number of filters
* exceeds maxSize.
*
* @param <T> 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.
Expand All @@ -155,6 +159,7 @@ public static <T extends BloomFilter> Consumer<Deque<T>> 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 <T> Type of BloomFilter.
* @return A Consumer suitable for the LayerManager {@code cleanup} parameter.
*/
public static <T extends BloomFilter> Consumer<Deque<T>> removeEmptyTarget() {
Expand All @@ -168,6 +173,7 @@ public static <T extends BloomFilter> Consumer<Deque<T>> removeEmptyTarget() {
/**
* Removes any layer identified by the predicate.
*
* @param <T> Type of BloomFilter.
* @param test Predicate.
* @return A Consumer suitable for the LayerManager {@code cleanup} parameter.
*/
Expand All @@ -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 <T> 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}
Expand All @@ -212,6 +219,8 @@ public boolean test(final LayerManager<T> filter) {

/**
* Advances the target once a merge has been performed.
*
* @param <T> Type of BloomFilter.
* @return A Predicate suitable for the LayerManager {@code extendCheck} parameter.
*/
public static <T extends BloomFilter> Predicate<LayerManager<T>> advanceOnPopulated() {
Expand All @@ -225,6 +234,7 @@ public static <T extends BloomFilter> Predicate<LayerManager<T>> advanceOnPopula
* <p>An example usage is advancing on a calculated saturation by calling:
* {@code ExtendCheck.advanceOnSaturation(shape.estimateMaxN()) }</p>
*
* @param <T> 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}
Expand All @@ -242,6 +252,8 @@ public static <T extends BloomFilter> Predicate<LayerManager<T>> advanceOnSatura
/**
* Does not automatically advance the target. @{code next()} must be called directly to
* perform the advance.
*
* @param <T> Type of BloomFilter.
* @return A Predicate suitable for the LayerManager {@code extendCheck} parameter.
*/
public static <T extends BloomFilter> Predicate<LayerManager<T>> neverAdvance() {
Expand All @@ -255,14 +267,17 @@ private ExtendCheck() {
* Creates a new Builder with defaults of {@code ExtendCheck.neverAdvance()} and
* {@code Cleanup.noCleanup()}.
*
* @param <T> Type of BloomFilter.
* @return A builder.
* @see ExtendCheck#neverAdvance()
* @see Cleanup#noCleanup()
*/
public static <T extends BloomFilter> Builder<T> builder() {
return new Builder<>();
}

private final LinkedList<T> filters = new LinkedList<>();

private final Consumer<Deque<T>> filterCleanup;

private final Predicate<LayerManager<T>> extendCheck;
Expand Down

0 comments on commit c1e02af

Please sign in to comment.