Documentation of 'org.freehep.util.ScientificFormat' Java class
ScientificFormat
org.freehep.util

Class ScientificFormat

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public class ScientificFormat
    extends java.text.Format
    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.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.text.Format

        java.text.Format.Field
    • Constructor Summary

      Constructors 
      Constructor and Description
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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.
      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, formatToCharacterIterator, parseObject
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScientificFormat

        public ScientificFormat()
      • ScientificFormat

        public ScientificFormat(int sigDigit,
                                int maxWidth,
                                boolean SciNote)
        Sets the significant digits, maximum allowable width and number formatting style (SciNote == true for Pure formatting).
    • Method Detail

      • format

        public java.lang.StringBuffer format(java.lang.Object obj,
                                             java.lang.StringBuffer toAppendTo,
                                             java.text.FieldPosition pos)
        Implementation of inherited abstract method. Checks to see if object to be formatted is of type Number. If so casts the Number object to double and calls the format method. Returns the result.
        Specified by:
        format in class java.text.Format
      • parseObject

        public java.lang.Object parseObject(java.lang.String source,
                                            java.text.ParsePosition pos)
        Dummy implementation of inherited abstract method.
        Specified by:
        parseObject in class java.text.Format
      • getSigDigits

        public int getSigDigits()
        Returns the number of significant digits
      • getMaxWidth

        public int getMaxWidth()
        Returns the maximum allowable width of formatted number excluding any exponentials
      • getScientificNotationStyle

        public boolean getScientificNotationStyle()
        Returns the formatting style: True means Pure scientific formatting, False means standard.
      • setSigDigits

        public void setSigDigits(int SigDigit)
        Sets the number of significant digits for the formatted number
      • setMaxWidth

        public void setMaxWidth(int mWidth)
        Sets the maximum allowable length of the formattted number mantissa before exponential notation is used.
      • setScientificNotationStyle

        public void setScientificNotationStyle(boolean sciNote)
        Sets the format style used. 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.
      • format

        public java.lang.String format(double d)
        Format the number using scientific notation

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.