aicas logo Jamaica 3.4 release 8

java.text
Class DecimalFormat

java.lang.Object
  extended by java.text.Format
      extended by java.text.NumberFormat
          extended by java.text.DecimalFormat
All Implemented Interfaces:
Serializable, Cloneable

public class DecimalFormat
extends NumberFormat

See Also:
Serialized Form
Date:
March 4, 1999

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.NumberFormat
NumberFormat.Field
 
Field Summary
 
Fields inherited from class java.text.NumberFormat
FRACTION_FIELD, INTEGER_FIELD
 
Constructor Summary
DecimalFormat()
          Constructs a DecimalFormat which uses the default pattern and symbols.
DecimalFormat(String pattern)
          Constructs a DecimalFormat which uses the given pattern and the default symbols for formatting and parsing.
DecimalFormat(String pattern, DecimalFormatSymbols symbols)
          Constructs a DecimalFormat using the given pattern and formatting symbols.
 
Method Summary
 void applyLocalizedPattern(String pattern)
           
 void applyPattern(String pattern)
           
 Object clone()
          Creates a copy of this object.
 boolean equals(Object obj)
          Tests this instance for equality with an arbitrary object.
 StringBuffer format(double number, StringBuffer dest, FieldPosition fieldPos)
          This method formats the specified double and appends it to a StringBuffer.
 StringBuffer format(long number, StringBuffer dest, FieldPosition fieldPos)
          This method formats the specified long and appends it to a StringBuffer.
 AttributedCharacterIterator formatToCharacterIterator(Object value)
           
 Currency getCurrency()
          Returns the currency corresponding to the currency symbol stored in the instance of DecimalFormatSymbols used by this DecimalFormat.
 DecimalFormatSymbols getDecimalFormatSymbols()
          Returns a copy of the symbols used by this instance.
 int getGroupingSize()
           
 int getMultiplier()
           
 String getNegativePrefix()
           
 String getNegativeSuffix()
           
 String getPositivePrefix()
           
 String getPositiveSuffix()
           
 int hashCode()
          Returns a hash code for this object.
 boolean isDecimalSeparatorAlwaysShown()
           
 Number parse(String str, ParsePosition pos)
          This method parses the specified string into a Number.
 void setCurrency(Currency currency)
          Sets the Currency on the DecimalFormatSymbols used, which also sets the currency symbols on those symbols.
 void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)
          Sets the symbols used by this instance.
 void setDecimalSeparatorAlwaysShown(boolean newValue)
           
 void setGroupingSize(int groupSize)
           
 void setMaximumFractionDigits(int newValue)
          This method sets the maximum number of digits allowed in the fraction portion of a number to the specified value.
 void setMaximumIntegerDigits(int newValue)
          This method sets the maximum number of digits allowed in the integer portion of a number to the specified value.
 void setMinimumFractionDigits(int newValue)
          This method sets the minimum number of digits allowed in the fraction portion of a number to the specified value.
 void setMinimumIntegerDigits(int newValue)
          This method sets the minimum number of digits allowed in the integer portion of a number to the specified value.
 void setMultiplier(int newValue)
           
 void setNegativePrefix(String newValue)
           
 void setNegativeSuffix(String newValue)
           
 void setPositivePrefix(String newValue)
           
 void setPositiveSuffix(String newValue)
           
 String toLocalizedPattern()
           
 String toPattern()
           
 
Methods inherited from class java.text.NumberFormat
format, format, format, getAvailableLocales, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setGroupingUsed, setParseIntegerOnly
 
Methods inherited from class java.text.Format
format, parseObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecimalFormat

public DecimalFormat()
Constructs a DecimalFormat which uses the default pattern and symbols.


DecimalFormat

public DecimalFormat(String pattern)
Constructs a DecimalFormat which uses the given pattern and the default symbols for formatting and parsing.

Parameters:
pattern - the non-localized pattern to use.
Throws:
NullPointerException - if any argument is null.
IllegalArgumentException - if the pattern is invalid.

DecimalFormat

public DecimalFormat(String pattern,
                     DecimalFormatSymbols symbols)
Constructs a DecimalFormat using the given pattern and formatting symbols. This construction method is used to give complete control over the formatting process.

Parameters:
pattern - the non-localized pattern to use.
symbols - the set of symbols used for parsing and formatting.
Throws:
NullPointerException - if any argument is null.
IllegalArgumentException - if the pattern is invalid.
Method Detail

applyLocalizedPattern

public void applyLocalizedPattern(String pattern)

applyPattern

public void applyPattern(String pattern)

clone

public Object clone()
Description copied from class: Format
Creates a copy of this object.

Overrides:
clone in class Format
Returns:
The copied Object.

equals

public boolean equals(Object obj)
Tests this instance for equality with an arbitrary object. This method returns true if:

Overrides:
equals in class NumberFormat
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

format

public StringBuffer format(double number,
                           StringBuffer dest,
                           FieldPosition fieldPos)
