Skip to content

Commit

Permalink
Remove unused filterInputString() methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrandelshofer committed Oct 20, 2024
1 parent 74a507f commit 583e836
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,67 +209,6 @@ private boolean isPlusSign(byte c) {
return plusSignChar.containsKey(c);
}


protected CharSequence filterInputString(byte[] str, int startIndex, int endIndex) {
StringBuilder buf = new StringBuilder(endIndex - startIndex);

// Filter leading format characters
// -------------------
int index = skipFormatCharacters(str, startIndex, endIndex);
byte ch = str[index];

// Filter optional sign
// -------------------
final boolean isNegative = isMinusSign(ch);
if (isNegative) buf.append('-');
if (isNegative || isPlusSign(ch)) {
++index;
}

// We do not need to parse NaN or Infinity, this case has already been processed

// Parse significand
for (; index < endIndex; index++) {
ch = str[index];
int digit = digitSet.toDigit(ch);
if (digit < 10) {
buf.append((char) (digit + '0'));
} else if (isDecimalSeparator(ch)) {
buf.append('.');
} else if (!isGroupingSeparator(ch)) {
break;
}

}

// Parse exponent number
// ---------------------
int count = exponentSeparatorTrie.match(str, index, endIndex);
if (count > 0) {
buf.append('e');
index += count;
index = skipFormatCharacters(str, index, endIndex);
ch = charAt(str, index, endIndex);
boolean isExponentNegative = isMinusSign(ch);
if (isExponentNegative) {
buf.append('-');
}
if (isExponentNegative || isPlusSign(ch)) {
++index;
}
ch = str[index];
int digit = digitSet.toDigit(ch);
do {
buf.append((char) (digit + '0'));
ch = charAt(str, ++index, endIndex);
digit = digitSet.toDigit(ch);
} while (digit < 10);
}


return buf;
}

