/** * Returns clone of current IntVector * * @return clone of current IntVector */ public Object clone() throws CloneNotSupportedException { return new IntVector(this); }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** * Returns clone of current IntStack * * @return clone of current IntStack */ public Object clone() throws CloneNotSupportedException { return (IntStack) super.clone(); } }
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { if (m_last == -1) { int node; while ((node = m_iter.next()) != DTMAxisIterator.END) { m_cachedNodes.addElement(node); } m_last = m_cachedNodes.size(); } return m_last; } }
if (m_iter != null) { int node; int count = m_cachedNodes.size(); node = m_cachedNodes.elementAt(index); return m_dtm.getNode(node); } else if (m_last == -1) { while (((node = m_iter.next()) != DTMAxisIterator.END) && count <= index) { m_cachedNodes.addElement(node); count++;
public void removeAllElements() { m_intToString.removeAllElements(); for(int i=0;i<HASHPRIME;++i) m_hashStart[i]=NULL; m_hashChain.removeAllElements(); }
/** * Store the source location of the current node. This method must be called * as every node is added to the DTM or for no node. */ protected void setSourceLocation() { m_sourceSystemId.addElement(m_locator.getSystemId()); m_sourceLine.addElement(m_locator.getLineNumber()); m_sourceColumn.addElement(m_locator.getColumnNumber()); //%REVIEW% %BUG% Prevent this from arising in the first place // by not allowing the enabling conditions to change after we start // building the document. if (m_sourceSystemId.size() != m_size) { String msg = "CODING ERROR in Source Location: " + m_size + " != " + m_sourceSystemId.size(); System.err.println(msg); throw new RuntimeException(msg); } }
/** Retrieve the SourceLocator associated with a specific node. * This is only meaningful if the XalanProperties.SOURCE_LOCATION flag was * set True using setProperty; if it was never set, or was set false, we * will return null. * * (We _could_ return a locator with the document's base URI and bogus * line/column information. Trying that; see the else clause.) * */ public SourceLocator getSourceLocatorFor(int node) { if (m_useSourceLocationProperty) { node = makeNodeIdentity(node); return new NodeLocator(null, m_sourceSystemId.elementAt(node), m_sourceLine.elementAt(node), m_sourceColumn.elementAt(node)); } else if(m_locator!=null) { return new NodeLocator(null,m_locator.getSystemId(),-1,-1); } else if(m_systemId!=null) { return new NodeLocator(null,m_systemId,-1,-1); } return null; }
/** * Returns where an object is on this stack. * * @param o the desired object. * @return the distance from the top of the stack where the object is] * located; the return value <code>-1</code> indicates that the * object is not on the stack. * @since JDK1.0 */ public int search(int o) { int i = lastIndexOf(o); if (i >= 0) { return size() - i; } return -1; }
if (m_iter != null) { int node; int count = m_cachedNodes.size(); node = m_cachedNodes.elementAt(index); return m_dtm.getNode(node); } else if (m_last == -1) { while (((node = m_iter.next()) != DTMAxisIterator.END) && count <= index) { m_cachedNodes.addElement(node); count++;
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { if (m_last == -1) { int node; while ((node = m_iter.next()) != DTMAxisIterator.END) { m_cachedNodes.addElement(node); } m_last = m_cachedNodes.size(); } return m_last; } }
public void removeAllElements() { m_intToString.removeAllElements(); for(int i=0;i<HASHPRIME;++i) m_hashStart[i]=NULL; m_hashChain.removeAllElements(); }
/** * Store the source location of the current node. This method must be called * as every node is added to the DTM or for no node. */ protected void setSourceLocation() { m_sourceSystemId.addElement(m_locator.getSystemId()); m_sourceLine.addElement(m_locator.getLineNumber()); m_sourceColumn.addElement(m_locator.getColumnNumber()); //%REVIEW% %BUG% Prevent this from arising in the first place // by not allowing the enabling conditions to change after we start // building the document. if (m_sourceSystemId.size() != m_size) { String msg = "CODING ERROR in Source Location: " + m_size + " != " + m_sourceSystemId.size(); System.err.println(msg); throw new RuntimeException(msg); } }
/** Retrieve the SourceLocator associated with a specific node. * This is only meaningful if the XalanProperties.SOURCE_LOCATION flag was * set True using setProperty; if it was never set, or was set false, we * will return null. * * (We _could_ return a locator with the document's base URI and bogus * line/column information. Trying that; see the else clause.) * */ public SourceLocator getSourceLocatorFor(int node) { if (m_useSourceLocationProperty) { node = makeNodeIdentity(node); return new NodeLocator(null, m_sourceSystemId.elementAt(node), m_sourceLine.elementAt(node), m_sourceColumn.elementAt(node)); } else if(m_locator!=null) { return new NodeLocator(null,m_locator.getSystemId(),-1,-1); } else if(m_systemId!=null) { return new NodeLocator(null,m_systemId,-1,-1); } return null; }
/** * Returns where an object is on this stack. * * @param o the desired object. * @return the distance from the top of the stack where the object is] * located; the return value <code>-1</code> indicates that the * object is not on the stack. * @since JDK1.0 */ public int search(int o) { int i = lastIndexOf(o); if (i >= 0) { return size() - i; } return -1; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
if (m_iter != null) { int node; int count = m_cachedNodes.size(); node = m_cachedNodes.elementAt(index); return m_dtm.getNode(node); } else if (m_last == -1) { while (((node = m_iter.next()) != DTMAxisIterator.END) && count <= index) { m_cachedNodes.addElement(node); count++;
/** * The number of nodes in the list. The range of valid child node indices * is 0 to <code>length-1</code> inclusive. */ public int getLength() { if (m_last == -1) { int node; while ((node = m_iter.next()) != DTMAxisIterator.END) { m_cachedNodes.addElement(node); } m_last = m_cachedNodes.size(); } return m_last; } }
/** * Public constructor: Wrap a DTMNodeList around an existing * and preconfigured DTMAxisIterator */ public DTMAxisIterNodeList(DTM dtm, DTMAxisIterator dtmAxisIterator) { if (dtmAxisIterator == null) { m_last = 0; } else { m_cachedNodes = new IntVector(); m_dtm = dtm; } m_iter = dtmAxisIterator; }
public void removeAllElements() { m_intToString.removeAllElements(); for(int i=0;i<HASHPRIME;++i) m_hashStart[i]=NULL; m_hashChain.removeAllElements(); }