/** * Returns the parent node of the given node. * @param free True to free parent node. */ public int getParentNode(int nodeIndex, boolean free) { if (nodeIndex == -1) { return -1; } int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; return free ? clearChunkIndex(fNodeParent, chunk, index) : getChunkIndex(fNodeParent, chunk, index); } // getParentNode(int):int
/** * Returns the <i>real</i> prev sibling of the given node. * @param free True to free sibling index. */ public int getRealPrevSibling(int nodeIndex, boolean free) { if (nodeIndex == -1) { return -1; } int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; return free ? clearChunkIndex(fNodePrevSib, chunk, index) : getChunkIndex(fNodePrevSib, chunk, index); } // getReadPrevSibling(int,boolean):int
/** * Returns the type of the given node. * @param free True to free type index. */ public short getNodeType(int nodeIndex, boolean free) { if (nodeIndex == -1) { return -1; } int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; return free ? (short)clearChunkIndex(fNodeType, chunk, index) : (short)getChunkIndex(fNodeType, chunk, index); } // getNodeType(int):int
/** * Returns the last child of the given node. * @param free True to free child index. */ public int getLastChild(int nodeIndex, boolean free) { if (nodeIndex == -1) { return -1; } int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; return free ? clearChunkIndex(fNodeLastChild, chunk, index) : getChunkIndex(fNodeLastChild, chunk, index); } // getLastChild(int,boolean):int
/** * Returns the extra info of the given node. * @param free True to free the value index. */ public int getNodeExtra(int nodeIndex, boolean free) { if (nodeIndex == -1) { return -1; } int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; return free ? clearChunkIndex(fNodeExtra, chunk, index) : getChunkIndex(fNodeExtra, chunk, index); } // getNodeExtra(int,boolean):int
/** * Sets the specified value in the given of data at the chunk and index. * * @return Returns the old value. */ private final int setChunkIndex(int data[][], int value, int chunk, int index) { if (value == -1) { return clearChunkIndex(data, chunk, index); } int [] dataChunk = data[chunk]; // Re-create chunk if it was deleted. if (dataChunk == null) { createChunk(data, chunk); dataChunk = data[chunk]; } int ovalue = dataChunk[index]; if (ovalue == -1) { dataChunk[CHUNK_SIZE]++; } dataChunk[index] = value; return ovalue; } private final String setChunkValue(Object data[][], Object value,
clearChunkIndex(fNodeType, oachunk, oaindex); clearChunkValue(fNodeName, oachunk, oaindex); clearChunkValue(fNodeValue, oachunk, oaindex); clearChunkIndex(fNodeParent, oachunk, oaindex); clearChunkIndex(fNodePrevSib, oachunk, oaindex); int attrTextIndex = clearChunkIndex(fNodeLastChild, oachunk, oaindex); int atchunk = attrTextIndex >> CHUNK_SHIFT; int atindex = attrTextIndex & CHUNK_MASK; clearChunkIndex(fNodeType, atchunk, atindex); clearChunkValue(fNodeValue, atchunk, atindex); clearChunkIndex(fNodeParent, atchunk, atindex); clearChunkIndex(fNodeLastChild, atchunk, atindex);
int type = getChunkIndex(fNodeType, chunk, index); if (type != Node.TEXT_NODE && type != Node.CDATA_SECTION_NODE) { clearChunkIndex(fNodeType, chunk, index);