Methods Summary |
---|
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.
IntegerArray nodes;
if ((nodes = (IntegerArray) _index.get(value)) == null) {
_index.put(value, nodes = new IntegerArray());
}
nodes.add(node);
|
public com.sun.org.apache.xml.internal.dtm.DTMAxisIterator | cloneIterator()Returns a deep copy of this iterator.
KeyIndex other = new KeyIndex(0);
other._index = _index;
other._nodes = _nodes;
other._position = _position;
return (DTMAxisIterator) other;
|
public int | containsID(int node, java.lang.Object value)
final String string = (String)value;
if (string.indexOf(' ") > -1) {
final StringTokenizer values = new StringTokenizer(string);
while (values.hasMoreElements()) {
final String token = (String) values.nextElement();
IntegerArray nodes = (IntegerArray) _index.get(token);
if (nodes == null && _enhancedDOM != null
&& _enhancedDOM.hasDOMSource()) {
nodes = getDOMNodeById(token);
}
if (nodes != null && nodes.indexOf(node) >= 0) {
return 1;
}
}
return 0;
}
else {
IntegerArray nodes = (IntegerArray) _index.get(value);
if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) {
nodes = getDOMNodeById(string);
}
return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
}
|
public int | containsKey(int node, java.lang.Object value)
final IntegerArray nodes = (IntegerArray) _index.get(value);
return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
|
public com.sun.org.apache.xalan.internal.xsltc.util.IntegerArray | getDOMNodeById(java.lang.String id)Return an IntegerArray for the DOM Node which has the given id.
IntegerArray nodes = null;
if (_enhancedDOM != null) {
int ident = _enhancedDOM.getElementById(id);
if (ident != DTM.NULL) {
nodes = new IntegerArray();
_index.put(id, nodes);
nodes.add(ident);
}
}
return nodes;
|
public int | getLast()Returns the number of elements in this iterator.
return (_nodes == null) ? 0 : _nodes.cardinality();
|
public int | getPosition()Returns the position of the current node in the set.
return _position;
|
public int | getStartNode()Get start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
return 0;
|
public void | gotoMark()Restores the current node remembered by setMark().
_position = _markedPosition;
|
public boolean | isReverse()True if this iterator has a reversed axis.
return(false);
|
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.
// Clear _nodes array
_nodes = null;
final StringTokenizer values = new StringTokenizer((String) value);
while (values.hasMoreElements()) {
final String token = (String) values.nextElement();
IntegerArray nodes = (IntegerArray) _index.get(token);
if (nodes == null && _enhancedDOM != null
&& _enhancedDOM.hasDOMSource()) {
nodes = getDOMNodeById(token);
}
if (nodes == null) continue;
if (_nodes == null) {
_nodes = nodes;
}
else {
_nodes.merge(nodes);
}
}
|
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.
_nodes = (IntegerArray) _index.get(value);
_position = 0;
|
public void | merge(com.sun.org.apache.xalan.internal.xsltc.dom.KeyIndex other)Merge the current value's nodeset set by lookupKey() with _nodes.
if (other == null) return;
if (other._nodes != null) {
if (_nodes == null) {
_nodes = other._nodes;
}
else {
_nodes.merge(other._nodes);
}
}
|
public int | next()Callers should not call next() after it returns END.
if (_nodes == null) return DTMAxisIterator.END;
return (_position < _nodes.cardinality()) ?
_dom.getNodeHandle(_nodes.at(_position++)) : DTMAxisIterator.END;
|
public com.sun.org.apache.xml.internal.dtm.DTMAxisIterator | reset()Resets the iterator to the last start node.
_position = 0;
return this;
|
public void | setDom(com.sun.org.apache.xalan.internal.xsltc.DOM dom)
_dom = dom;
if (dom instanceof DOMEnhancedForDTM) {
_enhancedDOM = (DOMEnhancedForDTM)dom;
}
else if (dom instanceof DOMAdapter) {
DOM idom = ((DOMAdapter)dom).getDOMImpl();
if (idom instanceof DOMEnhancedForDTM) {
_enhancedDOM = (DOMEnhancedForDTM)idom;
}
}
|
public void | setMark()Remembers the current node for the next call to gotoMark().
_markedPosition = _position;
|
public void | setRestartable(boolean flag)
|
public com.sun.org.apache.xml.internal.dtm.DTMAxisIterator | setStartNode(int start)Set start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
if (start == DTMAxisIterator.END) {
_nodes = null;
}
else if (_nodes != null) {
_position = 0;
}
return (DTMAxisIterator) this;
|