org.apache.xalan.transformer
Class NumeratorFormatter

java.lang.Object
  extended by org.apache.xalan.transformer.NumeratorFormatter

 class NumeratorFormatter
extends java.lang.Object

Converts enumerated numbers into strings, using the XSL conversion attributes. Having this in a class helps avoid being forced to extract the attributes repeatedly.


Nested Class Summary
(package private) static class NumeratorFormatter.NumberFormatStringTokenizer
          This class returns tokens using non-alphanumberic characters as delimiters.
 
Field Summary
private static char[] m_alphaCountTable
          Chars for converting integers into alpha counts.
(package private)  java.text.NumberFormat m_formatter
          An instance of a NumberFormat
(package private)  NumeratorFormatter.NumberFormatStringTokenizer m_formatTokenizer
          An instance of a Tokenizer
(package private)  java.util.Locale m_locale
          Locale we need to format in
(package private)  TransformerImpl m_processor
          An instance of a transformer
private static DecimalToRoman[] m_romanConvertTable
          Table to help in converting decimals to roman numerals.
protected  org.w3c.dom.Element m_xslNumberElement
          The owning xsl:number element.
 
Constructor Summary
NumeratorFormatter(org.w3c.dom.Element xslNumberElement, TransformerImpl processor)
          Construct a NumeratorFormatter using an element that contains XSL number conversion attributes - format, letter-value, xml:lang, digit-group-sep, n-digits-per-group, and sequence-src.
 
Method Summary
protected  java.lang.String int2alphaCount(int val, char[] table)
          Convert a long integer into alphabetic counting, in other words count using the sequence A B C ...
(package private)  java.lang.String long2roman(long val, boolean prefixesAreOK)
          Convert a long integer into roman numerals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_xslNumberElement

protected org.w3c.dom.Element m_xslNumberElement
The owning xsl:number element.


m_formatTokenizer

NumeratorFormatter.NumberFormatStringTokenizer m_formatTokenizer
An instance of a Tokenizer


m_locale

java.util.Locale m_locale
Locale we need to format in


m_formatter

java.text.NumberFormat m_formatter
An instance of a NumberFormat


m_processor

TransformerImpl m_processor
An instance of a transformer


m_romanConvertTable

private static final DecimalToRoman[] m_romanConvertTable
Table to help in converting decimals to roman numerals.

See Also:
DecimalToRoman

m_alphaCountTable

private static final char[] m_alphaCountTable
Chars for converting integers into alpha counts.

See Also:
TransformerImpl#int2alphaCount
Constructor Detail

NumeratorFormatter

NumeratorFormatter(org.w3c.dom.Element xslNumberElement,
                   TransformerImpl processor)
Construct a NumeratorFormatter using an element that contains XSL number conversion attributes - format, letter-value, xml:lang, digit-group-sep, n-digits-per-group, and sequence-src.

Parameters:
xslNumberElement - The given xsl:number element
processor - a non-null transformer instance
Method Detail

int2alphaCount

protected java.lang.String int2alphaCount(int val,
                                          char[] table)
Convert a long integer into alphabetic counting, in other words count using the sequence A B C ... Z AA AB AC.... etc.

Parameters:
val - Value to convert -- must be greater than zero.
table - a table containing one character for each digit in the radix
Returns:
String representing alpha count of number.
See Also:
Note that the radix of the conversion is inferred from the size of the table.

long2roman

java.lang.String long2roman(long val,
                            boolean prefixesAreOK)
Convert a long integer into roman numerals.

Parameters:
val - Value to convert.
prefixesAreOK - true_ to enable prefix notation (e.g. 4 = "IV"), false_ to disable prefix notation (e.g. 4 = "IIII").
Returns:
Roman numeral string.
See Also:
DecimalToRoman, m_romanConvertTable