You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/02/16 20:22:47 UTC
[commons-collections] branch master updated: Formatting.
This is an automated email from the ASF dual-hosted git repository.
ggregory 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 a1ce1c2 Formatting.
a1ce1c2 is described below
commit a1ce1c21212b0bdf6168f8d0ef3824bdb9c7574e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 16 15:22:43 2020 -0500
Formatting.
---
.../bloomfilter/AbstractBloomFilter.java | 12 ++++-----
.../bloomfilter/hasher/DynamicHasher.java | 2 +-
.../bloomfilter/hasher/StaticHasher.java | 30 ++++++++++------------
.../bloomfilter/hasher/function/MD5Cyclic.java | 4 +--
.../hasher/function/Murmur128x86Cyclic.java | 2 +-
.../hasher/function/Murmur32x86Iterative.java | 2 +-
.../hasher/function/ObjectsHashIterative.java | 4 +--
7 files changed, 25 insertions(+), 31 deletions(-)
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java b/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java
index 64a60bd..331afa7 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilter.java
@@ -116,7 +116,7 @@ public abstract class AbstractBloomFilter implements BloomFilter {
*/
@Override
public boolean contains(final Hasher hasher) {
- verifyHasher( hasher );
+ verifyHasher(hasher);
final long[] buff = getBits();
final OfInt iter = hasher.getBits(shape);
@@ -208,9 +208,8 @@ public abstract class AbstractBloomFilter implements BloomFilter {
for (int i = 0; i < limit; i++) {
result[i] = mine[i] | theirs[i];
}
- if (limit<result.length)
- {
- System.arraycopy(remainder, limit, result, limit, result.length-limit);
+ if (limit < result.length) {
+ System.arraycopy(remainder, limit, result, limit, result.length - limit);
}
return BitSet.valueOf(result).cardinality();
}
@@ -277,9 +276,8 @@ public abstract class AbstractBloomFilter implements BloomFilter {
for (int i = 0; i < limit; i++) {
result[i] = mine[i] ^ theirs[i];
}
- if (limit<result.length)
- {
- System.arraycopy(remainder, limit, result, limit, result.length-limit);
+ if (limit < result.length) {
+ System.arraycopy(remainder, limit, result, limit, result.length - limit);
}
return BitSet.valueOf(result).cardinality();
}
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 23590bf..d6caa36 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
@@ -116,7 +116,7 @@ public class DynamicHasher implements Hasher {
buffer++;
}
return (int) Math.floorMod(function.apply(buffers.get(buffer), funcCount++),
- // Cast to long to workaround a bug in animal-sniffer.
+ // Cast to long to workaround a bug in animal-sniffer.
(long) shape.getNumberOfBits());
}
throw new NoSuchElementException();
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java
index f1e5306..cd8bf36 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/StaticHasher.java
@@ -46,13 +46,11 @@ public final class StaticHasher implements Hasher {
* @throws IllegalArgumentException if the hasher function and the shape function are not the same.
*/
public StaticHasher(final Hasher hasher, final Shape shape) {
- this( hasher.getBits(shape), shape);
- if (
- HashFunctionIdentity.COMMON_COMPARATOR.compare(
- hasher.getHashFunctionIdentity(), shape.getHashFunctionIdentity()) != 0) {
+ this(hasher.getBits(shape), shape);
+ if (HashFunctionIdentity.COMMON_COMPARATOR.compare(hasher.getHashFunctionIdentity(),
+ shape.getHashFunctionIdentity()) != 0) {
throw new IllegalArgumentException(String.format("Hasher (%s) is not the same as for shape (%s)",
- HashFunctionIdentity.asCommonString( hasher.getHashFunctionIdentity()),
- shape.toString()));
+ HashFunctionIdentity.asCommonString(hasher.getHashFunctionIdentity()), shape.toString()));
}
}
@@ -65,20 +63,18 @@ public final class StaticHasher implements Hasher {
public StaticHasher(final Iterator<Integer> iter, final Shape shape) {
this.shape = shape;
final Set<Integer> workingValues = new TreeSet<>();
- iter.forEachRemaining( idx -> {
- if (idx >= this.shape.getNumberOfBits())
- {
- throw new IllegalArgumentException( String.format( "Bit index (%s) is too big for %s", idx, shape ));
+ iter.forEachRemaining(idx -> {
+ if (idx >= this.shape.getNumberOfBits()) {
+ throw new IllegalArgumentException(String.format("Bit index (%s) is too big for %s", idx, shape));
}
- if (idx < 0 ) {
- throw new IllegalArgumentException( String.format( "Bit index (%s) may not be less than zero", idx ));
+ if (idx < 0) {
+ throw new IllegalArgumentException(String.format("Bit index (%s) may not be less than zero", idx));
}
- workingValues.add( idx );
+ workingValues.add(idx);
});
this.values = new int[workingValues.size()];
- int i=0;
- for (final Integer value : workingValues)
- {
+ int i = 0;
+ for (final Integer value : workingValues) {
values[i++] = value.intValue();
}
}
@@ -114,7 +110,7 @@ public final class StaticHasher implements Hasher {
throw new IllegalArgumentException(
String.format("shape (%s) does not match internal shape (%s)", shape, this.shape));
}
- return Arrays.stream( values ).iterator();
+ return Arrays.stream(values).iterator();
}
@Override
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java
index 3e07521..e7f785e 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java
@@ -59,9 +59,9 @@ public final class MD5Cyclic implements HashFunction {
try {
messageDigest = MessageDigest.getInstance(NAME);
} catch (final NoSuchAlgorithmException e) {
- throw new IllegalStateException( e.getMessage() );
+ throw new IllegalStateException(e.getMessage());
}
- signature = apply( HashFunctionIdentity.prepareSignatureBuffer(this), 0);
+ signature = apply(HashFunctionIdentity.prepareSignatureBuffer(this), 0);
}
@Override
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86Cyclic.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86Cyclic.java
index 9c9ed74..c599d2b 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86Cyclic.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86Cyclic.java
@@ -49,7 +49,7 @@ public final class Murmur128x86Cyclic implements HashFunction {
* Constructs a Murmur3 x64 128 hash.
*/
public Murmur128x86Cyclic() {
- signature = apply( HashFunctionIdentity.prepareSignatureBuffer(this), 0);
+ signature = apply(HashFunctionIdentity.prepareSignatureBuffer(this), 0);
}
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86Iterative.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86Iterative.java
index c9c2120..f612f8c 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86Iterative.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86Iterative.java
@@ -45,7 +45,7 @@ public final class Murmur32x86Iterative implements HashFunction {
* Constructs a Murmur3 x86 32 hash
*/
public Murmur32x86Iterative() {
- signature = apply( HashFunctionIdentity.prepareSignatureBuffer(this), 0);
+ signature = apply(HashFunctionIdentity.prepareSignatureBuffer(this), 0);
}
@Override
diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterative.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterative.java
index 47ea409..b8c4449 100644
--- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterative.java
+++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterative.java
@@ -53,7 +53,7 @@ public final class ObjectsHashIterative implements HashFunction {
* Constructs a hash that uses the Objects.hash method to has values.
*/
public ObjectsHashIterative() {
- signature = apply( HashFunctionIdentity.prepareSignatureBuffer(this), 0);
+ signature = apply(HashFunctionIdentity.prepareSignatureBuffer(this), 0);
}
@Override
@@ -61,7 +61,7 @@ public final class ObjectsHashIterative implements HashFunction {
if (seed == 0) {
last = 0;
}
- final long result = Arrays.deepHashCode( new Object[] {last, buffer});
+ final long result = Arrays.deepHashCode(new Object[] { last, buffer });
last += result;
return result;
}