Documentation of 'com.jstatcom.component.NumberFormatTypes' Java class
NumberFormatTypes
com.jstatcom.component

Class NumberFormatTypes



  • public abstract class NumberFormatTypes
    extends java.lang.Object
    The NumberFormatTypes class contains formatters that are used by JStatCom components to guarantee a consistent formatting behaviour. This class can be extended to provide special number formatters in certain contexts. It contains an enumeration of common formatters.

    The defined operators override getInstance to initialize an instance of the respective number format with a certain behaviour.

    The class implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21). If you compare NumberFormatTypes, always use the == operator. This is save, because they are Singletons (Gamma et al., 1995).

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object o)
      Override prevention method to enforce a.equals(b) if and only if a==b.
      abstract java.text.NumberFormat getInstance()
      Returns an instance of the respective NumberFormat.
      java.lang.String getName()
      Gets the name of this type.
      int hashCode()
      Override prevention method invokes super method.
      java.lang.String toString()
      Gets a string representing this type, do not use for comparisons.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT

        public static final NumberFormatTypes DEFAULT
        The default NumberFormatType to be used for representing doubles. It displays numbers with Locale.ENGLISH, no grouping and a given precision, for example 2.345, 1.000.
      • SCIENTIFIC

        public static final NumberFormatTypes SCIENTIFIC
        The scientific notation NumberFormatType. The applied pattern is "0.###E0. It displays numbers with Locale.ENGLISH, no grouping and a given precision, for example 1.234E-2, 1.000E3.
    • Method Detail

      • equals

        public final boolean equals(java.lang.Object o)
        Override prevention method to enforce a.equals(b) if and only if a==b.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - object to compare with
        Returns:
        true if equal, false otherwise
      • getInstance

        public abstract java.text.NumberFormat getInstance()
        Returns an instance of the respective NumberFormat.
        Returns:
        a number formatter
      • getName

        public final java.lang.String getName()
        Gets the name of this type.
        Returns:
        a descriptive name
      • hashCode

        public final int hashCode()
        Override prevention method invokes super method.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hash code
      • toString

        public final java.lang.String toString()
        Gets a string representing this type, do not use for comparisons.
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.