org.apache.xalan.xsltc.dom
Class KeyIndex

java.lang.Object
  extended by org.apache.xml.dtm.ref.DTMAxisIteratorBase
      extended by org.apache.xalan.xsltc.dom.KeyIndex
All Implemented Interfaces:
java.lang.Cloneable, DTMAxisIterator

public class KeyIndex
extends DTMAxisIteratorBase

Author:
Morten Jorgensen, Santiago Pericas-Geertsen

Field Summary
 
Fields inherited from interface org.apache.xml.dtm.DTMAxisIterator
END
 
Constructor Summary
KeyIndex(int dummy)
           
 
Method Summary
 void add(java.lang.Object value, int node)
          Adds a node to the node list for a given value.
 DTMAxisIterator cloneIterator()
          Returns a deep copy of this iterator.
 int containsID(int node, java.lang.Object value)
           
 int containsKey(int node, java.lang.Object value)
           
 IntegerArray getDOMNodeById(java.lang.String id)
          Return an IntegerArray for the DOM Node which has the given id.
 int getLast()
          Returns the number of elements in this iterator.
 int getPosition()
          Returns the position of the current node in the set.
 int getStartNode()
          Get start to END should 'close' the iterator, i.e. subsequent call to next() should return END.
 void gotoMark()
          Restores the current node remembered by setMark().
 boolean isReverse()
          True if this iterator has a reversed axis.
 void lookupId(java.lang.Object value)
          This method must be called by the code generated by the id() function prior to returning the node iterator.
 void lookupKey(java.lang.Object value)
          This method must be called by the code generated by the key() function prior to returning the node iterator.
 void merge(KeyIndex other)
          Merge the current value's nodeset set by lookupKey() with _nodes.
 int next()
          Callers should not call next() after it returns END.
 DTMAxisIterator reset()
          Resets the iterator to the last start node.
 void setDom(DOM dom)
           
 void setMark()
          Remembers the current node for the next call to gotoMark().
 void setRestartable(boolean flag)
          Set if restartable.
 DTMAxisIterator setStartNode(int start)
          Set start to END should 'close' the iterator, i.e. subsequent call to next() should return END.
 
Methods inherited from class org.apache.xml.dtm.ref.DTMAxisIteratorBase
getAxis, getNodeByPosition, includeSelf, isDocOrdered
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyIndex

public KeyIndex(int dummy)
Method Detail

setRestartable

public void setRestartable(boolean flag)
Description copied from interface: DTMAxisIterator
Set if restartable.

Specified by:
setRestartable in interface DTMAxisIterator
Overrides:
setRestartable in class DTMAxisIteratorBase

add

public void add(java.lang.Object value,
                int node)
Adds a node to the node list for a given value. Nodes will always be added in document order.


merge

public void merge(KeyIndex other)
Merge the current value's nodeset set by lookupKey() with _nodes.


lookupId

public void lookupId(java.lang.Object value)
This method must be called by the code generated by the id() function prior to returning the node iterator. The lookup code for key() and id() differ in the way the lookup value can be whitespace separated list of tokens for the id() function, but a single string for the key() function.


getDOMNodeById

public IntegerArray getDOMNodeById(java.lang.String id)
Return an IntegerArray for the DOM Node which has the given id.

Parameters:
id - The id
Returns:
A IntegerArray representing the Node whose id is the given value.

lookupKey

public void lookupKey(java.lang.Object value)
This method must be called by the code generated by the key() function prior to returning the node iterator.


next

public int next()
Callers should not call next() after it returns END.

Returns:
The next node handle in the iteration, or END.

containsID

public int containsID(int node,
                      java.lang.Object value)

containsKey

public int containsKey(int node,
                       java.lang.Object value)

reset

public DTMAxisIterator reset()
Resets the iterator to the last start node.

Specified by:
reset in interface DTMAxisIterator
Overrides:
reset in class DTMAxisIteratorBase
Returns:
A DTMAxisIterator which has been reset to the start node, which may or may not be the same as this iterator.

getLast

public int getLast()
Returns the number of elements in this iterator.

Specified by:
getLast in interface DTMAxisIterator
Overrides:
getLast in class DTMAxisIteratorBase
Returns:
The number of nodes in this iterator (forward) or 1 (reverse).

getPosition

public int getPosition()
Returns the position of the current node in the set.

Specified by:
getPosition in interface DTMAxisIterator
Overrides:
getPosition in class DTMAxisIteratorBase
Returns:
The position of the current node within the set, as defined by XPath. Note that this is one-based, not zero-based.

setMark

public void setMark()
Remembers the current node for the next call to gotoMark().


gotoMark

public void gotoMark()
Restores the current node remembered by setMark().


setStartNode

public DTMAxisIterator setStartNode(int start)
Set start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

Parameters:
start - Sets the root of the iteration.
Returns:
A DTMAxisIterator set to the start of the iteration.

getStartNode

public int getStartNode()
Get start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

Specified by:
getStartNode in interface DTMAxisIterator
Overrides:
getStartNode in class DTMAxisIteratorBase
Returns:
The root node of the iteration.

isReverse

public boolean isReverse()
True if this iterator has a reversed axis.

Specified by:
isReverse in interface DTMAxisIterator
Overrides:
isReverse in class DTMAxisIteratorBase
Returns:
true if this iterator has a reversed axis, else false

cloneIterator

public DTMAxisIterator cloneIterator()
Returns a deep copy of this iterator.

Specified by:
cloneIterator in interface DTMAxisIterator
Overrides:
cloneIterator in class DTMAxisIteratorBase
Returns:
a deep copy of this iterator.

setDom

public void setDom(DOM dom)


Copyright ? 2005 Apache XML Project. All Rights Reserved.