public Class getAuxiliaryClass(String className) { if (_auxClasses == null) return null; return((Class)_auxClasses.get(className)); }
/** * Retrieves a named DecimalFormat object from _formatSymbols hashtable. */ public final DecimalFormat getDecimalFormat(String name) { if (_formatSymbols != null) { // The name cannot be null - use empty string instead if (name == null) name = EMPTYSTRING; DecimalFormat df = (DecimalFormat)_formatSymbols.get(name); if (df == null) df = (DecimalFormat)_formatSymbols.get(EMPTYSTRING); return df; } return(null); }
public int getDocumentMask(String uri) { Integer domIdx = (Integer)_documents.get(uri); if (domIdx == null) { return(-1); } else { return domIdx.intValue(); } }
public DOM getDOMAdapter(String uri) { Integer domIdx = (Integer)_documents.get(uri); if (domIdx == null) { return(null); } else { return(_adapters[domIdx.intValue()]); } }
/** * SAX2: Look up an attribute's value by qname. */ public String getValue(String qname) { if (_attributes != null) { final Integer obj = (Integer)_attributes.get(qname); if (obj == null) return null; return(getValue(obj.intValue())); } else return null; }
/** * <p>This method must be called by the code generated by the key() function * prior to returning the node iterator.</p> * <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is * <b>deprecated.</b></em></p> * @deprecated */ public void lookupKey(Object value) { IntegerArray nodes = (IntegerArray) _index.get(value); _nodes = (nodes != null) ? (IntegerArray) nodes.clone() : null; _position = 0; }
/** * Get mapping from external namespace types to DOM namespace types */ public short[] getReverseNamespaceMapping(String[] namespaces) { int i; final int length = namespaces.length; final short[] result = new short[length]; for (i = 0; i < length; i++) { int eType = getIdForNamespace(namespaces[i]); Integer type = (Integer)_nsIndex.get(new Integer(eType)); result[i] = (type == null) ? -1 : type.shortValue(); } return result; }
/** * Implements JAXP's Transformer.getParameter() * Returns the value of a given parameter. Note that the translet will not * keep values for parameters that were not defined in the stylesheet. * * @param name The name of the parameter * @return An object that contains the value assigned to the parameter */ public final Object getParameter(String name) { if (_isIdentity) { return (_parameters != null) ? _parameters.get(name) : null; } else { return _translet.getParameter(name); } }
/** * Return the node identity for a given id String * * @param idString The id String * @return The identity of the node whose id is the given String. */ public int getElementById(String idString) { Node node = _document.getElementById(idString); if (node != null) { Integer id = (Integer)_node2Ids.get(node); return (id != null) ? id.intValue() : DTM.NULL; } else { return DTM.NULL; } }
/** * Get mapping from DOM namespace types to external namespace types */ public int getNSType(int node) { String s = getNamespaceURI(node); if (s == null) { return 0; } int eType = getIdForNamespace(s); return ((Integer)_nsIndex.get(new Integer(eType))).intValue(); }
private void definePrefixAndUri(String prefix, String uri) throws SAXException { // Check if the URI already exists before pushing on stack Integer eType = new Integer(getIdForNamespace(uri)); if ((Integer)_nsIndex.get(eType) == null) { _nsIndex.put(eType, new Integer(_uriCount++)); } }
/** * Get mapping from DOM namespace types to external namespace types */ public short[] getNamespaceMapping(String[] namespaces) { int i; final int nsLength = namespaces.length; final int mappingLength = _uriCount; final short[] result = new short[mappingLength]; // Initialize all entries to -1 for (i=0; i<mappingLength; i++) { result[i] = (short)(-1); } for (i=0; i<nsLength; i++) { int eType = getIdForNamespace(namespaces[i]); Integer type = (Integer)_nsIndex.get(new Integer(eType)); if (type != null) { result[type.intValue()] = (short)i; } } return(result); }
/** * Adds an attribute to the list */ public void add(String qname, String value) { // Initialize the internal vectors at the first usage. if (_attributes == null) alloc(); // Stuff the QName into the names vector & hashtable Integer obj = (Integer)_attributes.get(qname); if (obj == null) { _attributes.put(qname, obj = new Integer(_length++)); _qnames.addElement(qname); _values.addElement(value); int col = qname.lastIndexOf(':'); if (col > -1) { _uris.addElement(qname.substring(0,col)); _names.addElement(qname.substring(col+1)); } else { _uris.addElement(EMPTYSTRING); _names.addElement(qname); } } else { final int index = obj.intValue(); _values.set(index, value); } }
/** * 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); }
/** * <p>Given a context node and the second argument to the XSLT * <code>key</code> function, checks whether the context node is in the * set of nodes that results from that reference to the <code>key</code> * function. This is used in the implementation of key patterns.</p> * <p>This particular {@link KeyIndex} object is the result evaluating the * first argument to the <code>key</code> function, so it's not taken into * any further account.</p> * * @param node The context node * @param value The second argument to the <code>key</code> function * @return <code>1</code> if and only if the context node is in the set of * nodes returned by the reference to the <code>key</code> function; * <code>0</code>, otherwise */ public int containsKey(int node, Object value) { int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Hashtable index = (Hashtable) _rootToIndexMap.get(new Integer(rootHandle)); // Check whether the context node is present in the set of nodes // returned by the key function if (index != null) { final IntegerArray nodes = (IntegerArray) index.get(value); return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0; } // The particular key name identifies no nodes in this document return 0; }
/** * 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); } } }
/** * 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); }
/** * Return an IntegerArray for the DOM Node which has the given id. * * @param id The id * @return A IntegerArray representing the Node whose id is the given value. */ public IntegerArray getDOMNodeById(String id) { IntegerArray nodes = null; if (_enhancedDOM != null) { int ident = _enhancedDOM.getElementById(id); if (ident != DTM.NULL) { Integer root = new Integer(_enhancedDOM.getDocument()); Hashtable index = (Hashtable) _rootToIndexMap.get(root); if (index == null) { index = new Hashtable(); _rootToIndexMap.put(root, index); } else { nodes = (IntegerArray) index.get(id); } if (nodes == null) { nodes = new IntegerArray(); index.put(id, nodes); } nodes.add(_enhancedDOM.getNodeHandle(ident)); } } return nodes; }
/** * Adds a node to the node list for a given value. Nodes will * always be added in document order. */ public void add(Object value, int node, int rootNode) { if (_currentDocumentNode != rootNode) { _currentDocumentNode = rootNode; _index = new Hashtable(); _rootToIndexMap.put(new Integer(rootNode), _index); } IntegerArray nodes = (IntegerArray) _index.get(value); if (nodes == null) { nodes = new IntegerArray(); _index.put(value, nodes); nodes.add(node); // Because nodes are added in document order, // duplicates can be eliminated easily at this stage. } else if (node != nodes.at(nodes.cardinality() - 1)) { nodes.add(node); } }