This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push: new a699c8b Update Hasher javadoc. a699c8b is described below commit a699c8b9ba8e3bdb8bb669f844a3e5b3a150e8b1 Author: aherbert <a.herb...@sussex.ac.uk> AuthorDate: Mon Mar 16 17:14:28 2020 +0000 Update Hasher javadoc. Remove trailing periods from params and returns. Remove the specification in the Hasher.Builder to convert the String to bytes using the UTF-8 charset. This is an implementation detail. It has been moved to the DynamicHasher implementation. Update exception message for getBits to be less specific. The reference to getName() is now obsolete. --- .../bloomfilter/hasher/DynamicHasher.java | 5 +++ .../collections4/bloomfilter/hasher/Hasher.java | 37 +++++++++++----------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java index e36133f..a07e8c8 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/DynamicHasher.java @@ -76,6 +76,11 @@ public class DynamicHasher implements Hasher { return this; } + /** + * {@inheritDoc} + * + * <p>The string is converted to a byte array using the UTF-8 Character set. + */ @Override public final Builder with(final String property) { return with(property.getBytes(StandardCharsets.UTF_8)); diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java index 0ba46aa..7c3e3a5 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Hasher.java @@ -40,7 +40,7 @@ public interface Hasher { /** * Builds the hasher. - * @return the fully constructed hasher. + * @return the fully constructed hasher */ Hasher build(); @@ -48,8 +48,8 @@ public interface Hasher { * Adds a byte to the hasher. * * @param property the byte to add - * @return {@code this} for chaining. - * @throws IllegalStateException if the Hasher is locked. + * @return a reference to this object + * @throws IllegalStateException if the Hasher is locked * @see #getBits(Shape) */ Builder with(byte property); @@ -57,20 +57,19 @@ public interface Hasher { /** * Adds an array of bytes to the hasher. * - * @param property the array of bytes to add. - * @return {@code this} for chaining. - * @throws IllegalStateException if the Hasher is locked. + * @param property the array of bytes to add + * @return a reference to this object + * @throws IllegalStateException if the Hasher is locked * @see #getBits(Shape) */ Builder with(byte[] property); /** - * Adds a string to the hasher. The string is converted to a byte array using - * the UTF-8 Character set. + * Adds a string to the hasher. * - * @param property the string to add. - * @return {@code this} for chaining. - * @throws IllegalStateException if the Hasher is locked. + * @param property the string to add + * @return a reference to this object + * @throws IllegalStateException if the Hasher is locked * @see #getBits(Shape) */ Builder with(String property); @@ -78,27 +77,27 @@ public interface Hasher { /** * Gets an iterator of integers that are the bits to enable in the Bloom - * filter based on the shape. No guarantee is made as to order + * filter based on the shape. No guarantee is made as to order * or duplication of values. * - * @param shape the shape of the desired Bloom filter. - * @return the Iterator of integers; - * @throws IllegalArgumentException if {@code shape.getHasherName()} does not - * equal {@code getName()} + * @param shape the shape of the desired Bloom filter + * @return the iterator of integers + * @throws IllegalArgumentException if the hasher cannot generate indexes for + * the specified @{@code shape} */ PrimitiveIterator.OfInt getBits(Shape shape); /** - * Gets HashFunctionIdentity of the hash function this Hasher uses. + * Gets the identify of the hash function used by the the hasher. * - * @return HashFunctionIdentity of the hash function this Hasher uses. + * @return the identity of the hash function */ HashFunctionIdentity getHashFunctionIdentity(); /** * Returns true if the hasher specifies no bits. * - * @return true if the hasher does not specify any bits. + * @return true if the hasher does not specify any bits */ boolean isEmpty(); }