commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-collections] 17/20: Change minimum number of bits from 8 to 1
Date Sat, 14 Mar 2020 14:22:00 GMT
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

commit 34a5a6f0c50e9075391780f4a9478607f4181d34
Author: Alex Herbert <aherbert@apache.org>
AuthorDate: Sat Mar 14 07:24:59 2020 +0000

    Change minimum number of bits from 8 to 1
---
 .../apache/commons/collections4/bloomfilter/hasher/Shape.java  | 10 +++++-----
 .../commons/collections4/bloomfilter/hasher/ShapeTest.java     | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Shape.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Shape.java
index 1ef8a09..c2a9096 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Shape.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Shape.java
@@ -100,7 +100,7 @@ public final class Shape {
      * @param numberOfHashFunctions The number of hash functions in the filter
      * @throws NullPointerException if the hash function identity is null
      * @throws IllegalArgumentException if the desired probability is not in the range {@code
(0, 1)}
-     * @throws IllegalArgumentException if the number of bits is {@code < 8}
+     * @throws IllegalArgumentException if the number of bits is {@code < 1}
      * @throws IllegalArgumentException if the number of hash functions is {@code < 1}
      * @throws IllegalArgumentException if the actual probability is {@code >= 1.0}
      * @see #getProbability()
@@ -191,7 +191,7 @@ public final class Shape {
      * @param numberOfBits The number of bits in the filter
      * @throws NullPointerException if the hash function identity is null
      * @throws IllegalArgumentException if the number of items is {@code < 1}
-     * @throws IllegalArgumentException if the number of bits is {@code < 8}
+     * @throws IllegalArgumentException if the number of bits is {@code < 1}
      * @throws IllegalArgumentException if the calculated number of hash function is {@code
< 1}
      * @throws IllegalArgumentException if the actual probability is {@code >= 1.0}
      * @see #getProbability()
@@ -220,7 +220,7 @@ public final class Shape {
      * @param numberOfHashFunctions The number of hash functions in the filter
      * @throws NullPointerException if the hash function identity is null
      * @throws IllegalArgumentException if the number of items is {@code < 1}
-     * @throws IllegalArgumentException if the number of bits is {@code < 8}
+     * @throws IllegalArgumentException if the number of bits is {@code < 1}
      * @throws IllegalArgumentException if the number of hash functions is {@code < 1}
      * @throws IllegalArgumentException if the actual probability is {@code >= 1.0}
      * @see #getProbability()
@@ -255,10 +255,10 @@ public final class Shape {
      *
      * @param numberOfBits the number of bits
      * @return the number of bits
-     * @throws IllegalArgumentException if the number of bits is {@code < 8}
+     * @throws IllegalArgumentException if the number of bits is {@code < 1}
      */
     private static int checkNumberOfBits(final int numberOfBits) {
-        if (numberOfBits < 8) {
+        if (numberOfBits < 1) {
             throw new IllegalArgumentException("Number of bits must be greater than or equal
to 8: " + numberOfBits);
         }
         return numberOfBits;
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
index 9cea9de..2a2a038 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/ShapeTest.java
@@ -75,12 +75,12 @@ public class ShapeTest {
     private final Shape shape = new Shape(testFunction, 5, 0.1);
 
     /**
-     * Tests that if the number of bits less than 8 an IllegalArgumentException is thrown.
+     * Tests that if the number of bits less than 1 an IllegalArgumentException is thrown.
      */
     @Test
     public void constructor_items_bits_BadNumberOfBitsTest() {
         try {
-            new Shape(testFunction, 5, 6);
+            new Shape(testFunction, 5, 0);
             fail("Should have thrown IllegalArgumentException");
         } catch (final IllegalArgumentException expected) {
             // expected
@@ -114,12 +114,12 @@ public class ShapeTest {
     }
 
     /**
-     * Tests that if the number of bits is less than 8 an exception is thrown
+     * Tests that if the number of bits is less than 1 an exception is thrown
      */
     @Test
     public void constructor_items_bits_hash_BadNumberOfBitsTest() {
         try {
-            new Shape(testFunction, 5, 6, 1);
+            new Shape(testFunction, 5, 0, 1);
             fail("Should have thrown IllegalArgumentException");
         } catch (final IllegalArgumentException expected) {
             // expected
@@ -319,7 +319,7 @@ public class ShapeTest {
     @Test
     public void constructor_probability_bits_hash__BadNumberOfBitsTest() {
         try {
-            new Shape(testFunction, 0.5, 6, 1);
+            new Shape(testFunction, 0.5, 0, 1);
             fail("Should have thrown IllegalArgumentException");
         } catch (final IllegalArgumentException expected) {
             // expected


Mime
View raw message