org.apache.xalan.transformer
Class Counter

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

public class Counter
extends java.lang.Object

A class that does incremental counting for support of xsl:number. This class stores a cache of counted nodes (m_countNodes). It tries to cache the counted nodes in document order... the node count is based on its position in the cache list


Field Summary
(package private)  NodeSetDTM m_countNodes
          A vector of all nodes counted so far.
(package private)  int m_countNodesStartCount
          The start count from where m_countNodes counts from.
(package private)  int m_countResult
          Value to store result of last getCount call, for benifit of returning val from CountersTable.getCounterByCounted, who calls getCount.
(package private)  int m_fromNode
          The node from where the counting starts.
(package private)  ElemNumber m_numberElem
          The owning xsl:number element.
(package private) static int MAXCOUNTNODES
          Set the maximum ammount the m_countNodes list can grow to.
 
Constructor Summary
Counter(ElemNumber numberElem, NodeSetDTM countNodes)
          Construct a counter object.
 
Method Summary
(package private)  int getLast()
          Get the last node in the list.
(package private)  int getPreviouslyCounted(XPathContext support, int node)
          Try and find a node that was previously counted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXCOUNTNODES

static final int MAXCOUNTNODES
Set the maximum ammount the m_countNodes list can grow to.

See Also:
Constant Field Values

m_countNodesStartCount

int m_countNodesStartCount
The start count from where m_countNodes counts from. In other words, the count of a given node in the m_countNodes vector is node position + m_countNodesStartCount.


m_countNodes

NodeSetDTM m_countNodes
A vector of all nodes counted so far.


m_fromNode

int m_fromNode
The node from where the counting starts. This is needed to find a counter if the node being counted is not immediatly found in the m_countNodes vector.


m_numberElem

ElemNumber m_numberElem
The owning xsl:number element.


m_countResult

int m_countResult
Value to store result of last getCount call, for benifit of returning val from CountersTable.getCounterByCounted, who calls getCount.

Constructor Detail

Counter

Counter(ElemNumber numberElem,
        NodeSetDTM countNodes)
  throws javax.xml.transform.TransformerException
Construct a counter object.

Parameters:
numberElem - The owning xsl:number element.
countNodes - A vector of all nodes counted so far.
Throws:
javax.xml.transform.TransformerException
Method Detail

getPreviouslyCounted

int getPreviouslyCounted(XPathContext support,
                         int node)
Try and find a node that was previously counted. If found, return a positive integer that corresponds to the count.

Parameters:
support - The XPath context to use
node - The node to be counted.
Returns:
The count of the node, or -1 if not found.

getLast

int getLast()
Get the last node in the list.

Returns:
the last node in the list.