APIdia Launch Partner
Top Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.dom

public abstract Class NodeCounter

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.xalan.internal.xsltc.dom.SingleNodeCounter, com.sun.org.apache.xalan.internal.xsltc.dom.AnyNodeCounter, com.sun.org.apache.xalan.internal.xsltc.dom.MultipleNodeCounter
Imports
com.sun.org.apache.xalan.internal.xsltc.DOM, .Translet, com.sun.org.apache.xml.internal.dtm.DTM, .DTMAxisIterator, java.util.ArrayList, .List

Authors
Jacek Ambroziak, Santiago Pericas-Geertsen, Morten Jorgensen

Field Summary

Modifier and TypeField and Description
public final DOM
protected String
private List<String>
protected String
protected int
protected boolean
_hasFrom

Indicates if this instance of xsl:number has a from pattern.

public final DTMAxisIterator
protected String
protected String
private int
protected int
protected int
private int
private boolean
private boolean
private List<String>
private StringBuilder
public final Translet
protected double
public static final int
private static final String[]
private static final String[]
private static final String[]
private static final String[]

Constructor Summary

AccessConstructor and Description
protected
NodeCounter(Translet translet, DOM document, DTMAxisIterator iterator)

protected
NodeCounter(Translet translet, DOM document, DTMAxisIterator iterator, boolean hasFrom)

Method Summary

Modifier and TypeMethod and Description
private String
alphaValue(int value, int min, int max)

protected String
formatNumbers(int value)

Format a single value according to the format parameters.

protected String
formatNumbers(int[] values)

Format a sequence of values according to the format paramaters set by calling setFormatting().

private void
formatValue(int value, String format, StringBuilder buffer)

Format a single value based on the appropriate formatting token.

public abstract String
getCounter()

Returns the position of node according to the level and the from and count patterns.

public String
getCounter(String format, String lang, String letterValue, String groupSep, String groupSize)

Returns the position of node according to the level and the from and count patterns.

public boolean
matchesCount(int node)

Returns true if node matches the count pattern.

public boolean
matchesFrom(int node)

Returns true if node matches the from pattern.

private int

Returns:

Either an int represented by the incoming String s, or 0 if the parsing is not successful.
parseStringToAnInt
(String
A String to be parsed into an int.
s
)

Effectively does the same thing as Integer.parseInt(String s) except instead of throwing a NumberFormatException, it returns 0.

private String
romanValue(int n)

public NodeCounter
setDefaultFormatting()

Sets formatting fields to their default values.

protected void
setFormatting(String format, String lang, String letterValue, String groupSep, String groupSize)

Sets formatting fields before calling formatNumbers().

public abstract NodeCounter
setStartNode(int node)

Set the start node for this counter.

private final void
setTokens(final String format)

public NodeCounter
setValue(double value)

If the user specified a value attribute, use this instead of counting nodes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_documentback to summary
public final DOM _document
_formatback to summary
protected String _format
_formatToksback to summary
private List<String> _formatToks
_groupSepback to summary
protected String _groupSep
_groupSizeback to summary
protected int _groupSize
_hasFromback to summary
protected boolean _hasFrom

Indicates if this instance of xsl:number has a from pattern.

_iteratorback to summary
public final DTMAxisIterator _iterator
_langback to summary
protected String _lang
_letterValueback to summary
protected String _letterValue
_nFormatsback to summary
private int _nFormats
_nodeback to summary
protected int _node
_nodeTypeback to summary
protected int _nodeType
_nSeparsback to summary
private int _nSepars
_separFirstback to summary
private boolean _separFirst
_separLastback to summary
private boolean _separLast
_separToksback to summary
private List<String> _separToks
_tempBufferback to summary
private StringBuilder _tempBuffer
_transletback to summary
public final Translet _translet
_valueback to summary
protected double _value
ENDback to summary
public static final int END
Hundredsback to summary
private static final String[] Hundreds
Onesback to summary
private static final String[] Ones
Tensback to summary
private static final String[] Tens
Thousandsback to summary
private static final String[] Thousands

Constructor Detail

NodeCounterback to summary
protected NodeCounter(Translet translet, DOM document, DTMAxisIterator iterator)
NodeCounterback to summary
protected NodeCounter(Translet translet, DOM document, DTMAxisIterator iterator, boolean hasFrom)

Method Detail

alphaValueback to summary
private String alphaValue(int value, int min, int max)
formatNumbersback to summary
protected String formatNumbers(int value)

Format a single value according to the format parameters.

formatNumbersback to summary
protected String formatNumbers(int[] values)

Format a sequence of values according to the format paramaters set by calling setFormatting().

formatValueback to summary
private void formatValue(int value, String format, StringBuilder buffer)

Format a single value based on the appropriate formatting token. This method is based on saxon (Michael Kay) and only implements lang="en".

getCounterback to summary
public abstract String getCounter()

Returns the position of node according to the level and the from and count patterns.

getCounterback to summary
public String getCounter(String format, String lang, String letterValue, String groupSep, String groupSize)

Returns the position of node according to the level and the from and count patterns. This position is converted into a string based on the arguments passed.

matchesCountback to summary
public boolean matchesCount(int node)

Returns true if node matches the count pattern. By default a node matches the count patterns if it is of the same type as the starting node.

matchesFromback to summary
public boolean matchesFrom(int node)

Returns true if node matches the from pattern. By default, no node matches the from pattern.

parseStringToAnIntback to summary
private int parseStringToAnInt(String s)

Effectively does the same thing as Integer.parseInt(String s) except instead of throwing a NumberFormatException, it returns 0. This method is used instead of Integer.parseInt() since it does not incur the overhead of throwing an Exception which is expensive.

Parameters
s:String

A String to be parsed into an int.

Returns:int

Either an int represented by the incoming String s, or 0 if the parsing is not successful.

romanValueback to summary
private String romanValue(int n)
setDefaultFormattingback to summary
public NodeCounter setDefaultFormatting()

Sets formatting fields to their default values.

setFormattingback to summary
protected void setFormatting(String format, String lang, String letterValue, String groupSep, String groupSize)

Sets formatting fields before calling formatNumbers().

setStartNodeback to summary
public abstract NodeCounter setStartNode(int node)

Set the start node for this counter. The same NodeCounter object can be used multiple times by resetting the starting node.

setTokensback to summary
private final void setTokens(final String format)
setValueback to summary
public NodeCounter setValue(double value)

If the user specified a value attribute, use this instead of counting nodes.