From de05f5f126e39a0e907abbcec68ee2554eece779 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 13 Apr 2024 16:14:55 -0400 Subject: [PATCH] Use long lines --- .../commons/collections4/bloomfilter/Shape.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java b/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java index 86cd9cd07..8a184e7da 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java @@ -111,8 +111,7 @@ public final class Shape { // than integer math. final long k = Math.round(LN_2 * numberOfBits / numberOfItems); if (k < 1) { - throw new IllegalArgumentException( - String.format("Filter too small: Calculated number of hash functions (%s) was less than 1", k)); + throw new IllegalArgumentException(String.format("Filter too small: Calculated number of hash functions (%s) was less than 1", k)); } // Normally we would check that numberOfHashFunctions <= Integer.MAX_VALUE but // since numberOfBits is at most Integer.MAX_VALUE the numerator of @@ -164,8 +163,7 @@ public final class Shape { */ private static int checkNumberOfHashFunctions(final int numberOfHashFunctions) { if (numberOfHashFunctions < 1) { - throw new IllegalArgumentException( - "Number of hash functions must be greater than 0: " + numberOfHashFunctions); + throw new IllegalArgumentException("Number of hash functions must be greater than 0: " + numberOfHashFunctions); } return numberOfHashFunctions; } @@ -329,8 +327,7 @@ public final class Shape { // Number of items (n): // n = ceil(m / (-k / ln(1 - exp(ln(p) / k)))) - final double n = Math.ceil(numberOfBits - / (-numberOfHashFunctions / Math.log(-Math.expm1(Math.log(probability) / numberOfHashFunctions)))); + final double n = Math.ceil(numberOfBits / (-numberOfHashFunctions / Math.log(-Math.expm1(Math.log(probability) / numberOfHashFunctions)))); // log of probability is always < 0 // number of hash functions is >= 1 @@ -377,8 +374,7 @@ public final class Shape { // Shape is final so no check for the same class as inheritance is not possible if (obj instanceof Shape) { final Shape other = (Shape) obj; - return numberOfBits == other.numberOfBits && - numberOfHashFunctions == other.numberOfHashFunctions; + return numberOfBits == other.numberOfBits && numberOfHashFunctions == other.numberOfHashFunctions; } return false; } @@ -462,8 +458,7 @@ public final class Shape { if (numberOfItems == 0) { return 0; } - return Math.pow(-Math.expm1(-1.0 * numberOfHashFunctions * numberOfItems / numberOfBits), - numberOfHashFunctions); + return Math.pow(-Math.expm1(-1.0 * numberOfHashFunctions * numberOfItems / numberOfBits), numberOfHashFunctions); } @Override