Top Inners Constructors Methods
org.jruby.util

public Class ConvertDouble

extends Object
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static double
byteListToDouble(ByteList bytes, boolean strict)

Converts supplied ByteList into a double.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConvertDoubleback to summary
public ConvertDouble()

Method Detail

byteListToDoubleback to summary
public static double byteListToDouble(ByteList bytes, boolean strict)

Converts supplied ByteList into a double. strict-mode will not like extra text non-numeric text or multiple sequention underscores.

org.jruby.util back to summary

public Class ConvertDouble.DoubleConverter

extends Object
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private int
private byte[]
private char[]
private int
private int
private static final int
private int
private boolean
private static final int
private static final int
private double
private static final int
private int
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addExponentToResult(int exponent)

private void
addToResult(byte b)

private double
private boolean
public void
init(ByteList list, boolean isStrict)

private static boolean
isDigit(byte b)

private boolean
private static boolean
isExponent(byte b)

private static boolean
isWhitespace(byte b)

private byte
next()

public double
parse(ByteList list, boolean strict, boolean is19)

Everything runs in 1.9+ mode now, so the `is19` parameter is vestigial.

private boolean
private boolean
private boolean
private boolean
private boolean

Returns:

false to indicate we are not in an EOS condition
previous
()

Shift back to previous character in the incoming bytes

private boolean
skipWhitespace()

Consume initial whitespace and underscores so that next character examined is not whitespace.

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

private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

adjustExponentback to summary
private int adjustExponent
bytesback to summary
private byte[] bytes
charsback to summary
private char[] chars
charsIndexback to summary
private int charsIndex
endIndexback to summary
private int endIndex
EXPONENT_DIGITS_LIMITback to summary
private static final int EXPONENT_DIGITS_LIMIT
indexback to summary
private int index
isStrictback to summary
private boolean isStrict
MAX_EXPONENTback to summary
private static final int MAX_EXPONENT
MAX_LENGTHback to summary
private static final int MAX_LENGTH
resultback to summary
private double result
SIGNIFICANT_DIGITS_LIMITback to summary
private static final int SIGNIFICANT_DIGITS_LIMIT
significantDigitsProcessedback to summary
private int significantDigitsProcessed
wroteExponentback to summary
private boolean wroteExponent

Constructor Detail

DoubleConverterback to summary
public DoubleConverter()

Method Detail

addExponentToResultback to summary
private void addExponentToResult(int exponent)
addToResultback to summary
private void addToResult(byte b)
completeCalculationback to summary
private double completeCalculation()
eatUnderscoresback to summary
private boolean eatUnderscores()
initback to summary
public void init(ByteList list, boolean isStrict)
isDigitback to summary
private static boolean isDigit(byte b)
isEOSback to summary
private boolean isEOS()
isExponentback to summary
private static boolean isExponent(byte b)
isWhitespaceback to summary
private static boolean isWhitespace(byte b)
nextback to summary
private byte next()
parseback to summary
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.

parseDecimalDigitsback to summary
private boolean parseDecimalDigits()
parseDigitsback to summary
private boolean parseDigits()
parseExponentback to summary
private boolean parseExponent()
parseOptionalSignback to summary
private boolean parseOptionalSign()
previousback to summary
private boolean previous()

Shift back to previous character in the incoming bytes

Returns:boolean

false to indicate we are not in an EOS condition

skipWhitespaceback to summary
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

stopParsingback to summary
private boolean stopParsing()
strictErrorback to summary
private boolean strictError()
tooLargeExponentback to summary
private boolean tooLargeExponent(boolean negativeFloat, boolean negativeExponent)
verifyNumberAfterUnderscoreback to summary
private void verifyNumberAfterUnderscore()
verifyOnlyNumbersback to summary
private void verifyOnlyNumbers()
org.jruby.util back to summary

pack-priv Class ConvertDouble.DoubleConverter.LightweightNumberFormatException

extends NumberFormatException
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Throwable
fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace.

Constructor Detail

LightweightNumberFormatExceptionback to summary
public LightweightNumberFormatException(String message)

Method Detail

fillInStackTraceback to summary
public Throwable fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Doc from java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace. This method records within this Throwable object information about the current state of the stack frames for the current thread.

If the stack trace of this Throwable is not writable, calling this method has no effect.

Returns:Throwable

a reference to this Throwable instance.

Annotations
@Override