Package ch.randelshofer.fastdoubleparser
Class AbstractConfigurableFloatingPointBitsFromCharSequence
- java.lang.Object
-
- ch.randelshofer.fastdoubleparser.AbstractNumberParser
-
- ch.randelshofer.fastdoubleparser.AbstractFloatValueParser
-
- ch.randelshofer.fastdoubleparser.AbstractConfigurableFloatingPointBitsFromCharSequence
-
- Direct Known Subclasses:
ConfigurableDoubleBitsFromCharSequence
abstract class AbstractConfigurableFloatingPointBitsFromCharSequence extends AbstractFloatValueParser
Configurable floating point parser.
-
-
Field Summary
Fields Modifier and Type Field Description private CharSetdecimalSeparatorprivate CharDigitSetdigitSetprivate CharTrieexponentSeparatorTrieprivate CharSetformatCharprivate CharSetgroupingSeparatorprivate CharTrieinfinityTrieprivate CharSetminusSignCharprivate CharTrienanTrieprivate CharSetplusSignChar-
Fields inherited from class ch.randelshofer.fastdoubleparser.AbstractFloatValueParser
MAX_EXPONENT_NUMBER, MAX_INPUT_LENGTH, MINIMAL_NINETEEN_DIGIT_INTEGER
-
Fields inherited from class ch.randelshofer.fastdoubleparser.AbstractNumberParser
CHAR_TO_HEX_MAP, DECIMAL_POINT_CLASS, ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH, OTHER_CLASS, SYNTAX_ERROR, SYNTAX_ERROR_BITS, VALUE_EXCEEDS_LIMITS
-
-
Constructor Summary
Constructors Constructor Description AbstractConfigurableFloatingPointBitsFromCharSequence(NumberFormatSymbols symbols, boolean ignoreCase)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract longnan()(package private) abstract longnegativeInfinity()longparseFloatingPointLiteral(java.lang.CharSequence str, int offset, int length)Parses aFloatingPointLiteralproduction with optional leading and trailing white space.private longparseNaNOrInfinity(java.lang.CharSequence str, int index, int endIndex, boolean isNegative, boolean isSignificandSigned)(package private) abstract longpositiveInfinity()private intskipFormatCharacters(java.lang.CharSequence str, int index, int endIndex)Skips all format characters.protected doubleslowPathToDouble(java.lang.CharSequence str, int integerStartIndex, int integerEndIndex, int fractionStartIndex, int fractionEndIndex, boolean isSignificandNegative, int exponentValue)(package private) abstract longvalueOfFloatLiteral(java.lang.CharSequence str, int integerStartIndex, int integerEndIndex, int fractionStartIndex, int fractionEndIndex, boolean isSignificandNegative, long significand, int exponent, boolean isSignificandTruncated, int exponentOfTruncatedSignificand, int exponentValue, int startIndex, int endIndex)Computes a float value from the given components of a decimal float literal.-
Methods inherited from class ch.randelshofer.fastdoubleparser.AbstractNumberParser
charAt, charAt, charAt, checkBounds, checkBounds, lookupHex, lookupHex
-
-
-
-
Field Detail
-
digitSet
private final CharDigitSet digitSet
-
minusSignChar
private final CharSet minusSignChar
-
plusSignChar
private final CharSet plusSignChar
-
decimalSeparator
private final CharSet decimalSeparator
-
groupingSeparator
private final CharSet groupingSeparator
-
nanTrie
private final CharTrie nanTrie
-
infinityTrie
private final CharTrie infinityTrie
-
exponentSeparatorTrie
private final CharTrie exponentSeparatorTrie
-
formatChar
private final CharSet formatChar
-
-
Constructor Detail
-
AbstractConfigurableFloatingPointBitsFromCharSequence
public AbstractConfigurableFloatingPointBitsFromCharSequence(NumberFormatSymbols symbols, boolean ignoreCase)
-
-
Method Detail
-
nan
abstract long nan()
- Returns:
- a NaN constant in the specialized type wrapped in a
long
-
negativeInfinity
abstract long negativeInfinity()
- Returns:
- a negative infinity constant in the specialized type wrapped in a
long
-
parseFloatingPointLiteral
public final long parseFloatingPointLiteral(java.lang.CharSequence str, int offset, int length)Parses aFloatingPointLiteralproduction with optional leading and trailing white space.
See- FloatingPointLiteralWithWhiteSpace:
- [WhiteSpace] FloatingPointLiteral [WhiteSpace]
JavaDoubleParserfor the grammar ofFloatingPointLiteral.- Parameters:
str- a string containing aFloatingPointLiteralWithWhiteSpaceoffset- start offset ofFloatingPointLiteralWithWhiteSpaceinstrlength- length ofFloatingPointLiteralWithWhiteSpaceinstr- Returns:
- the bit pattern of the parsed value, if the input is legal;
otherwise,
-1L.
-
skipFormatCharacters
private int skipFormatCharacters(java.lang.CharSequence str, int index, int endIndex)Skips all format characters.- Parameters:
str- a char sequence that contains a stringindex- start index (inclusive) of the stringendIndex- end index (exclusive) of the string- Returns:
- index after the optional format character
-
parseNaNOrInfinity
private long parseNaNOrInfinity(java.lang.CharSequence str, int index, int endIndex, boolean isNegative, boolean isSignificandSigned)
-
positiveInfinity
abstract long positiveInfinity()
- Returns:
- a positive infinity constant in the specialized type wrapped in a
long
-
valueOfFloatLiteral
abstract long valueOfFloatLiteral(java.lang.CharSequence str, int integerStartIndex, int integerEndIndex, int fractionStartIndex, int fractionEndIndex, boolean isSignificandNegative, long significand, int exponent, boolean isSignificandTruncated, int exponentOfTruncatedSignificand, int exponentValue, int startIndex, int endIndex)Computes a float value from the given components of a decimal float literal.- Parameters:
str- the string that contains the float literal (and maybe more)integerStartIndex- the start index (inclusive) of the integer part of the significand inside the stringintegerEndIndex- the end index (exclusive) of the integer part of the significand the stringfractionStartIndex- the start index (inclusive) of the fraction part of the significand inside the stringfractionEndIndex- the end index (exclusive) of the fraction part of the significand the stringisSignificandNegative- whether the significand value is negativesignificand- the significand of the float value (can be truncated)exponent- the exponent of the float value considering the significandisSignificandTruncated- whether the significand is truncatedexponentOfTruncatedSignificand- the exponent value of the truncated significandexponentValue- the exponent value without considering the significandexponentValue- the exponent of the float value without considering the significandstartIndex- the start index of the literal in strendIndex- the end index of the literal in str- Returns:
- the bit pattern of the parsed value, if the input is legal;
otherwise,
-1L.
-
slowPathToDouble
protected double slowPathToDouble(java.lang.CharSequence str, int integerStartIndex, int integerEndIndex, int fractionStartIndex, int fractionEndIndex, boolean isSignificandNegative, int exponentValue)
-
-