/** * Create an empty KeyIndex in the DOM case * @param name is the name of the index (the key or ##id) * @param dom is the DOM */ public void buildKeyIndex(String name, DOM dom) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.setDom(dom); }
/** * Adds a value to a key/id index * @param name is the name of the index (the key or ##id) * @param node is the node handle of the node to insert * @param value is the value that will look up the node in the given index */ public void buildKeyIndex(String name, int node, Object value) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.add(value, node, _currentRootForKeys); }
/** * 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. * @deprecated */ public void lookupId(Object value) { // Clear _nodes array _nodes = null; final StringTokenizer values = new StringTokenizer((String) value, " \n\t"); 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 = (IntegerArray)nodes.clone(); _nodes = nodes; } else { _nodes.merge(nodes); } } }
/** * Creates a KeyIndex object of the desired size - don't want to resize!!! */ public KeyIndex createKeyIndex() { return(new KeyIndex(_indexSize)); }
/** * This method builds key indexes - it is overridden in the compiled * translet in cases where the <xsl:key> element is used */ public void setKeyIndexDom(String name, DOM document) { getKeyIndex(name).setDom(document); }
/** * Create a {@link KeyIndexIterator} that iterates over the nodes that * result from a reference to the XSLT <code>key</code> function or * XPath <code>id</code> function. * * @param keyValue A string or iterator representing the key values or id * references * @param isKeyCall A <code>boolean</code> indicating whether the iterator * is being created for a reference <code>key</code> or * <code>id</code> */ public KeyIndexIterator getKeyIndexIterator(Object keyValue, boolean isKeyCall) { if (keyValue instanceof DTMAxisIterator) { return getKeyIndexIterator((DTMAxisIterator) keyValue, isKeyCall); } else { return getKeyIndexIterator(BasisLibrary.stringF(keyValue, _dom), isKeyCall); } }
/** * <p>Returns a deep copy of this iterator.</p> * <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is * <b>deprecated.</b></em></p> * @deprecated */ public DTMAxisIterator cloneIterator() { KeyIndex other = new KeyIndex(0); other._index = _index; other._rootToIndexMap = _rootToIndexMap; other._nodes = _nodes; other._position = _position; return (DTMAxisIterator) other; }
/** * This method builds key indexes - it is overridden in the compiled * translet in cases where the <xsl:key> element is used */ public void setKeyIndexDom(String name, DOM document) { getKeyIndex(name).setDom(document); }
/** * Create a {@link KeyIndexIterator} that iterates over the nodes that * result from a reference to the XSLT <code>key</code> function or * XPath <code>id</code> function. * * @param keyValue A string or iterator representing the key values or id * references * @param isKeyCall A <code>boolean</code> indicating whether the iterator * is being created for a reference <code>key</code> or * <code>id</code> */ public KeyIndexIterator getKeyIndexIterator(Object keyValue, boolean isKeyCall) { if (keyValue instanceof DTMAxisIterator) { return getKeyIndexIterator((DTMAxisIterator) keyValue, isKeyCall); } else { return getKeyIndexIterator(BasisLibrary.stringF(keyValue, _dom), isKeyCall); } }
/** * Create an empty KeyIndex in the DOM case * @param name is the name of the index (the key or ##id) * @param dom is the DOM */ public void buildKeyIndex(String name, DOM dom) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.setDom(dom); }
/** * Adds a value to a key/id index * @param name is the name of the index (the key or ##id) * @param node is the node handle of the node to insert * @param value is the value that will look up the node in the given index */ public void buildKeyIndex(String name, int node, Object value) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.add(value, node, _currentRootForKeys); }
/** * Returns the index for a given key (or id). * The index implements our internal iterator interface */ public KeyIndex getKeyIndex(String name) { // Return an empty key index iterator if none are defined if (_keyIndexes == null) { return (_emptyKeyIndex != null) ? _emptyKeyIndex : (_emptyKeyIndex = new KeyIndex(1)); } // Look up the requested key index final KeyIndex index = (KeyIndex)_keyIndexes.get(name); // Return an empty key index iterator if the requested index not found if (index == null) { return (_emptyKeyIndex != null) ? _emptyKeyIndex : (_emptyKeyIndex = new KeyIndex(1)); } return(index); }
nodes = getDOMNodeById(token);
/** * This method builds key indexes - it is overridden in the compiled * translet in cases where the <xsl:key> element is used */ public void setKeyIndexDom(String name, DOM document) { getKeyIndex(name).setDom(document); }
/** * Create a {@link KeyIndexIterator} that iterates over the nodes that * result from a reference to the XSLT <code>key</code> function or * XPath <code>id</code> function. * * @param keyValue A string or iterator representing the key values or id * references * @param isKeyCall A <code>boolean</code> indicating whether the iterator * is being created for a reference <code>key</code> or * <code>id</code> */ public KeyIndexIterator getKeyIndexIterator(Object keyValue, boolean isKeyCall) { if (keyValue instanceof DTMAxisIterator) { return getKeyIndexIterator((DTMAxisIterator) keyValue, isKeyCall); } else { return getKeyIndexIterator(BasisLibrary.stringF(keyValue, _dom), isKeyCall); } }
/** * Create an empty KeyIndex in the DOM case * @param name is the name of the index (the key or ##id) * @param dom is the DOM */ public void buildKeyIndex(String name, DOM dom) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.setDom(dom); }
/** * Adds a value to a key/id index * @param name is the name of the index (the key or ##id) * @param node is the node handle of the node to insert * @param value is the value that will look up the node in the given index */ public void buildKeyIndex(String name, int node, Object value) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.add(value, node, _currentRootForKeys); }
/** * Creates a KeyIndex object of the desired size - don't want to resize!!! */ public KeyIndex createKeyIndex() { return(new KeyIndex(_indexSize)); }
nodes = getDOMNodeById(token);
/** * This method builds key indexes - it is overridden in the compiled * translet in cases where the <xsl:key> element is used */ public void setKeyIndexDom(String name, DOM document) { getKeyIndex(name).setDom(document); }