Skip to content

Commit

Permalink
Fix whitespace (Checkstyle WhitespaceAround)
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed May 12, 2024
1 parent 765f381 commit f4ecabd
Show file tree
Hide file tree
Showing 61 changed files with 509 additions and 613 deletions.
1 change: 1 addition & 0 deletions src/conf/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ limitations under the License.
<module name="RightCurly"/>
<module name="GenericWhitespace"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="NoWhitespaceBefore"/>
<module name="Indentation">
<!-- Indentation style recommended by Oracle -->
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/apache/commons/collections4/BagUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,8 @@ public static <E> SortedBag<E> unmodifiableSortedBag(final SortedBag<E> bag) {
/**
* Don't allow instances.
*/
private BagUtils() {}
private BagUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ public static <E> Closure<E> whileClosure(final Predicate<? super E> predicate,
/**
* Don't allow instances.
*/
private ClosureUtils() {}
private ClosureUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2151,5 +2151,7 @@ public static <C> Collection<C> unmodifiableCollection(final Collection<? extend
/**
* Don't allow instances.
*/
private CollectionUtils() {}
private CollectionUtils() {
// empty
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public static <I, O> Comparator<I> transformedComparator(Comparator<O> comparato
/**
* Don't allow instances.
*/
private ComparatorUtils() {}
private ComparatorUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public static <T> Factory<T> prototypeFactory(final T prototype) {
/**
* Don't allow instances.
*/
private FactoryUtils() {}
private FactoryUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,8 @@ public static <E> ZippingIterator<E> zippingIterator(final Iterator<? extends E>
/**
* Don't allow instances.
*/
private IteratorUtils() {}
private IteratorUtils() {
// empty
}

}
5 changes: 4 additions & 1 deletion src/main/java/org/apache/commons/collections4/ListUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -744,5 +744,8 @@ public static <E> List<E> unmodifiableList(final List<? extends E> list) {
/**
* Don't allow instances.
*/
private ListUtils() {}
private ListUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ public static <K, V> MultiValuedMap<K, V> unmodifiableMultiValuedMap(
/**
* Don't allow instances.
*/
private MultiMapUtils() {}
private MultiMapUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public static <E> MultiSet<E> unmodifiableMultiSet(final MultiSet<? extends E> m
/**
* Don't allow instances.
*/
private MultiSetUtils() {}
private MultiSetUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public static <T> Predicate<T> notPredicate(final Predicate<? super T> predicate
* @throws NullPointerException if the predicate is null.
* @see NullIsExceptionPredicate
*/
public static <T> Predicate<T> nullIsExceptionPredicate(final Predicate<? super T> predicate){
public static <T> Predicate<T> nullIsExceptionPredicate(final Predicate<? super T> predicate) {
return NullIsExceptionPredicate.nullIsExceptionPredicate(predicate);
}

Expand All @@ -395,7 +395,7 @@ public static <T> Predicate<T> nullIsExceptionPredicate(final Predicate<? super
* @throws NullPointerException if the predicate is null.
* @see NullIsFalsePredicate
*/
public static <T> Predicate<T> nullIsFalsePredicate(final Predicate<? super T> predicate){
public static <T> Predicate<T> nullIsFalsePredicate(final Predicate<? super T> predicate) {
return NullIsFalsePredicate.nullIsFalsePredicate(predicate);
}

Expand All @@ -410,7 +410,7 @@ public static <T> Predicate<T> nullIsFalsePredicate(final Predicate<? super T> p
* @throws NullPointerException if the predicate is null.
* @see NullIsTruePredicate
*/
public static <T> Predicate<T> nullIsTruePredicate(final Predicate<? super T> predicate){
public static <T> Predicate<T> nullIsTruePredicate(final Predicate<? super T> predicate) {
return NullIsTruePredicate.nullIsTruePredicate(predicate);
}

Expand Down Expand Up @@ -486,8 +486,7 @@ public static <T> Predicate<T> orPredicate(final Predicate<? super T> predicate1
* @see TransformedPredicate
* @since 3.1
*/
public static <T> Predicate<T> transformedPredicate(
final Transformer<? super T, ? extends T> transformer, final Predicate<? super T> predicate) {
public static <T> Predicate<T> transformedPredicate(final Transformer<? super T, ? extends T> transformer, final Predicate<? super T> predicate) {
return TransformedPredicate.transformedPredicate(transformer, predicate);
}

Expand Down Expand Up @@ -521,6 +520,8 @@ public static <T> Predicate<T> uniquePredicate() {
/**
* Don't allow instances.
*/
private PredicateUtils() {}
private PredicateUtils() {
// empty
}

}
7 changes: 4 additions & 3 deletions src/main/java/org/apache/commons/collections4/QueueUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ public static <E> Queue<E> synchronizedQueue(final Queue<E> queue) {
* @return a transformed queue backed by the given queue
* @throws NullPointerException if the queue or transformer is null
*/
public static <E> Queue<E> transformingQueue(final Queue<E> queue,
final Transformer<? super E, ? extends E> transformer) {
public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) {
return TransformedQueue.transformingQueue(queue, transformer);
}

Expand All @@ -133,5 +132,7 @@ public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) {
/**
* Don't allow instances.
*/
private QueueUtils() {}
private QueueUtils() {
// empty
}
}
5 changes: 4 additions & 1 deletion src/main/java/org/apache/commons/collections4/SetUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,5 +652,8 @@ public static <E> SortedSet<E> unmodifiableSortedSet(final SortedSet<E> set) {
/**
* Don't allow instances.
*/
private SetUtils() {}
private SetUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ public static <K, V> Map<K, V> writableMap(final Put<K, V> put) {
/**
* Don't allow instances.
*/
private SplitMapUtils() {}
private SplitMapUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ public static <I, O> Transformer<I, O> switchTransformer(final Predicate<? super
/**
* This class is not normally instantiated.
*/
private TransformerUtils() {}
private TransformerUtils() {
// empty
}

}
4 changes: 3 additions & 1 deletion src/main/java/org/apache/commons/collections4/TrieUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public static <K, V> Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie
/**
* Don't allow instances.
*/
private TrieUtils() {}
private TrieUtils() {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1969,13 +1969,13 @@ public void putAll(final Map<? extends K, ? extends V> map) {
* @throws ClassNotFoundException if an object read from the stream can not be loaded
*/
@SuppressWarnings("unchecked") // This will fail at runtime if the stream is incorrect
private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException{
private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
rootNode = new Node[2];
final int size = stream.readInt();
for (int i = 0; i < size; i++){
final K k =(K) stream.readObject();
final V v =(V) stream.readObject();
for (int i = 0; i < size; i++) {
final K k = (K) stream.readObject();
final V v = (V) stream.readObject();
put(k, v);
}
}
Expand Down Expand Up @@ -2224,7 +2224,7 @@ public Set<V> values() {
* @param stream the output stream
* @throws IOException if an error occurs while writing to the stream
*/
private void writeObject(final ObjectOutputStream stream) throws IOException{
private void writeObject(final ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
stream.writeInt(this.size());
for (final Entry<K, V> entry : entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ default int estimateIntersection(final BloomFilter other) {
estimate = Math.round(eThis + eOther - eUnion);
estimate = estimate < 0 ? 0 : estimate;
}
return estimate>Integer.MAX_VALUE?Integer.MAX_VALUE:(int) estimate;
return estimate > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) estimate;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ static int[] ensureCapacityForAdd(final int[] array, final int index) {
return array;
}

// do not instantiate
private IndexUtils() {}
/**
* Don't instantiate.
*/
private IndexUtils() {
// empty
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ public static final class Cleanup {
* A Cleanup that never removes anything.
* @return A Consumer suitable for the LayerManager {@code cleanup} parameter.
*/
public static <T extends BloomFilter> Consumer<Deque<T>> noCleanup() {
return x -> {};
public static <T extends BloomFilter> Consumer<Deque<T>> noCleanup() {
return x -> {
// empty
};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class ComparableComparator<E extends Comparable<? super E>> implements Comparator<E>, Serializable {

/** Serialization version. */
private static final long serialVersionUID=-291439688585137865L;
private static final long serialVersionUID = -291439688585137865L;

/** The singleton instance. */
@SuppressWarnings("rawtypes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public IfTransformer(final Predicate<? super I> predicate,
*
* @return the predicate
*/
public Predicate<? super I> getPredicate(){
public Predicate<? super I> getPredicate() {
return iPredicate;
}

Expand All @@ -133,7 +133,7 @@ public Predicate<? super I> getPredicate(){
*/
@Override
public O transform(final I input) {
if (iPredicate.evaluate(input)){
if (iPredicate.evaluate(input)) {
return iTrueTransformer.transform(input);
}
return iFalseTransformer.transform(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static <E> Closure<E> switchClosure(final Predicate<? super E>[] predicat
throw new IllegalArgumentException("The predicate and closure arrays must be the same size");
}
if (predicates.length == 0) {
return (Closure<E>) (defaultClosure == null ? NOPClosure.<E>nopClosure(): defaultClosure);
return (Closure<E>) (defaultClosure == null ? NOPClosure.<E>nopClosure() : defaultClosure);
}
return new SwitchClosure<>(predicates, closures, defaultClosure);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public E previous() {

@Override
public int previousIndex() {
return nextIndex-1;
return nextIndex - 1;
}

/** Not supported. */
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/apache/commons/collections4/map/LRUMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,8 @@ protected void reuseMapping(final LinkEntry<K, V> entry, final int hashIndex, fi
reuseEntry(entry, hashIndex, hashCode, key, value);
addEntry(entry, hashIndex);
} catch (final NullPointerException ex) {
throw new IllegalStateException(
"NPE, entry=" + entry + " entryIsHeader=" + (entry==header) +
" key=" + key + " value=" + value + " size=" + size + " maxSize=" + maxSize +
" This should not occur if your keys are immutable, and you have used synchronization properly.");
throw new IllegalStateException("NPE, entry=" + entry + " entryIsHeader=" + (entry == header) + " key=" + key + " value=" + value + " size=" + size
+ " maxSize=" + maxSize + " This should not occur if your keys are immutable, and you have used synchronization properly.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,22 +264,22 @@ private Snake getMiddleSnake(final int start1, final int end1, final int start2,
return null;
}

final int delta = m - n;
final int sum = n + m;
final int delta = m - n;
final int sum = n + m;
final int offset = (sum % 2 == 0 ? sum : sum + 1) / 2;
vDown[1+offset] = start1;
vUp[1+offset] = end1 + 1;
vDown[1 + offset] = start1;
vUp[1 + offset] = end1 + 1;

for (int d = 0; d <= offset; ++d) {
// Down
for (int k = -d; k <= d; k += 2) {
// First step

final int i = k + offset;
if (k == -d || k != d && vDown[i-1] < vDown[i+1]) {
vDown[i] = vDown[i+1];
if (k == -d || k != d && vDown[i - 1] < vDown[i + 1]) {
vDown[i] = vDown[i + 1];
} else {
vDown[i] = vDown[i-1] + 1;
vDown[i] = vDown[i - 1] + 1;
}

int x = vDown[i];
Expand All @@ -290,26 +290,24 @@ private Snake getMiddleSnake(final int start1, final int end1, final int start2,
++y;
}
// Second step
if (delta % 2 != 0 && delta - d <= k && k <= delta + d && vUp[i-delta] <= vDown[i]) { // NOPMD
return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
if (delta % 2 != 0 && delta - d <= k && k <= delta + d && vUp[i - delta] <= vDown[i]) { // NOPMD
return buildSnake(vUp[i - delta], k + start1 - start2, end1, end2);
}
}

// Up
for (int k = delta - d; k <= delta + d; k += 2) {
// First step
final int i = k + offset - delta;
if (k == delta - d
|| k != delta + d && vUp[i+1] <= vUp[i-1]) {
vUp[i] = vUp[i+1] - 1;
if (k == delta - d || k != delta + d && vUp[i + 1] <= vUp[i - 1]) {
vUp[i] = vUp[i + 1] - 1;
} else {
vUp[i] = vUp[i-1];
vUp[i] = vUp[i - 1];
}

int x = vUp[i] - 1;
int y = x - start1 + start2 - k;
while (x >= start1 && y >= start2
&& equator.equate(sequence1.get(x), sequence2.get(y))) {
while (x >= start1 && y >= start2 && equator.equate(sequence1.get(x), sequence2.get(y))) {
vUp[i] = x--;
y--;
}
Expand Down
Loading

0 comments on commit f4ecabd

Please sign in to comment.