Class ConvertDouble.DoubleConverter

java.lang.Object
org.jruby.util.ConvertDouble.DoubleConverter
Enclosing class:
ConvertDouble

public static class ConvertDouble.DoubleConverter extends Object
  • Field Details

    • bytes

      private byte[] bytes
    • index

      private int index
    • endIndex

      private int endIndex
    • isStrict

      private boolean isStrict
    • chars

      private char[] chars
    • charsIndex

      private int charsIndex
    • significantDigitsProcessed

      private int significantDigitsProcessed
    • adjustExponent

      private int adjustExponent
    • wroteExponent

      private boolean wroteExponent
    • result

      private double result
    • SIGNIFICANT_DIGITS_LIMIT

      private static final int SIGNIFICANT_DIGITS_LIMIT
      See Also:
    • EXPONENT_DIGITS_LIMIT

      private static final int EXPONENT_DIGITS_LIMIT
      See Also:
    • MAX_EXPONENT

      private static final int MAX_EXPONENT
    • MAX_LENGTH

      private static final int MAX_LENGTH
      See Also:
  • Constructor Details

    • DoubleConverter

      public DoubleConverter()
  • Method Details

    • init

      public void init(ByteList list, boolean isStrict)
    • next

      private byte next()
    • previous

      private boolean previous()
      Shift back to previous character in the incoming bytes
      Returns:
      false to indicate we are not in an EOS condition
    • isEOS

      private boolean isEOS()
    • stopParsing

      private boolean stopParsing()
    • isDigit

      private static boolean isDigit(byte b)
    • isExponent

      private static boolean isExponent(byte b)
    • isWhitespace

      private static boolean isWhitespace(byte b)
    • addToResult

      private void addToResult(byte b)
    • addExponentToResult

      private void addExponentToResult(int exponent)
    • eatUnderscores

      private boolean eatUnderscores()
    • completeCalculation

      private double completeCalculation()
    • strictError

      private boolean strictError()
    • parse

      public double parse(ByteList list, boolean strict, boolean is19)
      Everything runs in 1.9+ mode now, so the `is19` parameter is vestigial. However, in order to maintain binary compatibility with extensions we can't just change the signature either.
    • skipWhitespace

      private boolean skipWhitespace()
      Consume initial whitespace and underscores so that next character examined is not whitespace. 1.9 and strict do not allow leading underscores. Returns whether next position is at the end of the string or not. Trivia: " _ _ _ _ 1".to_f == 1.0 in Ruby 1.8
    • parseOptionalSign

      private boolean parseOptionalSign()
    • parseDigits

      private boolean parseDigits()
    • parseDecimalDigits

      private boolean parseDecimalDigits()
    • parseExponent

      private boolean parseExponent()
    • tooLargeExponent

      private boolean tooLargeExponent(boolean negativeFloat, boolean negativeExponent)
    • verifyOnlyNumbers

      private void verifyOnlyNumbers()
    • verifyNumberAfterUnderscore

      private void verifyNumberAfterUnderscore()