Package com.saxonica.config.pe
Class ICUNumbererPE
- java.lang.Object
- 
- net.sf.saxon.expr.number.AbstractNumberer
- 
- com.saxonica.config.pe.ICUNumbererPE
 
 
- 
- All Implemented Interfaces:
- Numberer
 - Direct Known Subclasses:
- ICUNumberer_de,- ICUNumbererEnUnhyphenated
 
 public class ICUNumbererPE extends AbstractNumberer A numberer using the ICU features, used principally for formatting numbers as words and day/month namesNote that in the case that the ICU libraries have not been loaded, then this class is not instantiated. However, the public static functions, e.g. getLocales() could in theory be accessed via an XSLT stylesheet (such as the documentation generators for example) and these invoke ICU features The guard function com.saxonica.config.ICUNumbererPE.hasICU() can be used to check. 
- 
- 
Field Summary- 
Fields inherited from class net.sf.saxon.expr.number.AbstractNumberercyrillicLower, cyrillicUpper, greekLower, greekUpper, hebrew, hiraganaA, hiraganaI, katakanaA, katakanaI, latinLower, latinUpper, LOWER_CASE, TITLE_CASE, UPPER_CASE, westernDigits
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]availableOrdinalNumberings(java.lang.String loc)Return the available ordinal numbering schemes available for a given localestatic java.lang.String[]availableSpelloutNumberings(java.lang.String loc)Return the available spellout numbering schemes available for a given localeprotected voidconfig(java.util.Locale locale, java.lang.String privateUseExtension, Configuration config)Configure an ICU numberer.java.lang.StringdayName(int day, int minWidth, int maxWidth)Return an appropriate day name, using ICU data The approach is to try each of the forms available in descending order of 'size' until we have the first that fits the width constraints.java.util.LocaledefaultedLocale()Returns the locale that was used by default, rather than that requested.static java.lang.StringgetICUVersion()Return the version of the ICU supported in this implementationstatic java.lang.String[]getLocales()Return all the locales available for collationstatic ICUNumbererPEgetNumberer(java.util.Locale locale, java.lang.String privateUseExtension, Configuration config)Returns a suitable configured ICU numberer or a specialist subclass thereof.static java.lang.String[]getPreferences()java.lang.StringmonthName(int month, int minWidth, int maxWidth)Return an appropriate month name, using ICU data The approach is to try each of the forms available in descending order of 'size' until we have the first that fits the width constraints.java.lang.StringordinalSuffix(java.lang.String ordinalParam, long number)Construct the ordinal suffix for a number, for example "st", "nd", "rd".java.lang.StringpostProcess(java.lang.String result)Post-process a spelled-out number.java.lang.StringpostProcessOrdinal(java.lang.String result, java.lang.String ordinalParam)Post-process an ordinal spelled-out number.static java.lang.StringrealLocale(java.lang.String loc)Return the real language to be used for a given localejava.lang.StringtoOrdinalWords(java.lang.String ordinalParam, long number, int wordCase)Show an ordinal number as English words in a requested case (for example, Twentyfirst)java.lang.StringtoWords(long number)Show the number as words in title case.java.lang.StringtoWords(long number, int wordCase)Format a number as English words with specified case options- 
Methods inherited from class net.sf.saxon.expr.number.AbstractNumbereralphaDefault, convertDigitSystem, format, format, getCalendarName, getCountry, getEraName, getLanguage, getOrdinalSuffixForDateTime, halfDayName, setCountry, setLanguage, toAlpha, toAlphaSequence, toJapanese, toRoman, zero
 
- 
 
- 
- 
- 
Method Detail- 
getNumbererpublic static ICUNumbererPE getNumberer(java.util.Locale locale, java.lang.String privateUseExtension, Configuration config) Returns a suitable configured ICU numberer or a specialist subclass thereof.- Parameters:
- locale- the locale to use
- privateUseExtension- the language code extension used to denote required numbering
- config- the system Configuration
- Returns:
- a suitable Numberer.
 
 - 
configprotected void config(java.util.Locale locale, java.lang.String privateUseExtension, Configuration config)Configure an ICU numberer. This includes possibly substituting a default locale if that requested isn't supported.- Parameters:
- locale- the locale to use
- privateUseExtension- the language code extension used to denote required numbering
- config- the system Configuration
 
 - 
defaultedLocalepublic java.util.Locale defaultedLocale() Returns the locale that was used by default, rather than that requested.- Specified by:
- defaultedLocalein interface- Numberer
- Overrides:
- defaultedLocalein class- AbstractNumberer
- Returns:
- the locale actually used, null if no default was required.
 
 - 
