genopt.lang
Class ScientificFormat

java.lang.Object
  extended by genopt.lang.ScientificFormat

public class ScientificFormat
extends java.lang.Object

Object for parsing numbers to scientific format.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, 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.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Field Summary
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 Summary
ScientificFormat(double number, int fieldWidth, int digits)
          constructor
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

num

private double num
the number


fieWidth

private int fieWidth
the field width


dig

private int dig
the number of digits following the decimal point


expWidth

private static int expWidth
the exponent width (including sign, excluding E)


LG_10

private static double LG_10
the natural logarithm (base e) of 10

Constructor Detail

ScientificFormat

public ScientificFormat(double number,
                        int fieldWidth,
                        int digits)
constructor

Parameters:
number - the number to be parsed
fieldWidth - the width of the field
digits - the number of digits following the decimal point
Method Detail

setDigits

public void setDigits(int n)
sets the number of digits following the decimal point

Parameters:
n - the number of digits following the decimal point

getDigits

public int getDigits()
gets the number of digits following the decimal point

Returns:
the number of digits following the decimal point

setFieldWidth

public void setFieldWidth(int n)
sets the width of the field (including minus sign, excluding E)

Parameters:
n - the width of the field

getFieldWidth

public int getFieldWidth()
gets the width of the field (including minus sign, excluding E)

Returns:
the width of the field

doubleValue

public double doubleValue()
gets the double representation of the Object

Returns:
the double representation of the Object

toString

public java.lang.String toString()
gets the String representation of the Object

Overrides:
toString in class java.lang.Object
Returns:
the String representation of the Object

parseToString

protected java.lang.String parseToString()
parses the the Object to a String

Returns:
the String representation of the Object

main

public static void main(java.lang.String[] args)