No leading underscores in private names.

This commit is contained in:
Gary Gregory 2021-09-01 14:39:35 -04:00
parent 5a580fb9cb
commit 8efbb7df05
6 changed files with 32 additions and 31 deletions

View File

@ -72,8 +72,8 @@ package org.apache.commons.lang3;
*/
public class BitField {
private final int _mask;
private final int _shift_count;
private final int mask;
private final int shiftCount;
/**
* <p>Creates a BitField instance.</p>
@ -83,8 +83,8 @@ public class BitField {
* that this BitField operates on
*/
public BitField(final int mask) {
_mask = mask;
_shift_count = mask == 0 ? 0 : Integer.numberOfTrailingZeros(mask);
this.mask = mask;
this.shiftCount = mask == 0 ? 0 : Integer.numberOfTrailingZeros(mask);
}
/**
@ -102,7 +102,7 @@ public class BitField {
* @return the selected bits, shifted right appropriately
*/
public int getValue(final int holder) {
return getRawValue(holder) >> _shift_count;
return getRawValue(holder) >> shiftCount;
}
/**
@ -131,7 +131,7 @@ public class BitField {
* @return the selected bits
*/
public int getRawValue(final int holder) {
return holder & _mask;
return holder & mask;
}
/**
@ -159,7 +159,7 @@ public class BitField {
* else {@code false}
*/
public boolean isSet(final int holder) {
return (holder & _mask) != 0;
return (holder & mask) != 0;
}
/**
@ -175,7 +175,7 @@ public class BitField {
* else {@code false}
*/
public boolean isAllSet(final int holder) {
return (holder & _mask) == _mask;
return (holder & mask) == mask;
}
/**
@ -189,7 +189,7 @@ public class BitField {
* parameter replacing the old bits
*/
public int setValue(final int holder, final int value) {
return (holder & ~_mask) | ((value << _shift_count) & _mask);
return (holder & ~mask) | ((value << shiftCount) & mask);
}
/**
@ -215,7 +215,7 @@ public class BitField {
* (set to {@code 0})
*/
public int clear(final int holder) {
return holder & ~_mask;
return holder & ~mask;
}
/**
@ -252,7 +252,7 @@ public class BitField {
* to {@code 1}
*/
public int set(final int holder) {
return holder | _mask;
return holder | mask;
}
/**

View File

@ -2502,7 +2502,7 @@ public class StringUtils {
int[] p = new int[n + 1]; // 'previous' cost array, horizontally
int[] d = new int[n + 1]; // cost array, horizontally
int[] _d; // placeholder to assist in swapping p and d
int[] tmp; // placeholder to assist in swapping p and d
// fill in starting table values
final int boundary = Math.min(n, threshold) + 1;
@ -2545,9 +2545,9 @@ public class StringUtils {
}
// copy current distance counts to 'previous row' distance counts
_d = p;
tmp = p;
p = d;
d = _d;
d = tmp;
}
// if p[n] is greater than the threshold, there's no guarantee on it being the correct

View File

@ -32,15 +32,15 @@ final class IDKey {
/**
* Constructor for IDKey
* @param _value The value
* @param value The value
*/
IDKey(final Object _value) {
IDKey(final Object value) {
// This is the Object hash code
id = System.identityHashCode(_value);
this.id = System.identityHashCode(value);
// There have been some cases (LANG-459) that return the
// same identity hash code for different objects. So
// the value is also added to disambiguate these cases.
value = _value;
this.value = value;
}
/**

View File

@ -138,8 +138,8 @@ public class FormattableUtils {
"Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, Integer.valueOf(precision));
final StringBuilder buf = new StringBuilder(seq);
if (precision >= 0 && precision < seq.length()) {
final CharSequence _ellipsis = ObjectUtils.defaultIfNull(ellipsis, StringUtils.EMPTY);
buf.replace(precision - _ellipsis.length(), seq.length(), _ellipsis.toString());
final CharSequence actualEllipsis = ObjectUtils.defaultIfNull(ellipsis, StringUtils.EMPTY);
buf.replace(precision - actualEllipsis.length(), seq.length(), actualEllipsis.toString());
}
final boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY;
for (int i = buf.length(); i < width; i++) {

View File

@ -49,23 +49,23 @@ public class LookupTranslator extends CharSequenceTranslator {
public LookupTranslator(final CharSequence[]... lookup) {
lookupMap = new HashMap<>();
prefixSet = new HashSet<>();
int _shortest = Integer.MAX_VALUE;
int _longest = 0;
int tmpShortest = Integer.MAX_VALUE;
int tmpLongest = 0;
if (lookup != null) {
for (final CharSequence[] seq : lookup) {
this.lookupMap.put(seq[0].toString(), seq[1].toString());
this.prefixSet.add(seq[0].charAt(0));
final int sz = seq[0].length();
if (sz < _shortest) {
_shortest = sz;
if (sz < tmpShortest) {
tmpShortest = sz;
}
if (sz > _longest) {
_longest = sz;
if (sz > tmpLongest) {
tmpLongest = sz;
}
}
}
shortest = _shortest;
longest = _longest;
this.shortest = tmpShortest;
this.longest = tmpLongest;
}
/**

View File

@ -296,9 +296,10 @@ public class MethodUtilsTest {
assertArrayEquals(a.getRight(), b.getRight());
}
static void verify(final ImmutablePair<String, Object[]> a, final Object _b) {
@SuppressWarnings("unchecked") final ImmutablePair<String, Object[]> b = (ImmutablePair<String, Object[]>) _b;
verify(a, b);
static void verify(final ImmutablePair<String, Object[]> a, final Object obj) {
@SuppressWarnings("unchecked")
final ImmutablePair<String, Object[]> pair = (ImmutablePair<String, Object[]>) obj;
verify(a, pair);
}
}