Skip to content

Commit

Permalink
Omit some unnecessary parens
Browse files Browse the repository at this point in the history
RELNOTES=N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201703715
  • Loading branch information
cushon authored and cgdecker committed Jun 28, 2018
1 parent 0530d7a commit 86eabf1
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static class ContiguousSetHeadsetGenerator extends AbstractContiguousSetG
@Override
protected SortedSet<Integer> create(Integer[] elements) {
SortedSet<Integer> set = nullCheckedTreeSet(elements);
int tooHigh = (set.isEmpty()) ? 0 : set.last() + 1;
int tooHigh = set.isEmpty() ? 0 : set.last() + 1;
set.add(tooHigh);
return checkedCreate(set).headSet(tooHigh);
}
Expand All @@ -365,7 +365,7 @@ public static class ContiguousSetTailsetGenerator extends AbstractContiguousSetG
@Override
protected SortedSet<Integer> create(Integer[] elements) {
SortedSet<Integer> set = nullCheckedTreeSet(elements);
int tooLow = (set.isEmpty()) ? 0 : set.first() - 1;
int tooLow = set.isEmpty() ? 0 : set.first() - 1;
set.add(tooLow);
return checkedCreate(set).tailSet(tooLow + 1);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ protected final ContiguousSet<Integer> checkedCreate(SortedSet<Integer> elements
assertEquals(elements.get(i) + 1, (int) elements.get(i + 1));
}
Range<Integer> range =
(elements.isEmpty()) ? Range.closedOpen(0, 0) : Range.encloseAll(elements);
elements.isEmpty() ? Range.closedOpen(0, 0) : Range.encloseAll(elements);
return ContiguousSet.create(range, DiscreteDomain.integers());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public final void runTearDown() {
}
}
}
if ((!suppressThrows) && (exceptions.size() > 0)) {
if (!suppressThrows && (exceptions.size() > 0)) {
throw ClusterException.create(exceptions);
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/base/CaseFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private String normalizeFirstWord(String word) {
}

private static String firstCharOnlyToUpper(String word) {
return (word.isEmpty())
return word.isEmpty()
? word
: Ascii.toUpperCase(word.charAt(0)) + Ascii.toLowerCase(word.substring(1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void setSuccessor(int entry, int succ) {
}

private void setPredecessor(int entry, int pred) {
long predMask = (~0L) << 32;
long predMask = ~0L << 32;
links[entry] = (links[entry] & ~predMask) | ((long) pred << 32);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ public WeakKeyWeakValueEntry<K, V> castForTesting(InternalEntry<K, V, ?> entry)
@Override
public WeakValueReference<K, V, WeakKeyWeakValueEntry<K, V>> getWeakValueReferenceForTesting(
InternalEntry<K, V, ?> e) {
return (castForTesting(e)).getValueReference();
return castForTesting(e).getValueReference();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C>
}

private ContiguousSet<C> intersectionInCurrentDomain(Range<C> other) {
return (range.isConnected(other))
return range.isConnected(other)
? ContiguousSet.create(range.intersection(other), domain)
: new EmptyContiguousSet<C>(domain);
}
Expand Down
10 changes: 5 additions & 5 deletions android/guava/src/com/google/common/hash/BloomFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ long bitSize() {
*/
public boolean isCompatible(BloomFilter<T> that) {
checkNotNull(that);
return (this != that)
&& (this.numHashFunctions == that.numHashFunctions)
&& (this.bitSize() == that.bitSize())
&& (this.strategy.equals(that.strategy))
&& (this.funnel.equals(that.funnel));
return this != that
&& this.numHashFunctions == that.numHashFunctions
&& this.bitSize() == that.bitSize()
&& this.strategy.equals(that.strategy)
&& this.funnel.equals(that.funnel);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/hash/Hashing.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public LinearCongruentialGenerator(long seed) {

public double nextDouble() {
state = 2862933555777941757L * state + 1;
return ((double) ((int) (state >>> 33) + 1)) / (0x1.0p31);
return ((double) ((int) (state >>> 33) + 1)) / 0x1.0p31;
}
}

Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/math/DoubleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static double bigToDouble(BigInteger x) {
boolean increment =
(twiceSignifFloor & 1) != 0 && ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift);
long signifRounded = increment ? signifFloor + 1 : signifFloor;
long bits = (long) ((exponent + EXPONENT_BIAS)) << SIGNIFICAND_BITS;
long bits = (long) (exponent + EXPONENT_BIAS) << SIGNIFICAND_BITS;
bits += signifRounded;
/*
* If signifRounded == 2^53, we'd need to set all of the significand bits to zero and add 1 to
Expand Down
8 changes: 4 additions & 4 deletions android/guava/src/com/google/common/math/PairedStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public boolean equals(@NullableDecl Object obj) {
return false;
}
PairedStats other = (PairedStats) obj;
return (xStats.equals(other.xStats))
&& (yStats.equals(other.yStats))
&& (doubleToLongBits(sumOfProductsOfDeltas)
== doubleToLongBits(other.sumOfProductsOfDeltas));
return xStats.equals(other.xStats)
&& yStats.equals(other.yStats)
&& doubleToLongBits(sumOfProductsOfDeltas)
== doubleToLongBits(other.sumOfProductsOfDeltas);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static class ContiguousSetHeadsetGenerator extends AbstractContiguousSetG
@Override
protected SortedSet<Integer> create(Integer[] elements) {
SortedSet<Integer> set = nullCheckedTreeSet(elements);
int tooHigh = (set.isEmpty()) ? 0 : set.last() + 1;
int tooHigh = set.isEmpty() ? 0 : set.last() + 1;
set.add(tooHigh);
return checkedCreate(set).headSet(tooHigh);
}
Expand All @@ -365,7 +365,7 @@ public static class ContiguousSetTailsetGenerator extends AbstractContiguousSetG
@Override
protected SortedSet<Integer> create(Integer[] elements) {
SortedSet<Integer> set = nullCheckedTreeSet(elements);
int tooLow = (set.isEmpty()) ? 0 : set.first() - 1;
int tooLow = set.isEmpty() ? 0 : set.first() - 1;
set.add(tooLow);
return checkedCreate(set).tailSet(tooLow + 1);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ protected final ContiguousSet<Integer> checkedCreate(SortedSet<Integer> elements
assertEquals(elements.get(i) + 1, (int) elements.get(i + 1));
}
Range<Integer> range =
(elements.isEmpty()) ? Range.closedOpen(0, 0) : Range.encloseAll(elements);
elements.isEmpty() ? Range.closedOpen(0, 0) : Range.encloseAll(elements);
return ContiguousSet.create(range, DiscreteDomain.integers());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testReplaceAll() {

@ListFeature.Require(SUPPORTS_SET)
public void testReplaceAll_changesSome() {
getList().replaceAll(e -> (e.equals(samples.e0())) ? samples.e3() : e);
getList().replaceAll(e -> e.equals(samples.e0()) ? samples.e3() : e);
E[] expected = createSamplesArray();
for (int i = 0; i < expected.length; i++) {
if (expected[i].equals(samples.e0())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public final void runTearDown() {
}
}
}
if ((!suppressThrows) && (exceptions.size() > 0)) {
if (!suppressThrows && (exceptions.size() > 0)) {
throw ClusterException.create(exceptions);
}
}
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/base/CaseFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private String normalizeFirstWord(String word) {
}

private static String firstCharOnlyToUpper(String word) {
return (word.isEmpty())
return word.isEmpty()
? word
: Ascii.toUpperCase(word.charAt(0)) + Ascii.toLowerCase(word.substring(1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static <T> Spliterator<T> indexed(
IntFunction<T> function,
Comparator<? super T> comparator) {
if (comparator != null) {
checkArgument((extraCharacteristics & (Spliterator.SORTED)) != 0);
checkArgument((extraCharacteristics & Spliterator.SORTED) != 0);
}
class WithCharacteristics implements Spliterator<T> {
private final Spliterator.OfInt delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void setSuccessor(int entry, int succ) {
}

private void setPredecessor(int entry, int pred) {
long predMask = (~0L) << 32;
long predMask = ~0L << 32;
links[entry] = (links[entry] & ~predMask) | ((long) pred << 32);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,7 @@ public WeakKeyWeakValueEntry<K, V> castForTesting(InternalEntry<K, V, ?> entry)
@Override
public WeakValueReference<K, V, WeakKeyWeakValueEntry<K, V>> getWeakValueReferenceForTesting(
InternalEntry<K, V, ?> e) {
return (castForTesting(e)).getValueReference();
return castForTesting(e).getValueReference();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C>
}

private ContiguousSet<C> intersectionInCurrentDomain(Range<C> other) {
return (range.isConnected(other))
return range.isConnected(other)
? ContiguousSet.create(range.intersection(other), domain)
: new EmptyContiguousSet<C>(domain);
}
Expand Down
10 changes: 5 additions & 5 deletions guava/src/com/google/common/hash/BloomFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ long bitSize() {
*/
public boolean isCompatible(BloomFilter<T> that) {
checkNotNull(that);
return (this != that)
&& (this.numHashFunctions == that.numHashFunctions)
&& (this.bitSize() == that.bitSize())
&& (this.strategy.equals(that.strategy))
&& (this.funnel.equals(that.funnel));
return this != that
&& this.numHashFunctions == that.numHashFunctions
&& this.bitSize() == that.bitSize()
&& this.strategy.equals(that.strategy)
&& this.funnel.equals(that.funnel);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/hash/Hashing.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public LinearCongruentialGenerator(long seed) {

public double nextDouble() {
state = 2862933555777941757L * state + 1;
return ((double) ((int) (state >>> 33) + 1)) / (0x1.0p31);
return ((double) ((int) (state >>> 33) + 1)) / 0x1.0p31;
}
}

Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/math/DoubleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static double bigToDouble(BigInteger x) {
boolean increment =
(twiceSignifFloor & 1) != 0 && ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift);
long signifRounded = increment ? signifFloor + 1 : signifFloor;
long bits = (long) ((exponent + EXPONENT_BIAS)) << SIGNIFICAND_BITS;
long bits = (long) (exponent + EXPONENT_BIAS) << SIGNIFICAND_BITS;
bits += signifRounded;
/*
* If signifRounded == 2^53, we'd need to set all of the significand bits to zero and add 1 to
Expand Down
8 changes: 4 additions & 4 deletions guava/src/com/google/common/math/PairedStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public boolean equals(@Nullable Object obj) {
return false;
}
PairedStats other = (PairedStats) obj;
return (xStats.equals(other.xStats))
&& (yStats.equals(other.yStats))
&& (doubleToLongBits(sumOfProductsOfDeltas)
== doubleToLongBits(other.sumOfProductsOfDeltas));
return xStats.equals(other.xStats)
&& yStats.equals(other.yStats)
&& doubleToLongBits(sumOfProductsOfDeltas)
== doubleToLongBits(other.sumOfProductsOfDeltas);
}

/**
Expand Down

0 comments on commit 86eabf1

Please sign in to comment.