Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.number
Class Numberer_en

    java.lang.Object
      net.sf.saxon.number.Numberer_en

All Implemented Interfaces:
  Serializable, Numberer

Direct Known Subclasses:
  Numberer_de, Numberer_fr

    public class Numberer_en

extends Object
implements Numberer, Serializable

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.

Author:
  Michael H. Kay
See Also:
  Serialized Form

Field Summary
`static int` | `LOWER_CASE`
`static int` | `TITLE_CASE`
`static int` | `UPPER_CASE`

Constructor Summary
`Numberer_en()`

Method Summary
`String` | `dayName(int day, int minWidth, int maxWidth)` Get a day name or abbreviation
`String` | `format(long number, String picture, int groupSize, String groupSeparator, String letterValue, String ordinal)` Format a number into a string
`String` | `getCalendarName(String code)` Get the name of a calendar
`String` | `getEraName(int year)` Get the name for an era (e.g.
`String` | `getOrdinalSuffixForDateTime(String component)` Get an ordinal suffix for a particular component of a date/time.
`String` | `getTimezoneName(int tz)` Get the name of a timezone
`String` | `halfDayName(int minutes, int minWidth, int maxWidth)` Get an am/pm indicator
`String` | `monthName(int month, int minWidth, int maxWidth)` Get a month name or abbreviation
`void` | `setCountry(String country)` Set the country used by this numberer (currenly used only for names of timezones)
`String` | `toOrdinalWords(String ordinalParam, long number, int wordCase)` Show an ordinal number as English words in a requested case (for example, Twentyfirst)
`static String` | `toRoman(long n)` Generate a Roman numeral (in lower case)
`String` | `toWords(long number)` Show the number as words in title case.
`String` | `toWords(long number, int wordCase)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UPPER_CASE

    public static final int UPPER_CASE

See Also:
  Constant Field Values

### LOWER_CASE

    public static final int LOWER_CASE

See Also:
  Constant Field Values

### TITLE_CASE

    public static final int TITLE_CASE

See Also:
  Constant Field Values

Constructor Detail

### Numberer_en

    public Numberer_en()

Method Detail

### setCountry

    public void setCountry(String country)

  Set the country used by this numberer (currenly used only for names of timezones)

  Specified by:
    `setCountry` in interface `Numberer`

### format

    public String format(long number,
                         String picture,
                         int groupSize,
                         String groupSeparator,
                         String letterValue,
                         String ordinal)

  Format a number into a string

  Specified by:
    `format` in interface `Numberer`
  Parameters:
    `number` - The number to be formatted
    `picture` - The format token. 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` - The letter-value specified to xsl:number: "alphabetic" or "traditional". Can also be an empty string or null.
    `ordinal` - The value of the ordinal attribute specified to xsl:number The value "yes" indicates that ordinal numbers should be used; "" or null indicates that cardinal numbers
  Returns:
    the formatted number. Note that no errors are reported; if the request is invalid, the number is formatted as if the string() function were used.

### toRoman

    public static String toRoman(long n)

  Generate a Roman numeral (in lower case)

### toWords

    public String toWords(long number)

  Show the number as words in title case. (We choose title case because the result can then be converted algorithmically to lower case or upper case).

### toWords

    public String toWords(long number,
                          int wordCase)

### toOrdinalWords

    public String toOrdinalWords(String ordinalParam,
                                 long number,
                                 int wordCase)

  Show an ordinal number as English words in a requested case (for example, Twentyfirst)

### monthName

    public String monthName(int month,
                            int minWidth,
                            int maxWidth)

  Get a month name or abbreviation

  Specified by:
    `monthName` in interface `Numberer`
  Parameters:
    `month` - The month number (1=January, 12=December)
    `minWidth` - The minimum number of characters
    `maxWidth` - The maximum number of characters

### dayName

    public String dayName(int day,
                          int minWidth,
                          int maxWidth)

  Get a day name or abbreviation

  Specified by:
    `dayName` in interface `Numberer`
  Parameters:
    `day` - The day of the week (1=Monday, 7=Sunday)
    `minWidth` - The minimum number of characters
    `maxWidth` - The maximum number of characters

### halfDayName

    public String halfDayName(int minutes,
                              int minWidth,
                              int maxWidth)

  Get an am/pm indicator

  Specified by:
    `halfDayName` in interface `Numberer`
  Parameters:
    `minutes` - the minutes within the day
    `minWidth` - minimum width of output
    `maxWidth` - maximum width of output
  Returns:
    the AM or PM indicator

### getOrdinalSuffixForDateTime

    public String getOrdinalSuffixForDateTime(String component)

  Get an ordinal suffix for a particular component of a date/time.

  Specified by:
    `getOrdinalSuffixForDateTime` in interface `Numberer`
  Parameters:
    `component` - the component specifier from a format-dateTime picture, for example "M" for the month or "D" for the day.
  Returns:
    a string that is acceptable in the ordinal attribute of xsl:number to achieve the required ordinal representation. For example, "-e" for the day component in German, to have the day represented as "dritte August".

### getEraName

    public String getEraName(int year)

  Get the name for an era (e.g. "BC" or "AD")

  Specified by:
    `getEraName` in interface `Numberer`
  Parameters:
    `year` - the proleptic gregorian year, using "0" for the year before 1AD

### getTimezoneName

    public String getTimezoneName(int tz)

  Get the name of a timezone

  Specified by:
    `getTimezoneName` in interface `Numberer`
  Parameters:
    `tz` - the offset of the timezone from GMT in minutes

### getCalendarName

    public String getCalendarName(String code)

  Get the name of a calendar

  Specified by:
    `getCalendarName` in interface `Numberer`
  Parameters:
    `code` - The code representing the calendar as in the XSLT 2.0 spec, e.g. AD for the Gregorian calendar

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.