gnu.math
Class ExponentialFormat

java.lang.Object
  extended by java.text.Format
      extended by gnu.math.ExponentialFormat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ExponentialFormat
extends java.text.Format

Format a real number using a floating-point format. However, if `general' is true, and the number "fits", use a fixed-point format (like printf %g). Used for Common Lisp specs ~E and ~G; also C-style %e and %g.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
Field Summary
 int expDigits
          Number of digits to show in the exponent.
 char exponentChar
           
 boolean exponentShowSign
          Display sign of exponent even when it is non-negative.
 int fracDigits
          Number of fractional digits to show.
 boolean general
           
 int intDigits
          Number of digits to show in the integer part of the result.
 char overflowChar
           
 char padChar
           
 boolean showPlus
          True if '+' should be printed for non-negative number.
 int width
           
 
Constructor Summary
ExponentialFormat()
           
 
Method Summary
 java.lang.StringBuffer format(double value, java.lang.StringBuffer sbuf, java.text.FieldPosition fpos)
           
 java.lang.StringBuffer format(float value, java.lang.StringBuffer sbuf, java.text.FieldPosition fpos)
           
 java.lang.StringBuffer format(long num, java.lang.StringBuffer sbuf, java.text.FieldPosition fpos)
           
 java.lang.StringBuffer format(java.lang.Object num, java.lang.StringBuffer sbuf, java.text.FieldPosition fpos)
           
 java.lang.Number parse(java.lang.String text, java.text.ParsePosition status)
           
 java.lang.Object parseObject(java.lang.String text, java.text.ParsePosition status)
           
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fracDigits

public int fracDigits
Number of fractional digits to show. This is `d' in the CommonLisp spec.


intDigits

public int intDigits
Number of digits to show in the integer part of the result. If positive, The number of digits before the decimal point. If negative, the -intDigits zeros are emitted after the decimal point. This is `k' in the CommonLisp spec.


expDigits

public int expDigits
Number of digits to show in the exponent. Zero means unspecified - show as many as needed.


overflowChar

public char overflowChar

padChar

public char padChar

exponentChar

public char exponentChar

exponentShowSign

public boolean exponentShowSign
Display sign of exponent even when it is non-negative.


showPlus

public boolean showPlus
True if '+' should be printed for non-negative number.


width

public int width

general

public boolean general
Constructor Detail

ExponentialFormat

public ExponentialFormat()
Method Detail

format

public java.lang.StringBuffer format(float value,
                                     java.lang.StringBuffer sbuf,
                                     java.text.FieldPosition fpos)

format

public java.lang.StringBuffer format(double value,
                                     java.lang.StringBuffer sbuf,
                                     java.text.FieldPosition fpos)

format

public java.lang.StringBuffer format(long num,
                                     java.lang.StringBuffer sbuf,
                                     java.text.FieldPosition fpos)

format

public java.lang.StringBuffer format(java.lang.Object num,
                                     java.lang.StringBuffer sbuf,
                                     java.text.FieldPosition fpos)
Specified by:
format in class java.text.Format

parse

public java.lang.Number parse(java.lang.String text,
                              java.text.ParsePosition status)

parseObject

public java.lang.Object parseObject(java.lang.String text,
                                    java.text.ParsePosition status)
Specified by:
parseObject in class java.text.Format