getLocalespublic static java.lang.String[] getLocales() Return all the locales available for collation- Returns:
- The set of locales as 'code';'display name' pairs
 
 - 
getPreferencespublic static java.lang.String[] getPreferences() 
 - 
availableSpelloutNumberingspublic static java.lang.String[] availableSpelloutNumberings(java.lang.String loc) Return the available spellout numbering schemes available for a given locale- Parameters:
- loc- the locale code
- Returns:
- the numbering scheme names, e.g. '%spellout-verbose'
 
 - 
availableOrdinalNumberingspublic static java.lang.String[] availableOrdinalNumberings(java.lang.String loc) Return the available ordinal numbering schemes available for a given locale- Parameters:
- loc- the locale code
- Returns:
- the numbering scheme names, e.g. '%digits-ordinal'
 
 - 
realLocalepublic static java.lang.String realLocale(java.lang.String loc) Return the real language to be used for a given locale- Parameters:
- loc- the locale code
- Returns:
- the language code actually used
 
 - 
getICUVersionpublic static java.lang.String getICUVersion() Return the version of the ICU supported in this implementation- Returns:
- the version code as a 'major.minor.milli.micro' string
 
 - 
ordinalSuffixpublic java.lang.String ordinalSuffix(java.lang.String ordinalParam, long number)Description copied from class:AbstractNumbererConstruct the ordinal suffix for a number, for example "st", "nd", "rd". The default (language-neutral) implementation returns a zero-length string- Overrides:
- ordinalSuffixin class- AbstractNumberer
- 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
 
 - 
toWordspublic java.lang.String toWords(long number) Description copied from class:AbstractNumbererShow 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).- Specified by:
- toWordsin class- AbstractNumberer
- Parameters:
- number- the number to be formatted
- Returns:
- the number formatted as English words
 
 - 
toWordspublic java.lang.String toWords(long number, int wordCase)Description copied from class:AbstractNumbererFormat a number as English words with specified case options- Overrides:
- toWordsin class- AbstractNumberer
- Parameters:
- number- the number to be formatted
- wordCase- the required case for example- AbstractNumberer.UPPER_CASE,- AbstractNumberer.LOWER_CASE,- AbstractNumberer.TITLE_CASE
- Returns:
- the formatted number
 
 - 
toOrdinalWordspublic java.lang.String toOrdinalWords(java.lang.String ordinalParam, long number, int wordCase)Description copied from class:AbstractNumbererShow an ordinal number as English words in a requested case (for example, Twentyfirst)- Specified by:
- toOrdinalWordsin class- AbstractNumberer
- Parameters:
- ordinalParam- the value of the "ordinal" attribute as supplied by the user
- number- the number to be formatted
- wordCase- the required case for example- AbstractNumberer.UPPER_CASE,- AbstractNumberer.LOWER_CASE,- AbstractNumberer.TITLE_CASE
- Returns:
- the formatted number
 
 - 
postProcesspublic java.lang.String postProcess(java.lang.String result) Post-process a spelled-out number. Overriding this can add additional effects such as replacing '-' with a space.- Parameters:
- result- The spelled-out number generated by ICU
- Returns:
- processed string
 
 - 
postProcessOrdinalpublic java.lang.String postProcessOrdinal(java.lang.String result, java.lang.String ordinalParam)Post-process an ordinal spelled-out number. Overriding this can add additional effects, such as gender/case variable suffices in German- Parameters:
- result- The spelled-out ordinal generated by ICU
- ordinalParam- The ordinal parameter, if any
- Returns:
- processed string
 
 - 
monthNamepublic java.lang.String monthName(int month, int minWidth, int maxWidth)Return an appropriate month name, using ICU data The approach is to try each of the forms available in descending order of 'size' until we have the first that fits the width constraints.- Specified by:
- monthNamein interface- Numberer
- Specified by:
- monthNamein class- AbstractNumberer
- Parameters:
- month- The month number (1=January, 12=December)
- minWidth- The minimum number of characters
- maxWidth- The maximum number of characters
- Returns:
- The month name in TITLE case
 
 - 
dayNamepublic java.lang.String dayName(int day, int minWidth, int maxWidth)Return an appropriate day name, using ICU data The approach is to try each of the forms available in descending order of 'size' until we have the first that fits the width constraints.- Specified by:
- dayNamein interface- Numberer
- Specified by:
- dayNamein class- AbstractNumberer
- Parameters:
- day- The day of the week (1=Monday, 7=Sunday)
- minWidth- The minimum number of characters
- maxWidth- The maximum number of characters
- Returns:
- The day name in TITLE case
 
 
- 
 
-