Description copied from class: NumberFormat
This method formats the specified double and appends it to a StringBuffer.

Specified by:
format in class NumberFormat
Parameters:
number - The double to format.
dest - The StringBuffer to append the formatted number to.
fieldPos - The desired FieldPosition.
Returns:
The StringBuffer with the appended number.

formatToCharacterIterator

public AttributedCharacterIterator formatToCharacterIterator(Object value)
Overrides:
formatToCharacterIterator in class Format

format

public StringBuffer format(long number,
                           StringBuffer dest,
                           FieldPosition fieldPos)
Description copied from class: NumberFormat
This method formats the specified long and appends it to a StringBuffer.

Specified by:
format in class NumberFormat
Parameters:
number - The long to format.
dest - The StringBuffer to append the formatted number to.
fieldPos - The desired FieldPosition.
Returns:
The StringBuffer with the appended number.

getCurrency

public Currency getCurrency()
Returns the currency corresponding to the currency symbol stored in the instance of DecimalFormatSymbols used by this DecimalFormat.

Overrides:
getCurrency in class NumberFormat
Returns:
A new instance of Currency if the currency code matches a known one, null otherwise.

getDecimalFormatSymbols

public DecimalFormatSymbols getDecimalFormatSymbols()
Returns a copy of the symbols used by this instance.

Returns:
A copy of the symbols.

getGroupingSize

public int getGroupingSize()

getMultiplier

public int getMultiplier()

getNegativePrefix

public String getNegativePrefix()

getNegativeSuffix

public String getNegativeSuffix()

getPositivePrefix

public String getPositivePrefix()

getPositiveSuffix

public String getPositiveSuffix()

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class NumberFormat
Returns:
A hash code.

isDecimalSeparatorAlwaysShown

public boolean isDecimalSeparatorAlwaysShown()

parse

public Number parse(String str,
                    ParsePosition pos)
Description copied from class: NumberFormat
This method parses the specified string into a Number. This will be a Long if possible, otherwise it will be a Double. If no number can be parsed, no exception is thrown. Instead, the parse position remains at its initial index.

Specified by:
parse in class NumberFormat
Parameters:
str - The string to parse.
pos - The desired ParsePosition.
Returns:
The parsed Number

setCurrency

public void setCurrency(Currency currency)
Sets the Currency on the DecimalFormatSymbols used, which also sets the currency symbols on those symbols.

Overrides:
setCurrency in class NumberFormat
Parameters:
currency - The new currency to be used by this number format.

setDecimalFormatSymbols

public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)
Sets the symbols used by this instance. This method makes a copy of the supplied symbols.

Parameters:
newSymbols - the symbols (null not permitted).

setDecimalSeparatorAlwaysShown

public void setDecimalSeparatorAlwaysShown(boolean newValue)

setGroupingSize

public void setGroupingSize(int groupSize)

setMaximumFractionDigits

public void setMaximumFractionDigits(int newValue)
Description copied from class: NumberFormat
This method sets the maximum number of digits allowed in the fraction portion of a number to the specified value. If this is less than the current minimum allowed digits, the minimum allowed digits value will be lowered to be equal to the new maximum allowed digits value.

Overrides:
setMaximumFractionDigits in class NumberFormat
Parameters:
newValue - The new maximum fraction digits value.

setMaximumIntegerDigits

public void setMaximumIntegerDigits(int newValue)
Description copied from class: NumberFormat
This method sets the maximum number of digits allowed in the integer portion of a number to the specified value. If this is less than the current minimum allowed digits, the minimum allowed digits value will be lowered to be equal to the new maximum allowed digits value.

Overrides:
setMaximumIntegerDigits in class NumberFormat
Parameters:
newValue - The new maximum integer digits value.

setMinimumFractionDigits

public void setMinimumFractionDigits(int newValue)
Description copied from class: NumberFormat
This method sets the minimum number of digits allowed in the fraction portion of a number to the specified value. If this is greater than the current maximum allowed digits, the maximum allowed digits value will be raised to be equal to the new minimum allowed digits value.

Overrides:
setMinimumFractionDigits in class NumberFormat
Parameters:
newValue - The new minimum fraction digits value.

setMinimumIntegerDigits

public void setMinimumIntegerDigits(int newValue)
Description copied from class: NumberFormat
This method sets the minimum number of digits allowed in the integer portion of a number to the specified value. If this is greater than the current maximum allowed digits, the maximum allowed digits value will be raised to be equal to the new minimum allowed digits value.

Overrides:
setMinimumIntegerDigits in class NumberFormat
Parameters:
newValue - The new minimum integer digits value.

setMultiplier

public void setMultiplier(int newValue)

setNegativePrefix

public void setNegativePrefix(String newValue)

setNegativeSuffix

public void setNegativeSuffix(String newValue)

setPositivePrefix

public void setPositivePrefix(String newValue)

setPositiveSuffix

public void setPositiveSuffix(String newValue)

toLocalizedPattern

public String toLocalizedPattern()

toPattern

public String toPattern()

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.