|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.text.Format | +--jas.util.ScientificFormat
This code formats numbers in Scientific Notation. The input Number object is returned as a ScientificFormated string. There are two output styles: Pure and Standard scientific notation. Pure formatted numbers have precisely the number of digits specified by the significant digits (sigDig) parameter and always specify a Base 10 Exponential(E). Standard formated numbers have the number of digits specified by the significant digits (sigDig) parameter but will not have a Base 10 Exponential(E) if the number of digits in the mantissa <= maxWidth.
Constructor Summary | |
ScientificFormat()
|
|
ScientificFormat(int sigDigit,
int maxWidth,
boolean SciNote)
Sets the significant digits, maximum allowable width and number formatting style (SciNote == true for Pure formatting). |
Method Summary | |
java.lang.String |
format(double d)
Format the number using scientific notation |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Implementation of inherited abstract method. |
java.lang.String |
formatError(int eSD,
double d)
Format the number using scientific notation |
int |
getMaxWidth()
Returns the maximum allowable width of formatted number excluding any exponentials |
boolean |
getScientificNotationStyle()
Returns the formatting style: True means Pure scientific formatting, False means standard. |
int |
getSigDigits()
Returns the number of significant digits |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Dummy implementation of inherited abstract method. |
void |
setMaxWidth(int mWidth)
Sets the maximum allowable length of the formattted number mantissa before exponential notation is used. |
void |
setScientificNotationStyle(boolean sciNote)
Sets the format style used. |
void |
setSigDigits(int SigDigit)
Sets the number of significant digits for the formatted number |
Methods inherited from class java.text.Format |
clone, format, parseObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ScientificFormat()
public ScientificFormat(int sigDigit, int maxWidth, boolean SciNote)
Method Detail |
public java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.Format
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
parseObject
in class java.text.Format
public int getSigDigits()
public int getMaxWidth()
public boolean getScientificNotationStyle()
public void setSigDigits(int SigDigit)
public void setMaxWidth(int mWidth)
public void setScientificNotationStyle(boolean sciNote)
public java.lang.String format(double d)
public java.lang.String formatError(int eSD, double d)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |