public class ScientificFormat
extends java.lang.Object
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
Modifier and Type | Field and Description |
---|---|
private int |
dig
the number of digits following the decimal point
|
private static int |
expWidth
the exponent width (including sign, excluding
E ) |
private int |
fieWidth
the field width
|
private static double |
LG_10
the natural logarithm (base e) of 10
|
private double |
num
the number
|
Constructor and Description |
---|
ScientificFormat(double number,
int fieldWidth,
int digits)
constructor
|
Modifier and Type | Method and Description |
---|---|
double |
doubleValue()
gets the
double representation of the Object |
int |
getDigits()
gets the number of digits following the decimal point
|
int |
getFieldWidth()
gets the width of the field (including minus sign, excluding
E ) |
static void |
main(java.lang.String[] args) |
protected java.lang.String |
parseToString()
parses the the Object to a
String |
void |
setDigits(int n)
sets the number of digits following the decimal point
|
void |
setFieldWidth(int n)
sets the width of the field (including minus sign, excluding
E ) |
java.lang.String |
toString()
gets the
String representation of the Object |
private double num
private int fieWidth
private int dig
private static int expWidth
E
)private static double LG_10
public ScientificFormat(double number, int fieldWidth, int digits)
number
- the number to be parsedfieldWidth
- the width of the fielddigits
- the number of digits following the decimal pointpublic void setDigits(int n)
n
- the number of digits following the decimal pointpublic int getDigits()
public void setFieldWidth(int n)
E
)n
- the width of the fieldpublic int getFieldWidth()
E
)public double doubleValue()
double
representation of the Objectdouble
representation of the Objectpublic java.lang.String toString()
String
representation of the ObjecttoString
in class java.lang.Object
String
representation of the Objectprotected java.lang.String parseToString()
String
String
representation of the Objectpublic static void main(java.lang.String[] args)