Class Numberer_en

  • All Implemented Interfaces:
    Numberer
    Direct Known Subclasses:
    Numberer_de

    public class Numberer_en
    extends java.lang.Object
    implements Numberer
    Class Numberer_en does number formatting for language="en". This supports the xsl:number element. Methods and data are declared as protected, and static is avoided, to allow easy subclassing.
    Version:
    4 August 2000
    Author:
    Michael H. Kay
    • Constructor Summary

      Constructors 
      Constructor Description
      Numberer_en()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void alphaDefault​(int number, char formchar, java.lang.StringBuffer sb)
      Default processing with an alphabetic format token: use the contiguous range of Unicode letters starting with that token.
      java.lang.String format​(int number, java.lang.String picture, int groupSize, java.lang.String groupSeparator, java.lang.String letterValue)
      Format a number into a string
      protected java.lang.String toAlpha​(int number, int min, int max)
      Format the number as an alphabetic label using the alphabet consisting of consecutive Unicode characters from min to max
      protected java.lang.String toAlphaSequence​(int number, java.lang.String alphabet)
      Convert the number into an alphabetic label using a given alphabet.
      protected java.lang.String toRadical​(int number, java.lang.String digits, java.lang.String picture, int groupSize, java.lang.String groupSeparator)
      Convert the number into a decimal or other representation using the given set of digits.
      protected java.lang.String toRoman​(int n)
      Generate a Roman numeral (in lower case)
      java.lang.String toWords​(int number)
      Show the number as English words
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • westernDigits

        protected java.lang.String westernDigits
      • latinUpper

        protected java.lang.String latinUpper
      • latinLower

        protected java.lang.String latinLower
      • greekUpper

        protected java.lang.String greekUpper
      • greekLower

        protected java.lang.String greekLower
      • cyrillicUpper

        protected java.lang.String cyrillicUpper
      • cyrillicLower

        protected java.lang.String cyrillicLower
      • hebrew

        protected java.lang.String hebrew
      • hiraganaA

        protected java.lang.String hiraganaA
      • katakanaA

        protected java.lang.String katakanaA
      • hiraganaI

        protected java.lang.String hiraganaI
      • katakanaI

        protected java.lang.String katakanaI
      • kanjiDigits

        protected java.lang.String kanjiDigits
      • englishUnits

        protected java.lang.String[] englishUnits
      • englishTens

        protected java.lang.String[] englishTens
    • Constructor Detail

      • Numberer_en

        public Numberer_en()
    • Method Detail

      • format

        public java.lang.String format​(int number,
                                       java.lang.String picture,
                                       int groupSize,
                                       java.lang.String groupSeparator,
                                       java.lang.String letterValue)
        Format a number into a string
        Specified by:
        format in interface Numberer
        Parameters:
        number - The number to be formatted
        picture - The format specification. This is a single component of the format attribute of xsl:number, e.g. "1", "01", "i", or "a"
        groupSize - number of digits per group (0 implies no grouping)
        groupSeparator - string to appear between groups of digits
        letterValue - as defined in xsl:number ("alphabetic" or "traditional" or "")
        Returns:
        the formatted number
      • alphaDefault

        protected void alphaDefault​(int number,
                                    char formchar,
                                    java.lang.StringBuffer sb)
        Default processing with an alphabetic format token: use the contiguous range of Unicode letters starting with that token.
      • toAlpha

        protected java.lang.String toAlpha​(int number,
                                           int min,
                                           int max)
        Format the number as an alphabetic label using the alphabet consisting of consecutive Unicode characters from min to max
      • toAlphaSequence

        protected java.lang.String toAlphaSequence​(int number,
                                                   java.lang.String alphabet)
        Convert the number into an alphabetic label using a given alphabet. For example, if the alphabet is "xyz" the sequence is x, y, z, xx, xy, xz, ....
      • toRadical

        protected java.lang.String toRadical​(int number,
                                             java.lang.String digits,
                                             java.lang.String picture,
                                             int groupSize,
                                             java.lang.String groupSeparator)
        Convert the number into a decimal or other representation using the given set of digits. For example, if the digits are "01" the sequence is 1, 10, 11, 100, 101, 110, 111, ...
        Parameters:
        number - the number to be formatted
        digits - the set of digits to be used
        picture - the formatting token, e.g. 001 means include leading zeroes to give at least three decimal places
        groupsize - the number of digits in each group
        groupSeparator - the separator to use between groups of digits.
      • toRoman

        protected java.lang.String toRoman​(int n)
        Generate a Roman numeral (in lower case)
      • toWords

        public java.lang.String toWords​(int number)
        Show the number as English words