Package 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
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final int[]
protected static final String
protected static final String
protected static final String
protected static final String
static final int
(package private) static HashMap
static final int
static final int
protected static final int[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
alphaDefault
(long number, char formchar, FastStringBuffer sb) Default processing with an alphabetic format token: use the contiguous range of Unicode letters starting with that token.dayName
(int day, int minWidth, int maxWidth) Get a day name or abbreviationformat
(long number, String picture, int groupSize, String groupSeparator, String letterValue, String ordinal) Format a number into a stringgetCalendarName
(String code) Get the name of a calendargetEraName
(int year) Get the name for an era (e.g.getOrdinalSuffixForDateTime
(String component) Get an ordinal suffix for a particular component of a date/time.getTimezoneName
(int tz) Get the name of a timezonehalfDayName
(int minutes, int minWidth, int maxWidth) Get an am/pm indicatormonthName
(int month, int minWidth, int maxWidth) Get a month name or abbreviationprotected String
ordinalSuffix
(String ordinalParam, long number) Construct the ordinal suffix for a number, for example "st", "nd", "rd"void
setCountry
(String country) Set the country used by this numberer (currenly used only for names of timezones)protected String
toAlpha
(long number, int min, int max) Format the number as an alphabetic label using the alphabet consisting of consecutive Unicode characters from min to maxprotected String
toAlphaSequence
(long number, String alphabet) Convert the number into an alphabetic label using a given alphabet.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)toWords
(long number) Show the number as words in title case.toWords
(long number, int wordCase) (package private) static void
-
Field Details
-
UPPER_CASE
public static final int UPPER_CASE- See Also:
-
LOWER_CASE
public static final int LOWER_CASE- See Also:
-
TITLE_CASE
public static final int TITLE_CASE- See Also:
-
westernDigits
protected static final int[] westernDigits -
latinUpper
- See Also:
-
latinLower
- See Also:
-
greekUpper
- See Also:
-
greekLower
- See Also:
-
cyrillicUpper
- See Also:
-
cyrillicLower
- See Also:
-
hebrew
- See Also:
-
hiraganaA
- See Also:
-
katakanaA
- See Also:
-
hiraganaI
- See Also:
-
katakanaI
- See Also:
-
kanjiDigits
protected static final int[] kanjiDigits -
timezones
-
-
Constructor Details
-
Numberer_en
public Numberer_en()
-
-
Method Details
-
setCountry
Set the country used by this numberer (currenly used only for names of timezones)- Specified by:
setCountry
in interfaceNumberer
-
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 interfaceNumberer
- Parameters:
number
- The number to be formattedpicture
- 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 digitsletterValue
- 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.
-
ordinalSuffix
Construct the ordinal suffix for a number, for example "st", "nd", "rd"- Parameters:
ordinalParam
- the value of the ordinal attribute (used in non-English language implementations)number
- the number being formatted- Returns:
- the ordinal suffix to be appended to the formatted number
-
alphaDefault
Default processing with an alphabetic format token: use the contiguous range of Unicode letters starting with that token. -
toAlpha
Format the number as an alphabetic label using the alphabet consisting of consecutive Unicode characters from min to max -
toAlphaSequence
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, .... -
toRoman
Generate a Roman numeral (in lower case) -
toWords
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
-
toOrdinalWords
Show an ordinal number as English words in a requested case (for example, Twentyfirst) -
monthName
Get a month name or abbreviation -
dayName
Get a day name or abbreviation -
halfDayName
Get an am/pm indicator- Specified by:
halfDayName
in interfaceNumberer
- Parameters:
minutes
- the minutes within the dayminWidth
- minimum width of outputmaxWidth
- maximum width of output- Returns:
- the AM or PM indicator
-
getOrdinalSuffixForDateTime
Get an ordinal suffix for a particular component of a date/time.- Specified by:
getOrdinalSuffixForDateTime
in interfaceNumberer
- 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
Get the name for an era (e.g. "BC" or "AD")- Specified by:
getEraName
in interfaceNumberer
- Parameters:
year
- the proleptic gregorian year, using "0" for the year before 1AD
-
getTimezoneName
Get the name of a timezone- Specified by:
getTimezoneName
in interfaceNumberer
- Parameters:
tz
- the offset of the timezone from GMT in minutes
-
tz
-
getCalendarName
Get the name of a calendar- Specified by:
getCalendarName
in interfaceNumberer
- Parameters:
code
- The code representing the calendar as in the XSLT 2.0 spec, e.g. AD for the Gregorian calendar
-