All Packages Class Hierarchy This Package Previous Next Index
Class crw.awt.Format
java.lang.Object
|
+----crw.awt.Format
- public class Format
- extends Object
Class to make double-value numbers suitable for display on screen.
Public methods of form formX(double v) are to format an
arbitrary double-value numbers into the form X. For example,
the method formE() turns the number into a scientific format.
- Version:
- 1.0 2-14-1998
- Author:
- C.R.Wie
-
Format()
- Default constructor with 3 significant digits, 1.0 as common
factor, and 0 as exponent.
-
Format(double)
- Constructor sets the common factor.
-
Format(int)
- Constructor sets the number of significant digits.
-
Format(int, double)
- Constructor sets the number of significant digits for the mentissa,
and the common factor to be multiplied to all values which will be
formatted with this Format object.
-
formE(double)
- Returns a String object corresponding to the double value
after formatting.
-
formE(double, int)
- Changes the number of significant digits and does
the same as formE(double).
-
formE(Vector)
- Accepts a vector of Double objects and replaces each element, a
Double object, by the String equivalent of the doule values after
formatting.
-
setSigDigits(int)
- Sets a new number of significant digits.
Format
public Format()
- Default constructor with 3 significant digits, 1.0 as common
factor, and 0 as exponent.
Format
public Format(int sigDigit)
- Constructor sets the number of significant digits.
- Parameters:
- sigDigit - the number of significant digits.
Format
public Format(double common)
- Constructor sets the common factor. The common factor is
multiplied to all double values before formatting.
Format
public Format(int sigDigit,
double common)
- Constructor sets the number of significant digits for the mentissa,
and the common factor to be multiplied to all values which will be
formatted with this Format object.
setSigDigits
public void setSigDigits(int sigDigits)
- Sets a new number of significant digits.
- Parameters:
- sigDigits - the new number of significant digits.
formE
public String formE(double val)
- Returns a String object corresponding to the double value
after formatting.
- Parameters:
- val - the double value to format.
- Returns:
- the String equivalent.
formE
public String formE(double val,
int sigDigits)
- Changes the number of significant digits and does
the same as formE(double).
- Parameters:
- val - the double value to format.
- sigDigits - the new number of sig digits.
- Returns:
- the String equivalent.
formE
public Vector formE(Vector v) throws DataFormatException
- Accepts a vector of Double objects and replaces each element, a
Double object, by the String equivalent of the doule values after
formatting.
- Parameters:
- v - the vector of double object. After this method
- Returns:
- the Vector v containes String objects.
- Throws: DataFormatException
- if object in vector is not an
instance of Double.
All Packages Class Hierarchy This Package Previous Next Index