com.jstatcom.component
Class NumberFormatTypes
- java.lang.Object
-
- com.jstatcom.component.NumberFormatTypes
-
public abstract class NumberFormatTypes extends java.lang.ObjectTheNumberFormatTypesclass 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
The class implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21). If you comparegetInstanceto initialize an instance of the respective number format with a certain behaviour.NumberFormatTypes, always use the==operator. This is save, because they are Singletons (Gamma et al., 1995).
-
-
Field Summary
Fields Modifier and Type Field and Description static NumberFormatTypesDEFAULTThe defaultNumberFormatTypeto be used for representing doubles.static NumberFormatTypesSCIENTIFICThe scientific notationNumberFormatType.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object o)Override prevention method to enforcea.equals(b)if and onlyif a==b.abstract java.text.NumberFormatgetInstance()Returns an instance of the respective NumberFormat.java.lang.StringgetName()Gets the name of this type.inthashCode()Override prevention method invokes super method.java.lang.StringtoString()Gets a string representing this type, do not use for comparisons.
-
-
-
Field Detail
-
DEFAULT
public static final NumberFormatTypes DEFAULT
The defaultNumberFormatTypeto be used for representing doubles. It displays numbers withLocale.ENGLISH, no grouping and a given precision, for example2.345, 1.000.
-
SCIENTIFIC
public static final NumberFormatTypes SCIENTIFIC
The scientific notationNumberFormatType. The applied pattern is"0.###E0. It displays numbers withLocale.ENGLISH, no grouping and a given precision, for example1.234E-2, 1.000E3.
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object o)
Override prevention method to enforcea.equals(b)if and onlyif a==b.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- object to compare with- Returns:
trueif equal,falseotherwise
-
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:
hashCodein classjava.lang.Object- Returns:
- hash code
-
toString
public final java.lang.String toString()
Gets a string representing this type, do not use for comparisons.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation
-
-
DMelt 3.0 © DataMelt by jWork.ORG