net.sf.saxon.trans

## Class DecimalSymbols

- java.lang.Object
- - net.sf.saxon.trans.DecimalSymbols

- All Implemented Interfaces:
    Serializable

      public class DecimalSymbols
      extends Object
      implements Serializable

  This class is modelled on Java's DecimalFormatSymbols, but it allows the use of any Unicode character to represent symbols such as the decimal point and the grouping separator, whereas DecimalFormatSymbols restricts these to a char (1-65535).
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DECIMAL_SEPARATOR`
    `static int` | `DIGIT`
    `static int` | `GROUPING_SEPARATOR`
    `static int` | `INFINITY`
    `static int` | `MINUS_SIGN`
    `static int` | `NAN`
    `static int` | `PATTERN_SEPARATOR`
    `static int` | `PER_MILLE`
    `static int` | `PERCENT`
    `static int` | `ZERO_DIGIT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DecimalSymbols()` Create a DecimalSymbols object with default values for all properties

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkConsistency(StructuredQName name)` Check that no character is used in more than one role
    `boolean` | `equals(Object obj)` Test if two sets of decimal format symbols are the same
    `int` | `getDecimalSeparator()` Get the decimal separator value
    `int` | `getDigit()` Get the digit symbol value
    `int` | `getGroupingSeparator()` Get the grouping separator value
    `String` | `getInfinity()` Get the infinity symbol value
    `int` | `getMinusSign()` Get the minus sign value
    `String` | `getNaN()` Get the NaN symbol value
    `int` | `getPatternSeparator()` Get the pattern separator value
    `int` | `getPercent()` Get the percent symbol value
    `int` | `getPerMille()` Get the per-mille symbol value
    `int` | `getZeroDigit()` Get the zero digit symbol value
    `int` | `hashCode()`
    `static boolean` | `isValidZeroDigit(int zeroDigit)` Check that the character declared as a zero-digit is indeed a valid zero-digit
    `void` | `setDecimalSeparator(String value)` Set the character to be used as the decimal separator
    `void` | `setDigit(String value)` Set the character to be used as the digit symbol (default is '#')
    `void` | `setGroupingSeparator(String value)` Set the character to be used as the grouping separator
    `void` | `setHostLanguage(int language)`
    `void` | `setInfinity(String value)` Set the string to be used to represent infinity
    `void` | `setMinusSign(String value)` Set the character to be used as the minus sign
    `void` | `setNaN(String value)` Set the string to be used to represent NaN
    `void` | `setPatternSeparator(String value)` Set the character to be used as the pattern separator (default ';')
    `void` | `setPercent(String value)` Set the character to be used as the percent sign
    `void` | `setPerMille(String value)` Set the character to be used as the per-mille sign
    `void` | `setProperty(int key, String value, int precedence)` Set the value of a property
    `void` | `setZeroDigit(String value)` Set the character to be used as the zero digit (which determines the digit family used in the output)

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DECIMAL_SEPARATOR

          public static final int DECIMAL_SEPARATOR

      See Also:
        Constant Field Values

    - #### GROUPING_SEPARATOR

          public static final int GROUPING_SEPARATOR

      See Also:
        Constant Field Values

    - #### DIGIT

          public static final int DIGIT

      See Also:
        Constant Field Values

    - #### MINUS_SIGN

          public static final int MINUS_SIGN

      See Also:
        Constant Field Values

    - #### PERCENT

          public static final int PERCENT

      See Also:
        Constant Field Values

    - #### PER_MILLE

          public static final int PER_MILLE

      See Also:
        Constant Field Values

    - #### ZERO_DIGIT

          public static final int ZERO_DIGIT

      See Also:
        Constant Field Values

    - #### PATTERN_SEPARATOR

          public static final int PATTERN_SEPARATOR

      See Also:
        Constant Field Values

    - #### INFINITY

          public static final int INFINITY

      See Also:
        Constant Field Values

    - #### NAN

          public static final int NAN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DecimalSymbols

          public DecimalSymbols()

      Create a DecimalSymbols object with default values for all properties

  - ### Method Detail

    - #### setHostLanguage

          public void setHostLanguage(int language)

    - #### getDecimalSeparator

          public int getDecimalSeparator()

      Get the decimal separator value
      Returns:
        the decimal separator value that has been explicitly set, or its default ('.')

    - #### getGroupingSeparator

          public int getGroupingSeparator()

      Get the grouping separator value
      Returns:
        the grouping separator value that has been explicitly set, or its default (',')

    - #### getDigit

          public int getDigit()

      Get the digit symbol value
      Returns:
        the digit symbol value that has been explicitly set, or its default ('#')

    - #### getMinusSign

          public int getMinusSign()

      Get the minus sign value
      Returns:
        the minus sign value that has been explicitly set, or its default ('-')

    - #### getPercent

          public int getPercent()

      Get the percent symbol value
      Returns:
        the percent symbol value that has been explicitly set, or its default ('%')

    - #### getPerMille

          public int getPerMille()

      Get the per-mille symbol value
      Returns:
        the per-mille symbol value that has been explicitly set, or its default

    - #### getZeroDigit

          public int getZeroDigit()

      Get the zero digit symbol value
      Returns:
        the zero digit symbol value that has been explicitly set, or its default ('0')

    - #### getPatternSeparator

          public int getPatternSeparator()

      Get the pattern separator value
      Returns:
        the pattern separator value that has been explicitly set, or its default (';')

    - #### getInfinity

          public String getInfinity()

      Get the infinity symbol value
      Returns:
        the infinity symbol value that has been explicitly set, or its default ('Infinity')

    - #### getNaN

          public String getNaN()

      Get the NaN symbol value
      Returns:
        the NaN symbol value that has been explicitly set, or its default ('NaN')

    - #### setDecimalSeparator

          public void setDecimalSeparator(String value)
                                   throws XPathException

      Set the character to be used as the decimal separator
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setGroupingSeparator

          public void setGroupingSeparator(String value)
                                    throws XPathException

      Set the character to be used as the grouping separator
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setDigit

          public void setDigit(String value)
                        throws XPathException

      Set the character to be used as the digit symbol (default is '#')
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setMinusSign

          public void setMinusSign(String value)
                            throws XPathException

      Set the character to be used as the minus sign
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setPercent

          public void setPercent(String value)
                          throws XPathException

      Set the character to be used as the percent sign
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setPerMille

          public void setPerMille(String value)
                           throws XPathException

      Set the character to be used as the per-mille sign
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setZeroDigit

          public void setZeroDigit(String value)
                            throws XPathException

      Set the character to be used as the zero digit (which determines the digit family used in the output)
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted), or if it is not a character classified in Unicode as a digit with numeric value zero

    - #### setPatternSeparator

          public void setPatternSeparator(String value)
                                   throws XPathException

      Set the character to be used as the pattern separator (default ';')
      Parameters:
        `value` - the character to be used
      Throws:
        `XPathException` - if the value is not a single Unicode character (a surrogate pair is permitted)

    - #### setInfinity

          public void setInfinity(String value)
                           throws XPathException

      Set the string to be used to represent infinity
      Parameters:
        `value` - the string to be used
      Throws:
        `XPathException` - - should not happen

    - #### setNaN

          public void setNaN(String value)
                      throws XPathException

      Set the string to be used to represent NaN
      Parameters:
        `value` - the string to be used
      Throws:
        `XPathException` - - should not happen

    - #### setProperty

          public void setProperty(int key,
                         String value,
                         int precedence)
                           throws XPathException

      Set the value of a property
      Parameters:
        `key` - the integer key of the property to be set
        `value` - the value of the property as a string (in many cases, this must be a single character)
        `precedence` - the precedence of the property value
      Throws:
        `XPathException` - if the property is invalid. This method does not check the consistency of different properties. If two different values are supplied for the same property at the same precedence, the method does not complain, but notes the fact, and if the inconsistency is not subsequently cleared by supplying another value at a higher precedence, the error is reported when the checkConsistency() method is subsequently called.

    - #### checkConsistency

          public void checkConsistency(StructuredQName name)
                                throws XPathException

      Check that no character is used in more than one role
      Parameters:
        `name` - the name of the decimal format (null for the unnamed decimal format)
      Throws:
        `XPathException` - if the same character is used in conflicting rules, for example as decimal separator and also as grouping separator

    - #### isValidZeroDigit

          public static boolean isValidZeroDigit(int zeroDigit)

      Check that the character declared as a zero-digit is indeed a valid zero-digit
      Parameters:
        `zeroDigit` - the value to be checked
      Returns:
        false if it is not a valid zero-digit

    - #### equals

          public boolean equals(Object obj)

      Test if two sets of decimal format symbols are the same
      Overrides:
        `equals` in class `Object`
      Parameters:
        `obj` - the other set of symbols
      Returns:
        true if the same characters/strings are assigned to each role in both sets of symbols. The precedences are not compared.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.