public abstract class AbstractNumberer extends Object implements Numberer
Modifier and Type | Field and Description |
---|---|
protected static String |
cyrillicLower |
protected static String |
cyrillicUpper |
protected static String |
greekLower |
protected static String |
greekUpper |
protected static String |
hebrew |
protected static String |
hiraganaA |
protected static String |
hiraganaI |
protected static String |
katakanaA |
protected static String |
katakanaI |
protected static String |
latinLower |
protected static String |
latinUpper |
static int |
LOWER_CASE |
static int |
TITLE_CASE |
static int |
UPPER_CASE |
protected static int[] |
westernDigits |
Constructor and Description |
---|
AbstractNumberer() |
Modifier and Type | Method and Description |
---|---|
protected 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.
|
abstract String |
dayName(int day,
int minWidth,
int maxWidth)
Get a day name or abbreviation
|
Locale |
defaultedLocale()
Whether this numberer has had its locale defaulted, i.e.
|
String |
format(long number,
UnicodeString picture,
int groupSize,
String groupSeparator,
String letterValue,
String ordinal)
Format a number into a string.
|
String |
format(long number,
UnicodeString picture,
NumericGroupFormatter numGroupFormatter,
String letterValue,
String ordinal)
Format a number into a string
|
String |
getCalendarName(String code)
Get the name of a calendar
|
String |
getCountry()
Get the country used by this numberer.
|
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 |
halfDayName(int minutes,
int minWidth,
int maxWidth)
Get an am/pm indicator.
|
abstract String |
monthName(int month,
int minWidth,
int maxWidth)
Get a month name or abbreviation
|
protected 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 (currently 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 max
|
protected String |
toAlphaSequence(long number,
String alphabet)
Convert the number into an alphabetic label using a given alphabet.
|
String |
toJapanese(long number)
Format the number in Japanese.
|
abstract 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)
|
abstract String |
toWords(long number)
Show the number as words in title case.
|
String |
toWords(long number,
int wordCase)
Format a number as English words with specified case options
|
public static final int UPPER_CASE
public static final int LOWER_CASE
public static final int TITLE_CASE
protected static final int[] westernDigits
protected static final String latinUpper
protected static final String latinLower
protected static final String greekUpper
protected static final String greekLower
protected static final String cyrillicUpper
protected static final String cyrillicLower
protected static final String hebrew
protected static final String hiraganaA
protected static final String katakanaA
protected static final String hiraganaI
protected static final String katakanaI
public Locale defaultedLocale()
defaultedLocale
in interface Numberer
public void setCountry(String country)
setCountry
in interface Numberer
country
- The ISO two-letter country code.public String getCountry()
getCountry
in interface Numberer
public final String format(long number, UnicodeString picture, int groupSize, String groupSeparator, String letterValue, String ordinal)
Numberer.format(long, UnicodeString, NumericGroupFormatter, String, String)
rather than this method.format
in interface Numberer
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 numberspublic String format(long number, UnicodeString picture, NumericGroupFormatter numGroupFormatter, String letterValue, String ordinal)
format
in interface Numberer
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"numGroupFormatter
- object contains separators 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
cardinal numbers. A value such as "-er" indicates ordinal with a particular gender.protected String ordinalSuffix(String ordinalParam, long number)
ordinalParam
- the value of the ordinal attribute (used in non-English
language implementations)number
- the number being formattedprotected void alphaDefault(long number, char formchar, FastStringBuffer sb)
number
- the number to be formattedformchar
- the format character, for example 'A' for the numbering sequence A,B,Csb
- buffer to hold the result of the formattingprotected String toAlpha(long number, int min, int max)
number
- the number to be formattedmin
- the start of the Unicode codepoint rangemax
- the end of the Unicode codepoint rangeprotected String toAlphaSequence(long number, String alphabet)
number
- the number to be formattedalphabet
- a string containing the characters to be used, for example "abc...xyz"public static String toRoman(long n)
n
- the number to be formattedpublic String toJapanese(long number)
number
- the number to be formatted: formatted in Western decimal style unless in the range 1 to 9999public abstract String toWords(long number)
number
- the number to be formattedpublic String toWords(long number, int wordCase)
number
- the number to be formattedwordCase
- the required case for example UPPER_CASE
,
LOWER_CASE
, TITLE_CASE
public abstract String toOrdinalWords(String ordinalParam, long number, int wordCase)
ordinalParam
- the value of the "ordinal" attribute as supplied by the usernumber
- the number to be formattedwordCase
- the required case for example UPPER_CASE
,
LOWER_CASE
, TITLE_CASE
public abstract String monthName(int month, int minWidth, int maxWidth)
public abstract String dayName(int day, int minWidth, int maxWidth)
public String halfDayName(int minutes, int minWidth, int maxWidth)
halfDayName
in interface Numberer
minutes
- the minutes within the dayminWidth
- minimum width of outputmaxWidth
- maximum width of outputpublic String getOrdinalSuffixForDateTime(String component)
getOrdinalSuffixForDateTime
in interface Numberer
component
- the component specifier from a format-dateTime picture, for
example "M" for the month or "D" for the day.public String getEraName(int year)
getEraName
in interface Numberer
year
- the proleptic gregorian year, using "0" for the year before 1ADpublic String getCalendarName(String code)
getCalendarName
in interface Numberer
code
- The code representing the calendar as in the XSLT 2.0 spec, e.g. AD for the Gregorian calendarCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.