Class AbstractConfigurableFloatingPointBitsFromByteArrayUtf8

java.lang.Object
ch.randelshofer.fastdoubleparser.AbstractNumberParser
ch.randelshofer.fastdoubleparser.AbstractFloatValueParser
ch.randelshofer.fastdoubleparser.AbstractConfigurableFloatingPointBitsFromByteArrayUtf8
Direct Known Subclasses:
ConfigurableDoubleBitsFromByteArrayUtf8

abstract class AbstractConfigurableFloatingPointBitsFromByteArrayUtf8 extends AbstractFloatValueParser
Configurable floating point parser for input data given in UTF-8.
  • Field Details

    • digitSet

      private final ByteDigitSet digitSet
    • minusSign

      private final ByteTrie minusSign
    • plusSign

      private final ByteTrie plusSign
    • decimalSeparator

      private final ByteTrie decimalSeparator
    • groupingSeparator

      private final ByteTrie groupingSeparator
    • nan

      private final ByteTrie nan
    • infinity

      private final ByteTrie infinity
    • exponentSeparator

      private final ByteTrie exponentSeparator
  • Constructor Details

    • AbstractConfigurableFloatingPointBitsFromByteArrayUtf8

      public AbstractConfigurableFloatingPointBitsFromByteArrayUtf8(NumberFormatSymbols symbols, boolean ignoreCase)
  • Method Details

    • 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(byte[] str, int offset, int length)
      Parses a FloatingPointLiteral production with optional leading and trailing white space.
      FloatingPointLiteralWithWhiteSpace:
      [WhiteSpace] FloatingPointLiteral [WhiteSpace]
      See JavaDoubleParser for the grammar of FloatingPointLiteral.
      Parameters:
      str - a string containing a FloatingPointLiteralWithWhiteSpace
      offset - start offset of FloatingPointLiteralWithWhiteSpace in str
      length - length of FloatingPointLiteralWithWhiteSpace in str
      Returns:
      the bit pattern of the parsed value, if the input is legal; otherwise, -1L.
    • parseNaNOrInfinity

      private long parseNaNOrInfinity(byte[] 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(byte[] 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 string
      integerEndIndex - the end index (exclusive) of the integer part of the significand the string
      fractionStartIndex - the start index (inclusive) of the fraction part of the significand inside the string
      fractionEndIndex - the end index (exclusive) of the fraction part of the significand the string
      isSignificandNegative - whether the significand value is negative
      significand - the significand of the float value (can be truncated)
      exponent - the exponent of the float value considering the significand
      isSignificandTruncated - whether the significand is truncated
      exponentOfTruncatedSignificand - the exponent value of the truncated significand
      exponentValue - the exponent of the float value without considering the significand
      startIndex - the start index of the literal in str
      endIndex - 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(byte[] str, int integerStartIndex, int integerEndIndex, int fractionStartIndex, int fractionEndIndex, boolean isSignificandNegative, int exponentValue)