code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
833 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public int hashCode() { return hash; }
Override the hashCode() method in the Object class
ExtendedType::hashCode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
Apache-2.0
public boolean equals(ExtendedType other) { try { return other.nodetype == this.nodetype && other.localName.equals(this.localName) && other.namespace.equals(this.namespace); } catch(NullPointerException e) { return false; } }
Test if this ExtendedType object is equal to the given ExtendedType. @param other The other ExtendedType object to test for equality @return true if the two ExtendedType objects are equal.
ExtendedType::equals
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
Apache-2.0
public int getNodeType() { return nodetype; }
Return the node type
ExtendedType::getNodeType
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
Apache-2.0
public String getLocalName() { return localName; }
Return the local name
ExtendedType::getLocalName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
Apache-2.0
public String getNamespace() { return namespace; }
Return the namespace
ExtendedType::getNamespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExtendedType.java
Apache-2.0
public DTMDefaultBase(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { this(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, DEFAULT_BLOCKSIZE, true, false); }
Construct a DTMDefaultBase object using the default block size. @param mgr The DTMManager who owns this DTM. @param source The object that is used to specify the construction source. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory The factory to use for creating XMLStrings. @param doIndexing true if the caller considers it worth it to use indexing schemes.
DTMDefaultBase::DTMDefaultBase
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public DTMDefaultBase(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable) { // Use smaller sizes for the internal node arrays if the block size // is small. int numblocks; if (blocksize <= 64) { numblocks = DEFAULT_NUMBLOCKS_SMALL; m_dtmIdent= new SuballocatedIntVector(4, 1); } else { numblocks = DEFAULT_NUMBLOCKS; m_dtmIdent= new SuballocatedIntVector(32); } m_exptype = new SuballocatedIntVector(blocksize, numblocks); m_firstch = new SuballocatedIntVector(blocksize, numblocks); m_nextsib = new SuballocatedIntVector(blocksize, numblocks); m_parent = new SuballocatedIntVector(blocksize, numblocks); // Only create the m_prevsib array if the usePrevsib flag is true. // Some DTM implementations (e.g. SAXImpl) do not need this array. // We can save the time to build it in those cases. if (usePrevsib) m_prevsib = new SuballocatedIntVector(blocksize, numblocks); m_mgr = mgr; if(mgr instanceof DTMManagerDefault) m_mgrDefault=(DTMManagerDefault)mgr; m_documentBaseURI = (null != source) ? source.getSystemId() : null; m_dtmIdent.setElementAt(dtmIdentity,0); m_wsfilter = whiteSpaceFilter; m_xstrf = xstringfactory; m_indexing = doIndexing; if (doIndexing) { m_expandedNameTable = new ExpandedNameTable(); } else { // Note that this fails if we aren't talking to an instance of // DTMManagerDefault m_expandedNameTable = m_mgrDefault.getExpandedNameTable(this); } if (null != whiteSpaceFilter) { m_shouldStripWhitespaceStack = new BoolStack(); pushShouldStripWhitespace(false); } }
Construct a DTMDefaultBase object from a DOM node. @param mgr The DTMManager who owns this DTM. @param source The object that is used to specify the construction source. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory The factory to use for creating XMLStrings. @param doIndexing true if the caller considers it worth it to use indexing schemes. @param blocksize The block size of the DTM. @param usePrevsib true if we want to build the previous sibling node array. @param newNameTable true if we want to use a new ExpandedNameTable for this DTM.
DTMDefaultBase::DTMDefaultBase
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void ensureSizeOfIndex(int namespaceID, int LocalNameID) { if (null == m_elemIndexes) { m_elemIndexes = new int[namespaceID + 20][][]; } else if (m_elemIndexes.length <= namespaceID) { int[][][] indexes = m_elemIndexes; m_elemIndexes = new int[namespaceID + 20][][]; System.arraycopy(indexes, 0, m_elemIndexes, 0, indexes.length); } int[][] localNameIndex = m_elemIndexes[namespaceID]; if (null == localNameIndex) { localNameIndex = new int[LocalNameID + 100][]; m_elemIndexes[namespaceID] = localNameIndex; } else if (localNameIndex.length <= LocalNameID) { int[][] indexes = localNameIndex; localNameIndex = new int[LocalNameID + 100][]; System.arraycopy(indexes, 0, localNameIndex, 0, indexes.length); m_elemIndexes[namespaceID] = localNameIndex; } int[] elemHandles = localNameIndex[LocalNameID]; if (null == elemHandles) { elemHandles = new int[128]; localNameIndex[LocalNameID] = elemHandles; elemHandles[0] = 1; } else if (elemHandles.length <= elemHandles[0] + 1) { int[] indexes = elemHandles; elemHandles = new int[elemHandles[0] + 1024]; System.arraycopy(indexes, 0, elemHandles, 0, indexes.length); localNameIndex[LocalNameID] = elemHandles; } }
Ensure that the size of the element indexes can hold the information. @param namespaceID Namespace ID index. @param LocalNameID Local name ID.
DTMDefaultBase::ensureSizeOfIndex
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void indexNode(int expandedTypeID, int identity) { ExpandedNameTable ent = m_expandedNameTable; short type = ent.getType(expandedTypeID); if (DTM.ELEMENT_NODE == type) { int namespaceID = ent.getNamespaceID(expandedTypeID); int localNameID = ent.getLocalNameID(expandedTypeID); ensureSizeOfIndex(namespaceID, localNameID); int[] index = m_elemIndexes[namespaceID][localNameID]; index[index[0]] = identity; index[0]++; } }
Add a node to the element indexes. The node will not be added unless it's an element. @param expandedTypeID The expanded type ID of the node. @param identity The node identity index.
DTMDefaultBase::indexNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int findGTE(int[] list, int start, int len, int value) { int low = start; int high = start + (len - 1); int end = high; while (low <= high) { int mid = (low + high) / 2; int c = list[mid]; if (c > value) high = mid - 1; else if (c < value) low = mid + 1; else return mid; } return (low <= end && list[low] > value) ? low : -1; }
Find the first index that occurs in the list that is greater than or equal to the given value. @param list A list of integers. @param start The start index to begin the search. @param len The number of items to search. @param value Find the slot that has a value that is greater than or identical to this argument. @return The index in the list of the slot that is higher or identical to the identity argument, or -1 if no node is higher or equal.
DTMDefaultBase::findGTE
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
int findElementFromIndex(int nsIndex, int lnIndex, int firstPotential) { int[][][] indexes = m_elemIndexes; if (null != indexes && nsIndex < indexes.length) { int[][] lnIndexs = indexes[nsIndex]; if (null != lnIndexs && lnIndex < lnIndexs.length) { int[] elems = lnIndexs[lnIndex]; if (null != elems) { int pos = findGTE(elems, 1, elems[0], firstPotential); if (pos > -1) { return elems[pos]; } } } } return NOTPROCESSED; }
Find the first matching element from the index at or after the given node. @param nsIndex The namespace index lookup. @param lnIndex The local name index lookup. @param firstPotential The first potential match that is worth looking at. @return The first node that is greater than or equal to the firstPotential argument, or DTM.NOTPROCESSED if not found.
DTMDefaultBase::findElementFromIndex
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected short _type(int identity) { int info = _exptype(identity); if (NULL != info) return m_expandedNameTable.getType(info); else return NULL; }
Get the simple type ID for the given node identity. @param identity The node identity. @return The simple type ID, or DTM.NULL.
DTMDefaultBase::_type
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int _exptype(int identity) { if (identity == DTM.NULL) return NULL; // Reorganized test and loop into single flow // Tiny performance improvement, saves a few bytes of code, clearer. // %OPT% Other internal getters could be treated simliarly while (identity>=m_size) { if (!nextNode() && identity >= m_size) return NULL; } return m_exptype.elementAt(identity); }
Get the expanded type ID for the given node identity. @param identity The node identity. @return The expanded type ID, or DTM.NULL.
DTMDefaultBase::_exptype
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int _level(int identity) { while (identity>=m_size) { boolean isMore = nextNode(); if (!isMore && identity >= m_size) return NULL; } int i=0; while(NULL != (identity=_parent(identity))) ++i; return i; }
Get the level in the tree for the given node identity. @param identity The node identity. @return The tree level, or DTM.NULL.
DTMDefaultBase::_level
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int _firstch(int identity) { // Boiler-plate code for each of the _xxx functions, except for the array. int info = (identity >= m_size) ? NOTPROCESSED : m_firstch.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (info == NOTPROCESSED) { boolean isMore = nextNode(); if (identity >= m_size &&!isMore) return NULL; else { info = m_firstch.elementAt(identity); if(info == NOTPROCESSED && !isMore) return NULL; } } return info; }
Get the first child for the given node identity. @param identity The node identity. @return The first child identity, or DTM.NULL.
DTMDefaultBase::_firstch
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int _nextsib(int identity) { // Boiler-plate code for each of the _xxx functions, except for the array. int info = (identity >= m_size) ? NOTPROCESSED : m_nextsib.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (info == NOTPROCESSED) { boolean isMore = nextNode(); if (identity >= m_size &&!isMore) return NULL; else { info = m_nextsib.elementAt(identity); if(info == NOTPROCESSED && !isMore) return NULL; } } return info; }
Get the next sibling for the given node identity. @param identity The node identity. @return The next sibling identity, or DTM.NULL.
DTMDefaultBase::_nextsib
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int _prevsib(int identity) { if (identity < m_size) return m_prevsib.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (identity >= m_size && !isMore) return NULL; else if (identity < m_size) return m_prevsib.elementAt(identity); } }
Get the previous sibling for the given node identity. @param identity The node identity. @return The previous sibling identity, or DTM.NULL.
DTMDefaultBase::_prevsib
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int _parent(int identity) { if (identity < m_size) return m_parent.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (identity >= m_size && !isMore) return NULL; else if (identity < m_size) return m_parent.elementAt(identity); } }
Get the parent for the given node identity. @param identity The node identity. @return The parent identity, or DTM.NULL.
DTMDefaultBase::_parent
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public void dumpDTM(OutputStream os) { try { if(os==null) { File f = new File("DTMDump"+((Object)this).hashCode()+".txt"); System.err.println("Dumping... "+f.getAbsolutePath()); os=new FileOutputStream(f); } PrintStream ps = new PrintStream(os); while (nextNode()){} int nRecords = m_size; ps.println("Total nodes: " + nRecords); for (int index = 0; index < nRecords; ++index) { int i=makeNodeHandle(index); ps.println("=========== index=" + index + " handle=" + i + " ==========="); ps.println("NodeName: " + getNodeName(i)); ps.println("NodeNameX: " + getNodeNameX(i)); ps.println("LocalName: " + getLocalName(i)); ps.println("NamespaceURI: " + getNamespaceURI(i)); ps.println("Prefix: " + getPrefix(i)); int exTypeID = _exptype(index); ps.println("Expanded Type ID: " + Integer.toHexString(exTypeID)); int type = _type(index); String typestring; switch (type) { case DTM.ATTRIBUTE_NODE : typestring = "ATTRIBUTE_NODE"; break; case DTM.CDATA_SECTION_NODE : typestring = "CDATA_SECTION_NODE"; break; case DTM.COMMENT_NODE : typestring = "COMMENT_NODE"; break; case DTM.DOCUMENT_FRAGMENT_NODE : typestring = "DOCUMENT_FRAGMENT_NODE"; break; case DTM.DOCUMENT_NODE : typestring = "DOCUMENT_NODE"; break; case DTM.DOCUMENT_TYPE_NODE : typestring = "DOCUMENT_NODE"; break; case DTM.ELEMENT_NODE : typestring = "ELEMENT_NODE"; break; case DTM.ENTITY_NODE : typestring = "ENTITY_NODE"; break; case DTM.ENTITY_REFERENCE_NODE : typestring = "ENTITY_REFERENCE_NODE"; break; case DTM.NAMESPACE_NODE : typestring = "NAMESPACE_NODE"; break; case DTM.NOTATION_NODE : typestring = "NOTATION_NODE"; break; case DTM.NULL : typestring = "NULL"; break; case DTM.PROCESSING_INSTRUCTION_NODE : typestring = "PROCESSING_INSTRUCTION_NODE"; break; case DTM.TEXT_NODE : typestring = "TEXT_NODE"; break; default : typestring = "Unknown!"; break; } ps.println("Type: " + typestring); int firstChild = _firstch(index); if (DTM.NULL == firstChild) ps.println("First child: DTM.NULL"); else if (NOTPROCESSED == firstChild) ps.println("First child: NOTPROCESSED"); else ps.println("First child: " + firstChild); if (m_prevsib != null) { int prevSibling = _prevsib(index); if (DTM.NULL == prevSibling) ps.println("Prev sibling: DTM.NULL"); else if (NOTPROCESSED == prevSibling) ps.println("Prev sibling: NOTPROCESSED"); else ps.println("Prev sibling: " + prevSibling); } int nextSibling = _nextsib(index); if (DTM.NULL == nextSibling) ps.println("Next sibling: DTM.NULL"); else if (NOTPROCESSED == nextSibling) ps.println("Next sibling: NOTPROCESSED"); else ps.println("Next sibling: " + nextSibling); int parent = _parent(index); if (DTM.NULL == parent) ps.println("Parent: DTM.NULL"); else if (NOTPROCESSED == parent) ps.println("Parent: NOTPROCESSED"); else ps.println("Parent: " + parent); int level = _level(index); ps.println("Level: " + level); ps.println("Node Value: " + getNodeValue(i)); ps.println("String Value: " + getStringValue(i)); } } catch(IOException ioe) { ioe.printStackTrace(System.err); throw new RuntimeException(ioe.getMessage()); } }
Diagnostics function to dump the DTM.
DTMDefaultBase::dumpDTM
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public String dumpNode(int nodeHandle) { if(nodeHandle==DTM.NULL) return "[null]"; String typestring; switch (getNodeType(nodeHandle)) { case DTM.ATTRIBUTE_NODE : typestring = "ATTR"; break; case DTM.CDATA_SECTION_NODE : typestring = "CDATA"; break; case DTM.COMMENT_NODE : typestring = "COMMENT"; break; case DTM.DOCUMENT_FRAGMENT_NODE : typestring = "DOC_FRAG"; break; case DTM.DOCUMENT_NODE : typestring = "DOC"; break; case DTM.DOCUMENT_TYPE_NODE : typestring = "DOC_TYPE"; break; case DTM.ELEMENT_NODE : typestring = "ELEMENT"; break; case DTM.ENTITY_NODE : typestring = "ENTITY"; break; case DTM.ENTITY_REFERENCE_NODE : typestring = "ENT_REF"; break; case DTM.NAMESPACE_NODE : typestring = "NAMESPACE"; break; case DTM.NOTATION_NODE : typestring = "NOTATION"; break; case DTM.NULL : typestring = "null"; break; case DTM.PROCESSING_INSTRUCTION_NODE : typestring = "PI"; break; case DTM.TEXT_NODE : typestring = "TEXT"; break; default : typestring = "Unknown!"; break; } StringBuffer sb=new StringBuffer(); sb.append("["+nodeHandle+": "+typestring+ "(0x"+Integer.toHexString(getExpandedTypeID(nodeHandle))+") "+ getNodeNameX(nodeHandle)+" {"+getNamespaceURI(nodeHandle)+"}"+ "=\""+ getNodeValue(nodeHandle)+"\"]"); return sb.toString(); }
Diagnostics function to dump a single node. %REVIEW% KNOWN GLITCH: If you pass it a node index rather than a node handle, it works just fine... but the displayed identity number before the colon is different, which complicates comparing it with nodes printed the other way. We could always OR the DTM ID into the value, to suppress that distinction... %REVIEW% This might want to be moved up to DTMDefaultBase, or possibly DTM itself, since it's a useful diagnostic and uses only DTM's public APIs.
DTMDefaultBase::dumpNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public boolean hasChildNodes(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int firstChild = _firstch(identity); return firstChild != DTM.NULL; }
Given a node handle, test if it has child nodes. <p> %REVIEW% This is obviously useful at the DOM layer, where it would permit testing this without having to create a proxy node. It's less useful in the DTM API, where (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and almost as self-evident. But it's a convenience, and eases porting of DOM code to DTM. </p> @param nodeHandle int Handle of the node. @return int true if the given node has child nodes.
DTMDefaultBase::hasChildNodes
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
final public int makeNodeHandle(int nodeIdentity) { if(NULL==nodeIdentity) return NULL; if(JJK_DEBUG && nodeIdentity>DTMManager.IDENT_NODE_DEFAULT) System.err.println("GONK! (only useful in limited situations)"); return m_dtmIdent.elementAt(nodeIdentity >>> DTMManager.IDENT_DTM_NODE_BITS) + (nodeIdentity & DTMManager.IDENT_NODE_DEFAULT) ; }
Given a node identity, return a node handle. If extended addressing has been used (multiple DTM IDs), we need to map the high bits of the identity into the proper DTM ID. This has been made FINAL to facilitate inlining, since we do not expect any subclass of DTMDefaultBase to ever change the algorithm. (I don't really like doing so, and would love to have an excuse not to...) %REVIEW% Is it worth trying to specialcase small documents? %REVIEW% Should this be exposed at the package/public layers? @param nodeIdentity Internal offset to this node's records. @return NodeHandle (external representation of node) *
DTMDefaultBase::makeNodeHandle
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
final public int makeNodeIdentity(int nodeHandle) { if(NULL==nodeHandle) return NULL; if(m_mgrDefault!=null) { // Optimization: use the DTMManagerDefault's fast DTMID-to-offsets // table. I'm not wild about this solution but this operation // needs need extreme speed. int whichDTMindex=nodeHandle>>>DTMManager.IDENT_DTM_NODE_BITS; // %REVIEW% Wish I didn't have to perform the pre-test, but // someone is apparently asking DTMs whether they contain nodes // which really don't belong to them. That's probably a bug // which should be fixed, but until it is: if(m_mgrDefault.m_dtms[whichDTMindex]!=this) return NULL; else return m_mgrDefault.m_dtm_offsets[whichDTMindex] | (nodeHandle & DTMManager.IDENT_NODE_DEFAULT); } int whichDTMid=m_dtmIdent.indexOf(nodeHandle & DTMManager.IDENT_DTM_DEFAULT); return (whichDTMid==NULL) ? NULL : (whichDTMid << DTMManager.IDENT_DTM_NODE_BITS) + (nodeHandle & DTMManager.IDENT_NODE_DEFAULT); }
Given a node handle, return a node identity. If extended addressing has been used (multiple DTM IDs), we need to map the high bits of the identity into the proper DTM ID and thence find the proper offset to add to the low bits of the identity This has been made FINAL to facilitate inlining, since we do not expect any subclass of DTMDefaultBase to ever change the algorithm. (I don't really like doing so, and would love to have an excuse not to...) %OPT% Performance is critical for this operation. %REVIEW% Should this be exposed at the package/public layers? @param nodeHandle (external representation of node) @return nodeIdentity Internal offset to this node's records. *
DTMDefaultBase::makeNodeIdentity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getFirstAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); return makeNodeHandle(getFirstAttributeIdentity(nodeID)); }
Given a node handle, get the index of the node's first attribute. @param nodeHandle int Handle of the node. @return Handle of first attribute, or DTM.NULL to indicate none exists.
DTMDefaultBase::getFirstAttribute
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int getFirstAttributeIdentity(int identity) { int type = _type(identity); if (DTM.ELEMENT_NODE == type) { // Assume that attributes and namespaces immediately follow the element. while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { // Assume this can not be null. type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; }
Given a node identity, get the index of the node's first attribute. @param identity int identity of the node. @return Identity of first attribute, or DTM.NULL to indicate none exists.
DTMDefaultBase::getFirstAttributeIdentity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int getTypedAttribute(int nodeHandle, int attType) { int type = getNodeType(nodeHandle); if (DTM.ELEMENT_NODE == type) { int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { if (_exptype(identity) == attType) return makeNodeHandle(identity); } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; }
Given a node handle and an expanded type ID, get the index of the node's attribute of that type, if any. @param nodeHandle int Handle of the node. @param attType int expanded type ID of the required attribute. @return Handle of attribute of the required type, or DTM.NULL to indicate none exists.
DTMDefaultBase::getTypedAttribute
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getNextSibling(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return makeNodeHandle(_nextsib(makeNodeIdentity(nodeHandle))); }
Given a node handle, advance to its next sibling. If not yet resolved, waits for more nodes to be added to the document and tries again. @param nodeHandle int Handle of the node. @return int Node-number of next sibling, or DTM.NULL to indicate none exists.
DTMDefaultBase::getNextSibling
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getNextAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); if (_type(nodeID) == DTM.ATTRIBUTE_NODE) { return makeNodeHandle(getNextAttributeIdentity(nodeID)); } return DTM.NULL; }
Given a node handle, advance to the next attribute. If an attr, we advance to the next attr on the same node. If not an attribute, we return NULL. @param nodeHandle int Handle of the node. @return int DTM node-number of the resolved attr, or DTM.NULL to indicate none exists.
DTMDefaultBase::getNextAttribute
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int getNextAttributeIdentity(int identity) { // Assume that attributes and namespace nodes immediately follow the element while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (type != DTM.NAMESPACE_NODE) { break; } } return DTM.NULL; }
Given a node identity for an attribute, advance to the next attribute. @param identity int identity of the attribute node. This <strong>must</strong> be an attribute node. @return int DTM node-identity of the resolved attr, or DTM.NULL to indicate none exists.
DTMDefaultBase::getNextAttributeIdentity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void declareNamespaceInContext(int elementNodeIndex,int namespaceNodeIndex) { SuballocatedIntVector nsList=null; if(m_namespaceDeclSets==null) { // First m_namespaceDeclSetElements=new SuballocatedIntVector(32); m_namespaceDeclSetElements.addElement(elementNodeIndex); m_namespaceDeclSets=new Vector(); nsList=new SuballocatedIntVector(32); m_namespaceDeclSets.addElement(nsList); } else { // Most recent. May be -1 (none) if DTM was pruned. // %OPT% Is there a lastElement() method? Should there be? int last=m_namespaceDeclSetElements.size()-1; if(last>=0 && elementNodeIndex==m_namespaceDeclSetElements.elementAt(last)) { nsList=(SuballocatedIntVector)m_namespaceDeclSets.elementAt(last); } } if(nsList==null) { m_namespaceDeclSetElements.addElement(elementNodeIndex); SuballocatedIntVector inherited = findNamespaceContext(_parent(elementNodeIndex)); if (inherited!=null) { // %OPT% Count-down might be faster, but debuggability may // be better this way, and if we ever decide we want to // keep this ordered by expanded-type... int isize=inherited.size(); // Base the size of a new namespace list on the // size of the inherited list - but within reason! nsList=new SuballocatedIntVector(Math.max(Math.min(isize+16,2048), 32)); for(int i=0;i<isize;++i) { nsList.addElement(inherited.elementAt(i)); } } else { nsList=new SuballocatedIntVector(32); } m_namespaceDeclSets.addElement(nsList); } // Handle overwriting inherited. // %OPT% Keep sorted? (By expanded-name rather than by doc order...) // Downside: Would require insertElementAt if not found, // which has recopying costs. But these are generally short lists... int newEType=_exptype(namespaceNodeIndex); for(int i=nsList.size()-1;i>=0;--i) { if(newEType==getExpandedTypeID(nsList.elementAt(i))) { nsList.setElementAt(makeNodeHandle(namespaceNodeIndex),i); return; } } nsList.addElement(makeNodeHandle(namespaceNodeIndex)); }
Build table of namespace declaration locations during DTM construction. Table is a Vector of SuballocatedIntVectors containing the namespace node HANDLES declared at that ID, plus an SuballocatedIntVector of the element node INDEXES at which these declarations appeared. NOTE: Since this occurs during model build, nodes will be encountered in doucment order and thus the table will be ordered by element, permitting binary-search as a possible retrieval optimization. %REVIEW% Directly managed arrays rather than vectors? %REVIEW% Handles or IDs? Given usage, I think handles. *
DTMDefaultBase::declareNamespaceInContext
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex) { if (null!=m_namespaceDeclSetElements) { // %OPT% Is binary-search really saving us a lot versus linear? // (... It may be, in large docs with many NS decls.) int wouldBeAt=findInSortedSuballocatedIntVector(m_namespaceDeclSetElements, elementNodeIndex); if(wouldBeAt>=0) // Found it return (SuballocatedIntVector) m_namespaceDeclSets.elementAt(wouldBeAt); if(wouldBeAt == -1) // -1-wouldbeat == 0 return null; // Not after anything; definitely not found // Not found, but we know where it should have been. // Search back until we find an ancestor or run out. wouldBeAt=-1-wouldBeAt; // Decrement wouldBeAt to find last possible ancestor int candidate=m_namespaceDeclSetElements.elementAt(-- wouldBeAt); int ancestor=_parent(elementNodeIndex); // Special case: if the candidate is before the given node, and // is in the earliest possible position in the document, it // must have the namespace declarations we're interested in. if (wouldBeAt == 0 && candidate < ancestor) { int rootHandle = getDocumentRoot(makeNodeHandle(elementNodeIndex)); int rootID = makeNodeIdentity(rootHandle); int uppermostNSCandidateID; if (getNodeType(rootHandle) == DTM.DOCUMENT_NODE) { int ch = _firstch(rootID); uppermostNSCandidateID = (ch != DTM.NULL) ? ch : rootID; } else { uppermostNSCandidateID = rootID; } if (candidate == uppermostNSCandidateID) { return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt); } } while(wouldBeAt>=0 && ancestor>0) { if (candidate==ancestor) { // Found ancestor in list return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt); } else if (candidate<ancestor) { // Too deep in tree do { ancestor=_parent(ancestor); } while (candidate < ancestor); } else if(wouldBeAt > 0){ // Too late in list candidate=m_namespaceDeclSetElements.elementAt(--wouldBeAt); } else break; } } return null; // No namespaces known at this node }
Retrieve list of namespace declaration locations active at this node. List is an SuballocatedIntVector whose entries are the namespace node HANDLES declared at that ID. %REVIEW% Directly managed arrays rather than vectors? %REVIEW% Handles or IDs? Given usage, I think handles. *
DTMDefaultBase::findNamespaceContext
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected int findInSortedSuballocatedIntVector(SuballocatedIntVector vector, int lookfor) { // Binary search int i = 0; if(vector != null) { int first = 0; int last = vector.size() - 1; while (first <= last) { i = (first + last) / 2; int test = lookfor-vector.elementAt(i); if(test == 0) { return i; // Name found } else if (test < 0) { last = i - 1; // looked too late } else { first = i + 1; // looked ot early } } if (first > i) { i = first; // Clean up at loop end } } return -1 - i; // not-found has to be encoded. }
Subroutine: Locate the specified node within m_namespaceDeclSetElements, or the last element which preceeds it in document order %REVIEW% Inlne this into findNamespaceContext? Create SortedSuballocatedIntVector type? @return If positive or zero, the index of the found item. If negative, index of the point at which it would have appeared, encoded as -1-index and hence reconvertable by subtracting it from -1. (Encoding because I don't want to recompare the strings but don't want to burn bytes on a datatype to hold a flagged value.)
DTMDefaultBase::findInSortedSuballocatedIntVector
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getNextNamespaceNode(int baseHandle, int nodeHandle, boolean inScope) { if(inScope) { //Since we've been given the base, try direct lookup //(could look from nodeHandle but this is at least one //comparison/get-parent faster) //SuballocatedIntVector nsContext=findNamespaceContext(nodeHandle & m_mask); SuballocatedIntVector nsContext=findNamespaceContext(makeNodeIdentity(baseHandle)); if(nsContext==null) return NULL; int i=1 + nsContext.indexOf(nodeHandle); if(i<=0 || i==nsContext.size()) return NULL; return nsContext.elementAt(i); } else { // Assume that attributes and namespace nodes immediately follow the element. int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.NAMESPACE_NODE) { return makeNodeHandle(identity); } else if (type != DTM.ATTRIBUTE_NODE) { break; } } } return DTM.NULL; }
Given a namespace handle, advance to the next namespace. @param baseHandle handle to original node from where the first namespace was relative to (needed to return nodes in document order). @param nodeHandle A namespace handle for which we will find the next node. @param inScope true if all namespaces that are in scope should be processed, otherwise just process the nodes in the given element handle. @return handle of next namespace, or DTM.NULL to indicate none exists.
DTMDefaultBase::getNextNamespaceNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getDocument() { return m_dtmIdent.elementAt(0); // makeNodeHandle(0) }
Find the Document node handle for the document currently under construction. PLEASE NOTE that most people should use getOwnerDocument(nodeHandle) instead; this version of the operation is primarily intended for use during negotiation with the DTM Manager. @return int Node handle of document, which should always be valid.
DTMDefaultBase::getDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getOwnerDocument(int nodeHandle) { if (DTM.DOCUMENT_NODE == getNodeType(nodeHandle)) return DTM.NULL; return getDocumentRoot(nodeHandle); }
Given a node handle, find the owning document node. This has the exact same semantics as the DOM Document method of the same name, in that if the nodeHandle is a document node, it will return NULL. <p>%REVIEW% Since this is DOM-specific, it may belong at the DOM binding layer. Included here as a convenience function and to aid porting of DOM code to DTM.</p> @param nodeHandle the id of the node. @return int Node handle of owning document, or -1 if the node was a Docment
DTMDefaultBase::getOwnerDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getDocumentRoot(int nodeHandle) { return getManager().getDTM(nodeHandle).getDocument(); }
Given a node handle, find the owning document node. Unlike the DOM, this considers the owningDocument of a Document to be itself. @param nodeHandle the id of the node. @return int Node handle of owning document, or the nodeHandle if it is a Document.
DTMDefaultBase::getDocumentRoot
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getStringValueChunkCount(int nodeHandle) { // %TBD% error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//("getStringValueChunkCount not yet supported!"); return 0; }
Get number of character array chunks in the string-value of a node. (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). Note that a single text node may have multiple text chunks. @param nodeHandle The node ID. @return number of character array chunks in the string-value of a node.
DTMDefaultBase::getStringValueChunkCount
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen) { // %TBD% error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"getStringValueChunk not yet supported!"); return null; }
Get a character array chunk in the string-value of a node. (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). Note that a single text node may have multiple text chunks. @param nodeHandle The node ID. @param chunkIndex Which chunk to get. @param startAndLen An array of 2 where the start position and length of the chunk will be returned. @return The character array reference where the chunk occurs.
DTMDefaultBase::getStringValueChunk
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getExpandedTypeID(String namespace, String localName, int type) { ExpandedNameTable ent = m_expandedNameTable; return ent.getExpandedTypeID(namespace, localName, type); }
Given an expanded name, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @param type The simple type, i.e. one of ELEMENT, ATTRIBUTE, etc. @param namespace The namespace URI, which may be null, may be an empty string (which will be the same as null), or may be a namespace URI. @param localName The local name string, which must be a valid <a href="http://www.w3.org/TR/REC-xml-names/">NCName</a>. @return the expanded-name id of the node.
DTMDefaultBase::getExpandedTypeID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public String getLocalNameFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getLocalName(expandedNameID); }
Given an expanded-name ID, return the local name part. @param expandedNameID an ID that represents an expanded-name. @return String Local name of this node.
DTMDefaultBase::getLocalNameFromExpandedNameID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public String getNamespaceFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getNamespace(expandedNameID); }
Given an expanded-name ID, return the namespace URI part. @param expandedNameID an ID that represents an expanded-name. @return String URI value of this node's namespace, or null if no namespace was resolved.
DTMDefaultBase::getNamespaceFromExpandedNameID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getNamespaceType(final int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int expandedNameID = _exptype(identity); return m_expandedNameTable.getNamespaceID(expandedNameID); }
Returns the namespace type of a specific node @param nodeHandle the id of the node. @return the ID of the namespace.
DTMDefaultBase::getNamespaceType
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public short getNodeType(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return m_expandedNameTable.getType(_exptype(makeNodeIdentity(nodeHandle))); }
Given a node handle, return its DOM-style node type. <p> %REVIEW% Generally, returning short is false economy. Return int? %REVIEW% Make assumption that node has already arrived. Is OK? @param nodeHandle The node id. @return int Node type, as per the DOM's Node._NODE constants.
DTMDefaultBase::getNodeType
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getNodeIdent(int nodeHandle) { /*if (nodeHandle != DTM.NULL) return nodeHandle & m_mask; else return DTM.NULL;*/ return makeNodeIdentity(nodeHandle); }
Get the identity of this node in the tree @param nodeHandle The node handle. @return the node identity @xsl.usage internal
DTMDefaultBase::getNodeIdent
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public int getNodeHandle(int nodeId) { /*if (nodeId != DTM.NULL) return nodeId | m_dtmIdent; else return DTM.NULL;*/ return makeNodeHandle(nodeId); }
Get the handle of this node in the tree @param nodeId The node identity. @return the node handle @xsl.usage internal
DTMDefaultBase::getNodeHandle
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public String getDocumentEncoding(int nodeHandle) { // %REVIEW% OK?? -sb return "UTF-8"; }
Return the name of the character encoding scheme in which the document entity is expressed. @param nodeHandle The node id, which can be any valid node handle. @return the document encoding String object. @xsl.usage internal
DTMDefaultBase::getDocumentEncoding
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public String getDocumentVersion(int documentHandle) { return null; }
Return a string representing the XML version of the document. This property is derived from the XML declaration optionally present at the beginning of the document entity, and has no value if there is no XML declaration. @param documentHandle The document handle @return the document version String object.
DTMDefaultBase::getDocumentVersion
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public boolean getDocumentAllDeclarationsProcessed() { // %REVIEW% OK? return true; }
Return an indication of whether the processor has read the complete DTD. Its value is a boolean. If it is false, then certain properties (indicated in their descriptions below) may be unknown. If it is true, those properties are never unknown. @return <code>true</code> if all declarations were processed; <code>false</code> otherwise.
DTMDefaultBase::getDocumentAllDeclarationsProcessed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public boolean supportsPreStripping() { return true; }
Return true if the xsl:strip-space or xsl:preserve-space was processed during construction of the DTM document. @return true if this DTM supports prestripping.
DTMDefaultBase::supportsPreStripping
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public boolean isNodeAfter(int nodeHandle1, int nodeHandle2) { // These return NULL if the node doesn't belong to this document. int index1 = makeNodeIdentity(nodeHandle1); int index2 = makeNodeIdentity(nodeHandle2); return index1!=NULL && index2!=NULL && index1 <= index2; }
Figure out whether nodeHandle2 should be considered as being later in the document than nodeHandle1, in Document Order as defined by the XPath model. This may not agree with the ordering defined by other XML applications. <p> There are some cases where ordering isn't defined, and neither are the results of this function -- though we'll generally return false. @param nodeHandle1 Node handle to perform position comparison on. @param nodeHandle2 Second Node handle to perform position comparison on . @return true if node1 comes before node2, otherwise return false. You can think of this as <code>(node1.documentOrderPosition &lt;= node2.documentOrderPosition)</code>.
DTMDefaultBase::isNodeAfter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public void appendChild(int newChild, boolean clone, boolean cloneDepth) { error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"appendChild not yet supported!"); }
Append a child to the end of the document. Please note that the node is always cloned if it is owned by another document. <p>%REVIEW% "End of the document" needs to be defined more clearly. Does it become the last child of the Document? Of the root element?</p> @param newChild Must be a valid new node handle. @param clone true if the child should be cloned into the document. @param cloneDepth if the clone argument is true, specifies that the clone should include all it's children.
DTMDefaultBase::appendChild
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public void appendTextChild(String str) { error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"appendTextChild not yet supported!"); }
Append a text node child that will be constructed from a string, to the end of the document. <p>%REVIEW% "End of the document" needs to be defined more clearly. Does it become the last child of the Document? Of the root element?</p> @param str Non-null reverence to a string.
DTMDefaultBase::appendTextChild
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void error(String msg) { throw new DTMException(msg); }
Simple error for asserts and the like. @param msg Error message to report.
DTMDefaultBase::error
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected boolean getShouldStripWhitespace() { return m_shouldStripWS; }
Find out whether or not to strip whispace nodes. @return whether or not to strip whispace nodes.
DTMDefaultBase::getShouldStripWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void pushShouldStripWhitespace(boolean shouldStrip) { m_shouldStripWS = shouldStrip; if (null != m_shouldStripWhitespaceStack) m_shouldStripWhitespaceStack.push(shouldStrip); }
Set whether to strip whitespaces and push in current value of m_shouldStripWS in m_shouldStripWhitespaceStack. @param shouldStrip Flag indicating whether to strip whitespace nodes
DTMDefaultBase::pushShouldStripWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void popShouldStripWhitespace() { if (null != m_shouldStripWhitespaceStack) m_shouldStripWS = m_shouldStripWhitespaceStack.popAndTop(); }
Set whether to strip whitespaces at this point by popping out m_shouldStripWhitespaceStack.
DTMDefaultBase::popShouldStripWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
protected void setShouldStripWhitespace(boolean shouldStrip) { m_shouldStripWS = shouldStrip; if (null != m_shouldStripWhitespaceStack) m_shouldStripWhitespaceStack.setTop(shouldStrip); }
Set whether to strip whitespaces and set the top of the stack to the current value of m_shouldStripWS. @param shouldStrip Flag indicating whether to strip whitespace nodes
DTMDefaultBase::setShouldStripWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public void migrateTo(DTMManager mgr) { m_mgr = mgr; if(mgr instanceof DTMManagerDefault) m_mgrDefault=(DTMManagerDefault)mgr; }
Migrate a DTM built with an old DTMManager to a new DTMManager. After the migration, the new DTMManager will treat the DTM as one that is built by itself. This is used to support DTM sharing between multiple transformations. @param mgr the DTMManager
DTMDefaultBase::migrateTo
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public DTMManager getManager() { return m_mgr; }
Query which DTMManager this DTM is currently being handled by. %REVEW% Should this become part of the base DTM API? @return a DTMManager, or null if this is a "stand-alone" DTM.
DTMDefaultBase::getManager
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public SuballocatedIntVector getDTMIDs() { if(m_mgr==null) return null; return m_dtmIdent; }
Query which DTMIDs this DTM is currently using within the DTMManager. %REVEW% Should this become part of the base DTM API? @return an IntVector, or null if this is a "stand-alone" DTM.
DTMDefaultBase::getDTMIDs
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
Apache-2.0
public DTMAxisIterNodeList(DTM dtm, DTMAxisIterator dtmAxisIterator) { if (dtmAxisIterator == null) { m_last = 0; } else { m_cachedNodes = new IntVector(); m_dtm = dtm; } m_iter = dtmAxisIterator; }
Public constructor: Wrap a DTMNodeList around an existing and preconfigured DTMAxisIterator
DTMAxisIterNodeList::DTMAxisIterNodeList
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIterNodeList.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIterNodeList.java
Apache-2.0
public DTMAxisIterator getDTMAxisIterator() { return m_iter; }
Access the wrapped DTMIterator. I'm not sure whether anyone will need this or not, but let's write it and think about it.
DTMAxisIterNodeList::getDTMAxisIterator
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIterNodeList.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIterNodeList.java
Apache-2.0
public ExpandedNameTable() { m_capacity = m_initialCapacity; m_threshold = (int)(m_capacity * m_loadFactor); m_table = new HashEntry[m_capacity]; initExtendedTypes(); }
Create an expanded name table.
ExpandedNameTable::ExpandedNameTable
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
private void initExtendedTypes() { m_extendedTypes = new ExtendedType[m_initialSize]; for (int i = 0; i < DTM.NTYPES; i++) { m_extendedTypes[i] = m_defaultExtendedTypes[i]; m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null); } m_nextType = DTM.NTYPES; }
Initialize the vector of extended types with the basic DOM node types.
ExpandedNameTable::initExtendedTypes
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public int getExpandedTypeID(String namespace, String localName, int type) { return getExpandedTypeID(namespace, localName, type, false); }
Given an expanded name represented by namespace, local name and node type, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @param namespace The namespace @param localName The local name @param type The node type @return the expanded-name id of the node.
ExpandedNameTable::getExpandedTypeID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public int getExpandedTypeID(String namespace, String localName, int type, boolean searchOnly) { if (null == namespace) namespace = ""; if (null == localName) localName = ""; // Calculate the hash code int hash = type + namespace.hashCode() + localName.hashCode(); // Redefine the hashET object to represent the new expanded name. hashET.redefine(type, namespace, localName, hash); // Calculate the index into the HashEntry table. int index = hash % m_capacity; if (index < 0) index = -index; // Look up the expanded name in the hash table. Return the id if // the expanded name is already in the hash table. for (HashEntry e = m_table[index]; e != null; e = e.next) { if (e.hash == hash && e.key.equals(hashET)) return e.value; } if (searchOnly) { return DTM.NULL; } // Expand the internal HashEntry array if necessary. if (m_nextType > m_threshold) { rehash(); index = hash % m_capacity; if (index < 0) index = -index; } // Create a new ExtendedType object ExtendedType newET = new ExtendedType(type, namespace, localName, hash); // Expand the m_extendedTypes array if necessary. if (m_extendedTypes.length == m_nextType) { ExtendedType[] newArray = new ExtendedType[m_extendedTypes.length * 2]; System.arraycopy(m_extendedTypes, 0, newArray, 0, m_extendedTypes.length); m_extendedTypes = newArray; } m_extendedTypes[m_nextType] = newET; // Create a new hash entry for the new ExtendedType and put it into // the table. HashEntry entry = new HashEntry(newET, m_nextType, hash, m_table[index]); m_table[index] = entry; return m_nextType++; }
Given an expanded name represented by namespace, local name and node type, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. <p> If searchOnly is true, we will return -1 if the name is not found in the table, otherwise the name is added to the table and the expanded name id of the new entry is returned. @param namespace The namespace @param localName The local name @param type The node type @param searchOnly If it is true, we will only search for the expanded name. -1 is return is the name is not found. @return the expanded-name id of the node.
ExpandedNameTable::getExpandedTypeID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
private void rehash() { int oldCapacity = m_capacity; HashEntry[] oldTable = m_table; int newCapacity = 2 * oldCapacity + 1; m_capacity = newCapacity; m_threshold = (int)(newCapacity * m_loadFactor); m_table = new HashEntry[newCapacity]; for (int i = oldCapacity-1; i >=0 ; i--) { for (HashEntry old = oldTable[i]; old != null; ) { HashEntry e = old; old = old.next; int newIndex = e.hash % newCapacity; if (newIndex < 0) newIndex = -newIndex; e.next = m_table[newIndex]; m_table[newIndex] = e; } } }
Increases the capacity of and internally reorganizes the hashtable, in order to accommodate and access its entries more efficiently. This method is called when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.
ExpandedNameTable::rehash
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public int getExpandedTypeID(int type) { return type; }
Given a type, return an expanded name ID.Any additional nodes that are created that have this expanded name will use this ID. @return the expanded-name id of the node.
ExpandedNameTable::getExpandedTypeID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public String getLocalName(int ExpandedNameID) { return m_extendedTypes[ExpandedNameID].getLocalName(); }
Given an expanded-name ID, return the local name part. @param ExpandedNameID an ID that represents an expanded-name. @return String Local name of this node, or null if the node has no name.
ExpandedNameTable::getLocalName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public final int getLocalNameID(int ExpandedNameID) { // ExtendedType etype = m_extendedTypes[ExpandedNameID]; if (m_extendedTypes[ExpandedNameID].getLocalName().equals("")) return 0; else return ExpandedNameID; }
Given an expanded-name ID, return the local name ID. @param ExpandedNameID an ID that represents an expanded-name. @return The id of this local name.
ExpandedNameTable::getLocalNameID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public final int getNamespaceID(int ExpandedNameID) { //ExtendedType etype = m_extendedTypes[ExpandedNameID]; if (m_extendedTypes[ExpandedNameID].getNamespace().equals("")) return 0; else return ExpandedNameID; }
Given an expanded-name ID, return the namespace URI ID. @param ExpandedNameID an ID that represents an expanded-name. @return The id of this namespace.
ExpandedNameTable::getNamespaceID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public int getSize() { return m_nextType; }
Return the size of the ExpandedNameTable @return The size of the ExpandedNameTable
ExpandedNameTable::getSize
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public ExtendedType[] getExtendedTypes() { return m_extendedTypes; }
Return the array of extended types @return The array of extended types
ExpandedNameTable::getExtendedTypes
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
Apache-2.0
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) { m_parentDTM=parentDTM; m_firstChild=parentDTM.getFirstChild(parentHandle); }
Public constructor: Create a NodeList to support DTMNodeProxy.getChildren(). Unfortunately AxisIterators and DTMIterators don't share an API, so I can't use the existing Axis.CHILD iterator. Rather than create Yet Another Class, let's set up a special case of this one. @param parentDTM The DTM containing this node @param parentHandle DTM node-handle integer
DTMChildIterNodeList::DTMChildIterNodeList
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMChildIterNodeList.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMChildIterNodeList.java
Apache-2.0
public DTMNodeList(DTMIterator dtmIterator) { if (dtmIterator != null) { int pos = dtmIterator.getCurrentPos(); try { m_iter=(DTMIterator)dtmIterator.cloneWithReset(); } catch(CloneNotSupportedException cnse) { m_iter = dtmIterator; } m_iter.setShouldCacheNodes(true); m_iter.runTo(-1); m_iter.setCurrentPos(pos); } }
Public constructor: Wrap a DTMNodeList around an existing and preconfigured DTMIterator WARNING: THIS HAS THE SIDE EFFECT OF ISSUING setShouldCacheNodes(true) AGAINST THE DTMIterator.
DTMNodeList::DTMNodeList
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeList.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeList.java
Apache-2.0
public int getHandleOfNode() { return handle; }
Non-DOM method, part of the temporary kluge %REVIEW% This would be a pruning problem, but since it will always be added to the root element and we prune on elements, we shouldn't have to worry.
DOM2DTMdefaultNamespaceDeclarationNode::getHandleOfNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public String getTypeName() {return null; }
@see org.w3c.dom.TypeInfo#getTypeName()
DOM2DTMdefaultNamespaceDeclarationNode::getTypeName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public String getTypeNamespace() { return null;}
@see org.w3c.dom.TypeInfo#getTypeNamespace()
DOM2DTMdefaultNamespaceDeclarationNode::getTypeNamespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public boolean isDerivedFrom( String ns, String localName, int derivationMethod ) { return false; }
@see or.gw3c.dom.TypeInfo#isDerivedFrom(String,String,int)
DOM2DTMdefaultNamespaceDeclarationNode::isDerivedFrom
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public Object setUserData(String key, Object data, UserDataHandler handler) { return getOwnerDocument().setUserData( key, data, handler); }
Associate an object to a key on this node. The object can later be retrieved from this node by calling <code>getUserData</code> with the same key. @param key The key to associate the object to. @param data The object to associate to the given key, or <code>null</code> to remove any existing association to that key. @param handler The handler to associate to that key, or <code>null</code>. @return Returns the <code>DOMObject</code> previously associated to the given key on this node, or <code>null</code> if there was none. @since DOM Level 3
DOM2DTMdefaultNamespaceDeclarationNode::setUserData
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public int getDocument() { return makeNodeHandle(m_currentDocumentNode); }
Given a DTM, find the owning document node. In the case of SAX2RTFDTM, which may contain multiple documents, this returns the <b>most recently started</b> document, or null if the DTM is empty or no document is currently under construction. %REVIEW% Should we continue to report the most recent after construction has ended? I think not, given that it may have been tail-pruned. @return int Node handle of Document node, or null if this DTM does not contain an "active" document. *
SAX2RTFDTM::getDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public int getDocumentRoot(int nodeHandle) { for (int id=makeNodeIdentity(nodeHandle); id!=NULL; id=_parent(id)) { if (_type(id)==DTM.DOCUMENT_NODE) { return makeNodeHandle(id); } } return DTM.NULL; // Safety net; should never happen }
Given a node handle, find the owning document node, using DTM semantics (Document owns itself) rather than DOM semantics (Document has no owner). (I'm counting on the fact that getOwnerDocument() is implemented on top of this call, in the superclass, to avoid having to rewrite that one. Be careful if that code changes!) @param nodeHandle the id of the node. @return int Node handle of owning document
SAX2RTFDTM::getDocumentRoot
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
protected int _documentRoot(int nodeIdentifier) { if(nodeIdentifier==NULL) return NULL; for (int parent=_parent(nodeIdentifier); parent!=NULL; nodeIdentifier=parent,parent=_parent(nodeIdentifier)) ; return nodeIdentifier; }
Given a node identifier, find the owning document node. Unlike the DOM, this considers the owningDocument of a Document to be itself. Note that in shared DTMs this may not be zero. @param nodeIdentifier the id of the starting node. @return int Node identifier of the root of this DTM tree
SAX2RTFDTM::_documentRoot
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public void startDocument() throws SAXException { // Re-initialize the tree append process m_endDocumentOccured = false; m_prefixMappings = new java.util.Vector(); m_contextIndexes = new IntStack(); m_parents = new IntStack(); m_currentDocumentNode=m_size; super.startDocument(); }
Receive notification of the beginning of a new RTF document. %REVIEW% Y'know, this isn't all that much of a deoptimization. We might want to consider folding the start/endDocument changes back into the main SAX2DTM so we don't have to expose so many fields (even as Protected) and carry the additional code. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#startDocument *
SAX2RTFDTM::startDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public void endDocument() throws SAXException { charactersFlush(); m_nextsib.setElementAt(NULL,m_currentDocumentNode); if (m_firstch.elementAt(m_currentDocumentNode) == NOTPROCESSED) m_firstch.setElementAt(NULL,m_currentDocumentNode); if (DTM.NULL != m_previous) m_nextsib.setElementAt(DTM.NULL,m_previous); m_parents = null; m_prefixMappings = null; m_contextIndexes = null; m_currentDocumentNode= NULL; // no longer open m_endDocumentOccured = true; }
Receive notification of the end of the document. %REVIEW% Y'know, this isn't all that much of a deoptimization. We might want to consider folding the start/endDocument changes back into the main SAX2DTM so we don't have to expose so many fields (even as Protected). @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#endDocument *
SAX2RTFDTM::endDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public void pushRewindMark() { if(m_indexing || m_elemIndexes!=null) throw new java.lang.NullPointerException("Coding error; Don't try to mark/rewind an indexed DTM"); // Values from DTMDefaultBase // %REVIEW% Can the namespace stack sizes ever differ? If not, save space! mark_size.push(m_size); mark_nsdeclset_size.push((m_namespaceDeclSets==null) ? 0 : m_namespaceDeclSets.size()); mark_nsdeclelem_size.push((m_namespaceDeclSetElements==null) ? 0 : m_namespaceDeclSetElements.size()); // Values from SAX2DTM mark_data_size.push(m_data.size()); mark_char_size.push(m_chars.size()); mark_doq_size.push(m_dataOrQName.size()); }
"Tail-pruning" support for RTFs. This function pushes information about the current size of the DTM's data structures onto a stack, for use by popRewindMark() (which see). %REVIEW% I have no idea how to rewind m_elemIndexes. However, RTFs will not be indexed, so I can simply panic if that case arises. Hey, it works... *
SAX2RTFDTM::pushRewindMark
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public boolean popRewindMark() { boolean top=mark_size.empty(); m_size=top ? m_emptyNodeCount : mark_size.pop(); m_exptype.setSize(m_size); m_firstch.setSize(m_size); m_nextsib.setSize(m_size); m_prevsib.setSize(m_size); m_parent.setSize(m_size); m_elemIndexes=null; int ds= top ? m_emptyNSDeclSetCount : mark_nsdeclset_size.pop(); if (m_namespaceDeclSets!=null) { m_namespaceDeclSets.setSize(ds); } int ds1= top ? m_emptyNSDeclSetElemsCount : mark_nsdeclelem_size.pop(); if (m_namespaceDeclSetElements!=null) { m_namespaceDeclSetElements.setSize(ds1); } // Values from SAX2DTM - m_data always has a reserved entry m_data.setSize(top ? m_emptyDataCount : mark_data_size.pop()); m_chars.setLength(top ? m_emptyCharsCount : mark_char_size.pop()); m_dataOrQName.setSize(top ? m_emptyDataQNCount : mark_doq_size.pop()); // Return true iff DTM now empty return m_size==0; }
"Tail-pruning" support for RTFs. This function pops the information previously saved by pushRewindMark (which see) and uses it to discard all nodes added to the DTM after that time. We expect that this will allow us to reuse storage more effectively. This is _not_ intended to be called while a document is still being constructed -- only between endDocument and the next startDocument %REVIEW% WARNING: This is the first use of some of the truncation methods. If Xalan blows up after this is called, that's a likely place to check. %REVIEW% Our original design for DTMs permitted them to share string pools. If there any risk that this might be happening, we can _not_ rewind and recover the string storage. One solution might to assert that DTMs used for RTFs Must Not take advantage of that feature, but this seems excessively fragile. Another, much less attractive, would be to just let them leak... Nah. @return true if and only if the pop completely emptied the RTF. That response is used when determining how to unspool RTF-started-while-RTF-open situations. *
SAX2RTFDTM::popRewindMark
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public boolean isTreeIncomplete() { return !m_endDocumentOccured; }
@return true if a DTM tree is currently under construction. *
SAX2RTFDTM::isTreeIncomplete
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public SAX2DTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { this(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, DEFAULT_BLOCKSIZE, true, false); }
Construct a SAX2DTM object using the default block size. @param mgr The DTMManager who owns this DTM. @param source the JAXP 1.1 Source object for this DTM. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory XMLString factory for creating character content. @param doIndexing true if the caller considers it worth it to use indexing schemes.
SAX2DTM::SAX2DTM
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public SAX2DTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable) { super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, blocksize, usePrevsib, newNameTable); // %OPT% Use smaller sizes for all internal storage units when // the blocksize is small. This reduces the cost of creating an RTF. if (blocksize <= 64) { m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL); m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL); m_valuesOrPrefixes = new DTMStringPool(16); m_chars = new FastStringBuffer(7, 10); m_contextIndexes = new IntStack(4); m_parents = new IntStack(4); } else { m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS); m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS); m_valuesOrPrefixes = new DTMStringPool(); m_chars = new FastStringBuffer(10, 13); m_contextIndexes = new IntStack(); m_parents = new IntStack(); } // %REVIEW% Initial size pushed way down to reduce weight of RTFs // (I'm not entirely sure 0 would work, so I'm playing it safe for now.) //m_data = new SuballocatedIntVector(doIndexing ? (1024*2) : 512, 1024); //m_data = new SuballocatedIntVector(blocksize); m_data.addElement(0); // Need placeholder in case index into here must be <0. //m_dataOrQName = new SuballocatedIntVector(blocksize); // m_useSourceLocationProperty=org.apache.xalan.processor.TransformerFactoryImpl.m_source_location; m_useSourceLocationProperty = mgr.getSource_location(); m_sourceSystemId = (m_useSourceLocationProperty) ? new StringVector() : null; m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null; m_sourceColumn = (m_useSourceLocationProperty) ? new IntVector() : null; }
Construct a SAX2DTM object ready to be constructed from SAX2 ContentHandler events. @param mgr The DTMManager who owns this DTM. @param source the JAXP 1.1 Source object for this DTM. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory XMLString factory for creating character content. @param doIndexing true if the caller considers it worth it to use indexing schemes. @param blocksize The block size of the DTM. @param usePrevsib true if we want to build the previous sibling node array. @param newNameTable true if we want to use a new ExpandedNameTable for this DTM.
SAX2DTM::SAX2DTM
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void setUseSourceLocation(boolean useSourceLocation) { m_useSourceLocationProperty = useSourceLocation; }
Set whether information about document source location should be maintained or not.
SAX2DTM::setUseSourceLocation
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected int _dataOrQName(int identity) { if (identity < m_size) return m_dataOrQName.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (!isMore) return NULL; else if (identity < m_size) return m_dataOrQName.elementAt(identity); } }
Get the data or qualified name for the given node identity. @param identity The node identity. @return The data or qualified name, or DTM.NULL.
SAX2DTM::_dataOrQName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void clearCoRoutine() { clearCoRoutine(true); }
Ask the CoRoutine parser to doTerminate and clear the reference.
SAX2DTM::clearCoRoutine
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void clearCoRoutine(boolean callDoTerminate) { if (null != m_incrementalSAXSource) { if (callDoTerminate) m_incrementalSAXSource.deliverMoreNodes(false); m_incrementalSAXSource = null; } }
Ask the CoRoutine parser to doTerminate and clear the reference. If the CoRoutine parser has already been cleared, this will have no effect. @param callDoTerminate true of doTerminate should be called on the coRoutine parser.
SAX2DTM::clearCoRoutine
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource) { // Establish coroutine link so we can request more data // // Note: It's possible that some versions of IncrementalSAXSource may // not actually use a CoroutineManager, and hence may not require // that we obtain an Application Coroutine ID. (This relies on the // coroutine transaction details having been encapsulated in the // IncrementalSAXSource.do...() methods.) m_incrementalSAXSource = incrementalSAXSource; // Establish SAX-stream link so we can receive the requested data incrementalSAXSource.setContentHandler(this); incrementalSAXSource.setLexicalHandler(this); incrementalSAXSource.setDTDHandler(this); // Are the following really needed? incrementalSAXSource doesn't yet // support them, and they're mostly no-ops here... //incrementalSAXSource.setErrorHandler(this); //incrementalSAXSource.setDeclHandler(this); }
Bind a IncrementalSAXSource to this DTM. If we discover we need nodes that have not yet been built, we will ask this object to send us more events, and it will manage interactions with its data sources. Note that we do not actually build the IncrementalSAXSource, since we don't know what source it's reading from, what thread that source will run in, or when it will run. @param incrementalSAXSource The parser that we want to recieve events from on demand.
SAX2DTM::setIncrementalSAXSource
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public ContentHandler getContentHandler() { if (m_incrementalSAXSource instanceof IncrementalSAXSource_Filter) return (ContentHandler) m_incrementalSAXSource; else return this; }
getContentHandler returns "our SAX builder" -- the thing that someone else should send SAX events to in order to extend this DTM model. %REVIEW% Should this return null if constrution already done/begun? @return null if this model doesn't respond to SAX events, "this" if the DTM object has a built-in SAX ContentHandler, the IncrementalSAXSource if we're bound to one and should receive the SAX stream via it for incremental build purposes...
SAX2DTM::getContentHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public boolean needsTwoThreads() { return null != m_incrementalSAXSource; }
@return true iff we're building this model incrementally (eg we're partnered with a IncrementalSAXSource) and thus require that the transformation and the parse run simultaneously. Guidance to the DTMManager.
SAX2DTM::needsTwoThreads
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize) throws SAXException { int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return; int type = _type(identity); if (isTextType(type)) { int dataIndex = m_dataOrQName.elementAt(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } else { int firstChild = _firstch(identity); if (DTM.NULL != firstChild) { int offset = -1; int length = 0; int startNode = identity; identity = firstChild; do { type = _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); if (-1 == offset) { offset = m_data.elementAt(dataIndex); } length += m_data.elementAt(dataIndex + 1); } identity = getNextNodeIdentity(identity); } while (DTM.NULL != identity && (_parent(identity) >= startNode)); if (length > 0) { if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } } else if(type != DTM.ELEMENT_NODE) { int dataIndex = _dataOrQName(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } String str = m_valuesOrPrefixes.indexToString(dataIndex); if(normalize) FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(), 0, str.length(), ch); else ch.characters(str.toCharArray(), 0, str.length()); } } }
Directly call the characters method on the passed ContentHandler for the string-value of the given node (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). Multiple calls to the ContentHandler's characters methods may well occur for a single call to this method. @param nodeHandle The node ID. @param ch A non-null reference to a ContentHandler. @param normalize true if the content should be normalized according to the rules for the XPath <a href="http://www.w3.org/TR/xpath#function-normalize-space">normalize-space</a> function. @throws SAXException
SAX2DTM::dispatchCharactersEvents
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public boolean isAttributeSpecified(int attributeHandle) { // I'm not sure if I want to do anything with this... return true; // ?? }
5. [specified] A flag indicating whether this attribute was actually specified in the start-tag of its element, or was defaulted from the DTD. @param attributeHandle Must be a valid handle to an attribute node. @return <code>true</code> if the attribute was specified; <code>false</code> if it was defaulted.
SAX2DTM::isAttributeSpecified
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public int getNumberOfNodes() { return m_size; }
Get the number of nodes that have been added. @return The number of that are currently in the tree.
SAX2DTM::getNumberOfNodes
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0