garydgregory commented on code in PR #492: URL: https://github.com/apache/commons-collections/pull/492#discussion_r1604995635
########## src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java: ########## @@ -229,47 +229,47 @@ default boolean merge(final Hasher hasher) { } /** - * Merges the specified index producer into this Bloom filter. + * Merges the specified index extractor into this Bloom filter. * - * <p>Specifically: all unique cells for the indices identified by the {@code indexProducer} will be incremented by 1.</p> + * <p>Specifically: all unique cells for the indices identified by the {@code indexExtractor} will be incremented by 1.</p> * * <p>This method will return {@code true} if the filter is valid after the operation.</p> * - * <p>Note: If indices that are returned multiple times should be incremented multiple times convert the IndexProducer - * to a CellProducer and add that.</p> + * <p>Note: If indices that are returned multiple times should be incremented multiple times convert the IndexExtractor + * to a CellExtractor and add that.</p> * - * @param indexProducer the IndexProducer + * @param indexExtractor the IndexExtractor * @return {@code true} if the removal was successful and the state is valid * @see #isValid() - * @see #add(CellProducer) + * @see #add(CellExtractor) */ @Override - default boolean merge(final IndexProducer indexProducer) { - Objects.requireNonNull(indexProducer, "indexProducer"); + default boolean merge(final IndexExtractor indexExtractor) { + Objects.requireNonNull(indexExtractor, "indexExtractor"); try { - return add(CellProducer.from(indexProducer.uniqueIndices())); + return add(CellExtractor.from(indexExtractor.uniqueIndices())); } catch (final IndexOutOfBoundsException e) { throw new IllegalArgumentException( Review Comment: This assumes a lot of the implementations. I think it is OK to just Javadoc the `IndexOutOfBoundsException` in the implementation, or, have the implementations convert whatever error condition into an `IllegalArgumentException `. There Javadoc _here_ can state that it is expected that an implementation throws `IllegalArgumentException` and not other exceptions on bad input. ########## src/main/java/org/apache/commons/collections4/bloomfilter/IndexExtractor.java: ########## @@ -31,15 +31,15 @@ * @since 4.5 Review Comment: Note that the since tags should state `4.5.0` but I'll do a pass before the next release, so you don't have to make this PR bigger ;-) ########## src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java: ########## @@ -229,47 +229,47 @@ default boolean merge(final Hasher hasher) { } /** - * Merges the specified index producer into this Bloom filter. + * Merges the specified index extractor into this Bloom filter. * - * <p>Specifically: all unique cells for the indices identified by the {@code indexProducer} will be incremented by 1.</p> + * <p>Specifically: all unique cells for the indices identified by the {@code indexExtractor} will be incremented by 1.</p> * * <p>This method will return {@code true} if the filter is valid after the operation.</p> * - * <p>Note: If indices that are returned multiple times should be incremented multiple times convert the IndexProducer - * to a CellProducer and add that.</p> + * <p>Note: If indices that are returned multiple times should be incremented multiple times convert the IndexExtractor + * to a CellExtractor and add that.</p> * - * @param indexProducer the IndexProducer + * @param indexExtractor the IndexExtractor * @return {@code true} if the removal was successful and the state is valid * @see #isValid() - * @see #add(CellProducer) + * @see #add(CellExtractor) */ @Override - default boolean merge(final IndexProducer indexProducer) { - Objects.requireNonNull(indexProducer, "indexProducer"); + default boolean merge(final IndexExtractor indexExtractor) { + Objects.requireNonNull(indexExtractor, "indexExtractor"); try { - return add(CellProducer.from(indexProducer.uniqueIndices())); + return add(CellExtractor.from(indexExtractor.uniqueIndices())); } catch (final IndexOutOfBoundsException e) { throw new IllegalArgumentException( String.format("Filter only accepts values in the [0,%d) range", getShape().getNumberOfBits()), e); } } /** - * Removes the specified BitMapProducer from this Bloom filter. + * Removes the specified BitMapExtractor from this Bloom filter. * - * <p>Specifically all cells for the indices produced by the {@code bitMapProducer} will be + * <p>Specifically all cells for the indices produced by the {@code bitMapExtractor} will be * decremented by 1.</p> * * <p>This method will return {@code true} if the filter is valid after the operation.</p> * - * @param bitMapProducer the BitMapProducer to provide the indexes + * @param bitMapExtractor the BitMapExtractor to provide the indexes * @return {@code true} if the removal was successful and the state is valid * @see #isValid() - * @see #subtract(CellProducer) + * @see #subtract(CellExtractor) */ - default boolean remove(final BitMapProducer bitMapProducer) { - Objects.requireNonNull(bitMapProducer, "bitMapProducer"); - return remove(IndexProducer.fromBitMapProducer(bitMapProducer)); + default boolean remove(final BitMapExtractor bitMapExtractor) { + Objects.requireNonNull(bitMapExtractor, "bitMapExtractor"); Review Comment: See above comment. ########## src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java: ########## @@ -172,21 +172,21 @@ default int getMaxInsert(final IndexProducer idxProducer) { boolean isValid(); /** - * Merges the specified BitMap producer into this Bloom filter. + * Merges the specified BitMap extractor into this Bloom filter. * - * <p>Specifically: all cells for the indexes identified by the {@code bitMapProducer} will be incremented by 1.</p> + * <p>Specifically: all cells for the indexes identified by the {@code bitMapExtractor} will be incremented by 1.</p> * * <p>This method will return {@code true} if the filter is valid after the operation.</p> * - * @param bitMapProducer the BitMapProducer + * @param bitMapExtractor the BitMapExtractor * @return {@code true} if the removal was successful and the state is valid * @see #isValid() - * @see #add(CellProducer) + * @see #add(CellExtractor) */ @Override - default boolean merge(final BitMapProducer bitMapProducer) { - Objects.requireNonNull(bitMapProducer, "bitMapProducer"); - return merge(IndexProducer.fromBitMapProducer(bitMapProducer)); + default boolean merge(final BitMapExtractor bitMapExtractor) { + Objects.requireNonNull(bitMapExtractor, "bitMapExtractor"); Review Comment: @Claudenw Since `bitMapExtractor` is not dereferenced here, I don't think it makes sense to check for nulls here. Instead, push the check down to implementations. Some implementations may choose to turn the null into a no-op. ########## src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java: ########## @@ -338,23 +338,23 @@ default boolean remove(final IndexProducer indexProducer) { /** - * Adds the specified CellProducer to this Bloom filter. + * Adds the specified CellExtractor to this Bloom filter. * * <p>Specifically * all cells for the indexes identified by the {@code other} will be decremented * by their corresponding values in the {@code other}.</p> * * <p>This method will return true if the filter is valid after the operation.</p> * - * @param other the CellProducer to subtract. + * @param other the CellExtractor to subtract. * @return {@code true} if the subtraction was successful and the state is valid * @see #isValid() - * @see #add(CellProducer) + * @see #add(CellExtractor) */ - boolean subtract(CellProducer other); + boolean subtract(CellExtractor other); @Override - default IndexProducer uniqueIndices() { + default IndexExtractor uniqueIndices() { Review Comment: Shouldn't this method have a Javadoc that covers this implementation as a no-op? ########## src/main/java/org/apache/commons/collections4/bloomfilter/CountingBloomFilter.java: ########## @@ -303,33 +303,33 @@ default boolean remove(final BloomFilter other) { * @param hasher the hasher to provide the indexes * @return {@code true} if the removal was successful and the state is valid * @see #isValid() - * @see #subtract(CellProducer) + * @see #subtract(CellExtractor) */ default boolean remove(final Hasher hasher) { Objects.requireNonNull(hasher, "hasher"); return remove(hasher.indices(getShape())); } /** - * Removes the values from the specified IndexProducer from the Bloom filter from this Bloom filter. + * Removes the values from the specified IndexExtractor from the Bloom filter from this Bloom filter. * * <p>Specifically all cells for the unique indices produced by the {@code hasher} will be * decremented by 1.</p> * * <p>This method will return {@code true} if the filter is valid after the operation.</p> * - * <p>Note: If indices that are returned multiple times should be decremented multiple times convert the IndexProducer - * to a CellProducer and subtract that.</p> + * <p>Note: If indices that are returned multiple times should be decremented multiple times convert the IndexExtractor + * to a CellExtractor and subtract that.</p> * - * @param indexProducer the IndexProducer to provide the indexes + * @param indexExtractor the IndexExtractor to provide the indexes * @return {@code true} if the removal was successful and the state is valid * @see #isValid() - * @see #subtract(CellProducer) + * @see #subtract(CellExtractor) */ - default boolean remove(final IndexProducer indexProducer) { - Objects.requireNonNull(indexProducer, "indexProducer"); + default boolean remove(final IndexExtractor indexExtractor) { + Objects.requireNonNull(indexExtractor, "indexExtractor"); try { - return subtract(CellProducer.from(indexProducer.uniqueIndices())); + return subtract(CellExtractor.from(indexExtractor.uniqueIndices())); Review Comment: See above comment. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org