Formatting.

This commit is contained in:
Gary Gregory 2020-02-16 15:22:43 -05:00
parent 7d06bd77e9
commit a1ce1c2121
7 changed files with 25 additions and 31 deletions

View File

@ -208,8 +208,7 @@ public abstract class AbstractBloomFilter implements BloomFilter {
for (int i = 0; i < limit; i++) {
result[i] = mine[i] | theirs[i];
}
if (limit<result.length)
{
if (limit < result.length) {
System.arraycopy(remainder, limit, result, limit, result.length - limit);
}
return BitSet.valueOf(result).cardinality();
@ -277,8 +276,7 @@ public abstract class AbstractBloomFilter implements BloomFilter {
for (int i = 0; i < limit; i++) {
result[i] = mine[i] ^ theirs[i];
}
if (limit<result.length)
{
if (limit < result.length) {
System.arraycopy(remainder, limit, result, limit, result.length - limit);
}
return BitSet.valueOf(result).cardinality();

View File

@ -47,12 +47,10 @@ public final class StaticHasher implements Hasher {
*/
public StaticHasher(final Hasher hasher, final Shape shape) {
this(hasher.getBits(shape), shape);
if (
HashFunctionIdentity.COMMON_COMPARATOR.compare(
hasher.getHashFunctionIdentity(), shape.getHashFunctionIdentity()) != 0) {
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()));
}
}
@ -66,8 +64,7 @@ public final class StaticHasher implements Hasher {
this.shape = shape;
final Set<Integer> workingValues = new TreeSet<>();
iter.forEachRemaining(idx -> {
if (idx >= this.shape.getNumberOfBits())
{
if (idx >= this.shape.getNumberOfBits()) {
throw new IllegalArgumentException(String.format("Bit index (%s) is too big for %s", idx, shape));
}
if (idx < 0) {
@ -77,8 +74,7 @@ public final class StaticHasher implements Hasher {
});
this.values = new int[workingValues.size()];
int i = 0;
for (final Integer value : workingValues)
{
for (final Integer value : workingValues) {
values[i++] = value.intValue();
}
}