edu.davidson.chm.dataformat
Class DataFormat

java.lang.Object
  extended by edu.davidson.chm.dataformat.DataFormat

public class DataFormat
extends java.lang.Object

This class performs conversions between strings and numbers.

Version:
2.0
Author:
David N. Blauch

Field Summary
static double LN10
           
 
Constructor Summary
DataFormat()
           
 
Method Summary
static java.lang.String formatDec(double x, int nLength, int nDecimal)
          Returns a string representing a double precision number (x).
static java.lang.String formatSci(double x, int nLength, int nDecimal)
          Returns a string representing a double precision number (x).
static boolean isValid(java.lang.String nbr)
          Evaluates a string to see if it represents a valid number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LN10

public static double LN10
Constructor Detail

DataFormat

public DataFormat()
Method Detail

formatDec

public static java.lang.String formatDec(double x,
                                         int nLength,
                                         int nDecimal)
Returns a string representing a double precision number (x). The string uses a fixed decimal point format. When necessary spaces are added to the beginning of the string to obtain the necessary length.

Parameters:
x - number
nLength - total length of returned string
nDecimal - number of digits to the right of the decimal point

formatSci

public static java.lang.String formatSci(double x,
                                         int nLength,
                                         int nDecimal)
Returns a string representing a double precision number (x). The string uses a scientific notation. The total length of the string must include four additional digits for the E+## notation.

Parameters:
x - number
nLength - total length of returned string
nDecimal - number of digits to the right of the decimal point

isValid

public static boolean isValid(java.lang.String nbr)
Evaluates a string to see if it represents a valid number