/**
* Skips all format characters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,73 +201,6 @@ public final long parseFloatingPointLiteral(byte[] str, int offset, int length)
exponentOfTruncatedSignificand, expNumber, offset, endIndex);
}


protected CharSequence filterInputString(byte[] str, int startIndex, int endIndex) {
StringBuilder buf = new StringBuilder(endIndex - startIndex);

// Filter leading format characters
// -------------------
int index = skipFormatCharacters(str, startIndex, endIndex);
byte ch = str[index];

// Filter optional sign
// -------------------
int matchCount;
final boolean isNegative = (matchCount = minusSignChar.match(str, index, endIndex)) > 0;
if (isNegative) {
buf.append('-');
index += matchCount;
} else {
index += plusSignChar.match(str, index, endIndex);
}

// We do not need to parse NaN or Infinity, this case has already been processed

// Parse significand
for (; index < endIndex; index++) {
ch = str[index];
int digit = digitSet.toDigit(ch);
if (digit < 10) {
buf.append((char) (digit + '0'));
} else if ((matchCount = decimalSeparator.match(str, index, endIndex)) > 0) {
index += matchCount - 1;
buf.append('.');
} else if ((matchCount = groupingSeparator.match(str, index, endIndex)) > 0) {
index += matchCount - 1;
} else {
break;
}

}

// Parse exponent number
// ---------------------
int count = exponentSeparatorTrie.match(str, index, endIndex);
if (count > 0) {
buf.append('e');
index += count;
index = skipFormatCharacters(str, index, endIndex);
ch = charAt(str, index, endIndex);
boolean isExponentNegative = ((matchCount = minusSignChar.match(str, index, endIndex)) > 0);
if (isExponentNegative) {
buf.append('-');
index += matchCount;
} else {
index += plusSignChar.match(str, index, endIndex);
}
ch = str[index];
int digit = digitSet.toDigit(ch);
do {
buf.append((char) (digit + '0'));
ch = charAt(str, ++index, endIndex);
digit = digitSet.toDigit(ch);
} while (digit < 10);
}


return buf;
}

/**
* Skips all format characters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,67 +210,6 @@ private boolean isPlusSign(char c) {
return plusSignChar.containsKey(c);
}


protected CharSequence filterInputString(char[] str, int startIndex, int endIndex) {
StringBuilder buf = new StringBuilder(endIndex - startIndex);

// Filter leading format characters
// -------------------
int index = skipFormatCharacters(str, startIndex, endIndex);
char ch = str[index];

// Filter optional sign
// -------------------
final boolean isNegative = isMinusSign(ch);
if (isNegative) buf.append('-');
if (isNegative || isPlusSign(ch)) {
++index;
}

// We do not need to parse NaN or Infinity, this case has already been processed

// Parse significand
for (; index < endIndex; index++) {
ch = str[index];
int digit = digitSet.toDigit(ch);
if (digit < 10) {
buf.append((char) (digit + '0'));
} else if (isDecimalSeparator(ch)) {
buf.append('.');
} else if (!isGroupingSeparator(ch)) {
break;
}

}

// Parse exponent number
// ---------------------
int count = exponentSeparatorTrie.match(str, index, endIndex);
if (count > 0) {
buf.append('e');
index += count;
index = skipFormatCharacters(str, index, endIndex);
ch = charAt(str, index, endIndex);
boolean isExponentNegative = isMinusSign(ch);
if (isExponentNegative) {
buf.append('-');
}
if (isExponentNegative || isPlusSign(ch)) {
++index;
}
ch = str[index];
int digit = digitSet.toDigit(ch);
do {
buf.append((char) (digit + '0'));
ch = charAt(str, ++index, endIndex);
digit = digitSet.toDigit(ch);
} while (digit < 10);
}


return buf;
}

/**
* Skips all format characters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,67 +212,6 @@ private boolean isPlusSign(char c) {
return plusSignChar.containsKey(c);
}


protected CharSequence filterInputString(CharSequence str, int startIndex, int endIndex) {
StringBuilder buf = new StringBuilder(endIndex - startIndex);

// Filter leading format characters
// -------------------
int index = skipFormatCharacters(str, startIndex, endIndex);
char ch = str.charAt(index);

// Filter optional sign
// -------------------
final boolean isNegative = isMinusSign(ch);
if (isNegative) buf.append('-');
if (isNegative || isPlusSign(ch)) {
++index;
}

// We do not need to parse NaN or Infinity, this case has already been processed

// Parse significand
for (; index < endIndex; index++) {
ch = str.charAt(index);
int digit = digitSet.toDigit(ch);
if (digit < 10) {
buf.append((char) (digit + '0'));
} else if (isDecimalSeparator(ch)) {
buf.append('.');
} else if (!isGroupingSeparator(ch)) {
break;
}

}

// Parse exponent number
// ---------------------
int count = exponentSeparatorTrie.match(str, index, endIndex);
if (count > 0) {
buf.append('e');
index += count;
index = skipFormatCharacters(str, index, endIndex);
ch = charAt(str, index, endIndex);
boolean isExponentNegative = isMinusSign(ch);
if (isExponentNegative) {
buf.append('-');
}
if (isExponentNegative || isPlusSign(ch)) {
++index;
}
ch = str.charAt(index);
int digit = digitSet.toDigit(ch);
do {
buf.append((char) (digit + '0'));
ch = charAt(str, ++index, endIndex);
digit = digitSet.toDigit(ch);
} while (digit < 10);
}


return buf;
}

/**
* Skips all format characters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ long valueOfFloatLiteral(byte[] str, int integerStartIndex, int integerEndIndex,
double d = FastDoubleMath.tryDecFloatToDoubleTruncated(isSignificandNegative, significand, exponent, isSignificandTruncated,
exponentOfTruncatedSignificand);
return Double.doubleToRawLongBits(Double.isNaN(d) ?
// Double.parseDouble(filterInputString(str, startIndex, endIndex).toString()):
slowPathToDouble(str, integerStartIndex, integerEndIndex, fractionStartIndex, fractionEndIndex, isSignificandNegative, exponentValue) :
d);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ long valueOfFloatLiteral(byte[] str, int integerStartIndex, int integerEndIndex,
double d = FastDoubleMath.tryDecFloatToDoubleTruncated(isSignificandNegative, significand, exponent, isSignificandTruncated,
exponentOfTruncatedSignificand);
return Double.doubleToRawLongBits(Double.isNaN(d) ?
// Double.parseDouble(filterInputString(str, startIndex, endIndex).toString()):
slowPathToDouble(str, integerStartIndex, integerEndIndex, fractionStartIndex, fractionEndIndex, isSignificandNegative, exponentValue) :
d);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ long valueOfFloatLiteral(char[] str, int integerStartIndex, int integerEndIndex,
double d = FastDoubleMath.tryDecFloatToDoubleTruncated(isSignificandNegative, significand, exponent, isSignificandTruncated,
exponentOfTruncatedSignificand);
return Double.doubleToRawLongBits(Double.isNaN(d) ?
// Double.parseDouble(filterInputString(str, startIndex, endIndex).toString()):
slowPathToDouble(str, integerStartIndex, integerEndIndex, fractionStartIndex, fractionEndIndex, isSignificandNegative, exponentValue) :
d);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ long valueOfFloatLiteral(CharSequence str, int integerStartIndex, int integerEnd
double d = FastDoubleMath.tryDecFloatToDoubleTruncated(isSignificandNegative, significand, exponent, isSignificandTruncated,
exponentOfTruncatedSignificand);
return Double.doubleToRawLongBits(Double.isNaN(d) ?
//Double.parseDouble(filterInputString(str, startIndex, endIndex).toString()):
slowPathToDouble(str, integerStartIndex, integerEndIndex, fractionStartIndex, fractionEndIndex, isSignificandNegative, exponentValue) :
d);
}
Expand Down

0 comments on commit 583e836

Please sign in to comment.