sbrt.shell.text
Class DoubleFormatV2

java.lang.Object
  extended by sbrt.shell.text.DoubleFormatV2
All Implemented Interfaces:
DoubleFormat, Format, Formatter<java.lang.Double>, Parser<java.lang.Double>, SimpleFormat<java.lang.Double>

public class DoubleFormatV2
extends java.lang.Object
implements DoubleFormat

This class is a concrete implementation of DoubleFormat. Double values used by this class cannot be infinite or NaN.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
DoubleFormatV2()
          Constructs a new double format for finite numbers.
 
Method Summary
 java.lang.String format(double d)
          Parses the provided string and returns its corresponding double precision number.
 java.lang.String format(java.lang.Double d)
          Returns a formatted string representation of the provided double precision number.
 java.lang.Double parse(java.lang.String d)
          Parses the provided string and returns its corresponding double precision number.
 double parsePrimitive(java.lang.String d)
          Parses the provided string and returns its corresponding double precision number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleFormatV2

public DoubleFormatV2()
Constructs a new double format for finite numbers.

Method Detail

format

public java.lang.String format(java.lang.Double d)
Returns a formatted string representation of the provided double precision number. See Double.toString() for the exact formatting rules.

Specified by:
format in interface DoubleFormat
Specified by:
format in interface Formatter<java.lang.Double>
Parameters:
d - the double precision number to be formatted.
Returns:
a formatted string representation of the provided double precision number.

format

public java.lang.String format(double d)
Parses the provided string and returns its corresponding double precision number. See Double.valueOf(String) for the exact formatting rules.

Specified by:
format in interface DoubleFormat
Parameters:
d - the string to be parsed.
Returns:
the double precision number corresponding to the provided string.
Throws:
FormatException - if the provided string is not parsable as a double precision number.
java.lang.NullPointerException - if the provided argument is null.

parse

public java.lang.Double parse(java.lang.String d)
Parses the provided string and returns its corresponding double precision number. See Double.valueOf(String) for the exact formatting rules.

Specified by:
parse in interface DoubleFormat
Specified by:
parse in interface Parser<java.lang.Double>
Parameters:
d - the string to be parsed.
Returns:
the double precision number corresponding to the provided string.
Throws:
FormatException - if the provided string is not parsable as a double precision number.
java.lang.NullPointerException - if the provided argument is null.

parsePrimitive

public double parsePrimitive(java.lang.String d)
Parses the provided string and returns its corresponding double precision number. See Double.valueOf(String) for the exact formatting rules.

Specified by:
parsePrimitive in interface DoubleFormat
Parameters:
d - the string to be parsed.
Returns:
the double precision number corresponding to the provided string.
Throws:
FormatException - if the provided string is not parsable as a double precision number.
java.lang.NullPointerException - if the provided argument is null.