ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.util
Class DefaultDoubleFormatterWithError

java.lang.Object
  extended by umontreal.iro.lecuyer.util.DefaultDoubleFormatterWithError
All Implemented Interfaces:
DoubleFormatter, DoubleFormatterWithError

public class DefaultDoubleFormatterWithError
extends Object
implements DoubleFormatterWithError

Default double formatter with error. Uses int, int, double, double, String[]) to format values with 3 significant digits.


Constructor Summary
DefaultDoubleFormatterWithError()
          Constructs a formatter formatting values with 3 significant digits.
DefaultDoubleFormatterWithError(int numDigits)
          Constructs a formatter formatting values with numDigits significant digits.
 
Method Summary
 String format(double x)
          This should be equivalent to format (x, 0).
 String format(double x, double error)
          Formats the value x with error error into a string, and returns the formatted string.
 int getNumDigits()
          Returns the number of significant digits for formatting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDoubleFormatterWithError

public DefaultDoubleFormatterWithError()
Constructs a formatter formatting values with 3 significant digits.


DefaultDoubleFormatterWithError

public DefaultDoubleFormatterWithError(int numDigits)
Constructs a formatter formatting values with numDigits significant digits.

Parameters:
numDigits - the number of significant digits for formatting.
Method Detail

getNumDigits

public int getNumDigits()
Returns the number of significant digits for formatting.

Returns:
the number of significant digits.

format

public String format(double x,
                     double error)
Description copied from interface: DoubleFormatterWithError
Formats the value x with error error into a string, and returns the formatted string. The error can be, e.g., the radius of a confidence interval, or a standard deviation. The given error must be used only to affect how x is formatted; it must be formatted into the returned string.

Specified by:
format in interface DoubleFormatterWithError
Parameters:
x - the value being formatted.
error - the error on the formatted value.
Returns:
the formatted value.

format

public String format(double x)
Description copied from interface: DoubleFormatterWithError
This should be equivalent to format (x, 0).

Specified by:
format in interface DoubleFormatter
Specified by:
format in interface DoubleFormatterWithError
Parameters:
x - the value being formatted.
Returns:
the formatted value.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.