/** Sets the last child of the parentIndex to childIndex. */ public void setAsLastChild(int parentIndex, int childIndex) { int pchunk = parentIndex >> CHUNK_SHIFT; int pindex = parentIndex & CHUNK_MASK; setChunkIndex(fNodeLastChild, childIndex, pchunk, pindex); } // setAsLastChild(int,int)
/** Appends a child to the specified parent in the table. */ public void appendChild(int parentIndex, int childIndex) { // append parent index int pchunk = parentIndex >> CHUNK_SHIFT; int pindex = parentIndex & CHUNK_MASK; int cchunk = childIndex >> CHUNK_SHIFT; int cindex = childIndex & CHUNK_MASK; setChunkIndex(fNodeParent, parentIndex, cchunk, cindex); // set previous sibling of new child int olast = getChunkIndex(fNodeLastChild, pchunk, pindex); setChunkIndex(fNodePrevSib, olast, cchunk, cindex); // update parent's last child setChunkIndex(fNodeLastChild, childIndex, pchunk, pindex); } // appendChild(int,int)
/** Sets type of attribute */ public void setIdAttribute(int attrIndex) { int chunk = attrIndex >> CHUNK_SHIFT; int index = attrIndex & CHUNK_MASK; int extra = getChunkIndex(fNodeExtra, chunk, index); extra = extra | ID; setChunkIndex(fNodeExtra, extra, chunk, index); }
/** Creates a node of the specified type. */ protected int createNode(short nodeType) { // ensure tables are large enough int chunk = fNodeCount >> CHUNK_SHIFT; int index = fNodeCount & CHUNK_MASK; ensureCapacity(chunk); // initialize node setChunkIndex(fNodeType, nodeType, chunk, index); // return node index number return fNodeCount++; } // createNode(short):int
/** Inserts a child before the specified node in the table. */ public int insertBefore(int parentIndex, int newChildIndex, int refChildIndex) { if (refChildIndex == -1) { appendChild(parentIndex, newChildIndex); return newChildIndex; } int nchunk = newChildIndex >> CHUNK_SHIFT; int nindex = newChildIndex & CHUNK_MASK; int rchunk = refChildIndex >> CHUNK_SHIFT; int rindex = refChildIndex & CHUNK_MASK; int previousIndex = getChunkIndex(fNodePrevSib, rchunk, rindex); setChunkIndex(fNodePrevSib, newChildIndex, rchunk, rindex); setChunkIndex(fNodePrevSib, previousIndex, nchunk, nindex); return newChildIndex; } // insertBefore(int,int,int):int
/** * Sets an attribute on an element node. * @deprecated */ public int setDeferredAttribute(int elementNodeIndex, String attrName, String attrURI, String attrValue, boolean specified) { // create attribute int attrNodeIndex = createDeferredAttribute(attrName, attrURI, attrValue, specified); int attrChunk = attrNodeIndex >> CHUNK_SHIFT; int attrIndex = attrNodeIndex & CHUNK_MASK; // set attribute's parent to element setChunkIndex(fNodeParent, elementNodeIndex, attrChunk, attrIndex); int elementChunk = elementNodeIndex >> CHUNK_SHIFT; int elementIndex = elementNodeIndex & CHUNK_MASK; // get element's last attribute int lastAttrNodeIndex = getChunkIndex(fNodeExtra, elementChunk, elementIndex); if (lastAttrNodeIndex != 0) { // add link from new attribute to last attribute setChunkIndex(fNodePrevSib, lastAttrNodeIndex, attrChunk, attrIndex); } // add link from element to new last attribute setChunkIndex(fNodeExtra, attrNodeIndex, elementChunk, elementIndex); // return node index return attrNodeIndex; } // setDeferredAttribute(int,String,String,String,boolean):int
public void setInternalSubset(int doctypeIndex, String subset) { int chunk = doctypeIndex >> CHUNK_SHIFT; int index = doctypeIndex & CHUNK_MASK; // create extra data node to store internal subset int extraDataIndex = createNode(Node.DOCUMENT_TYPE_NODE); int echunk = extraDataIndex >> CHUNK_SHIFT; int eindex = extraDataIndex & CHUNK_MASK; setChunkIndex(fNodeExtra, extraDataIndex, chunk, index); setChunkValue(fNodeValue, subset, echunk, eindex); }
/** Creates a text node in the table. */ public int createDeferredTextNode(String data, boolean ignorableWhitespace) { // create node int nodeIndex = createNode(Node.TEXT_NODE); int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; setChunkValue(fNodeValue, data, chunk, index); // use extra to store ignorableWhitespace info setChunkIndex(fNodeExtra, ignorableWhitespace ? 1 : 0, chunk, index); // return node index return nodeIndex; } // createDeferredTextNode(String,boolean):int
/** Adds an attribute node to the specified element. */ public void setIdAttributeNode(int elemIndex, int attrIndex) { int chunk = attrIndex >> CHUNK_SHIFT; int index = attrIndex & CHUNK_MASK; int extra = getChunkIndex(fNodeExtra, chunk, index); extra = extra | ID; setChunkIndex(fNodeExtra, extra, chunk, index); String value = getChunkValue(fNodeValue, chunk, index); putIdentifier(value, elemIndex); }
/** Creates an attribute with a URI in the table. */ public int createDeferredAttribute(String attrName, String attrURI, String attrValue, boolean specified) { // create node int nodeIndex = createNode(NodeImpl.ATTRIBUTE_NODE); int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; setChunkValue(fNodeName, attrName, chunk, index); setChunkValue(fNodeURI, attrURI, chunk, index); setChunkValue(fNodeValue, attrValue, chunk, index); int extra = specified ? SPECIFIED : 0; setChunkIndex(fNodeExtra, extra, chunk, index); // return node index return nodeIndex; } // createDeferredAttribute(String,String,String,boolean):int
int attrIndex = attrNodeIndex & CHUNK_MASK; setChunkIndex(fNodeParent, elementNodeIndex, attrChunk, attrIndex); if (lastAttrNodeIndex != 0) { setChunkIndex(fNodePrevSib, lastAttrNodeIndex, attrChunk, attrIndex); setChunkIndex(fNodeExtra, attrNodeIndex, elementChunk, elementIndex); setChunkIndex(fNodeExtra, extra, attrChunk, attrIndex); String value = getChunkValue(fNodeValue, attrChunk, attrIndex); putIdentifier(value, elementNodeIndex); int eindex = extraDataIndex & CHUNK_MASK; setChunkIndex(fNodeLastChild, extraDataIndex, attrChunk, attrIndex); setChunkValue(fNodeValue, type, echunk, eindex);
setChunkIndex(fNodeExtra, prevIndex, echunk, eindex); setChunkIndex(fNodePrevSib, prevIndex, pchunk, pindex); setChunkIndex(fNodeExtra, attrIndex, echunk, eindex); setChunkIndex(fNodePrevSib, prevIndex, achunk, aindex);
setChunkValue(fNodeValue, publicId, chunk, index); setChunkValue(fNodeURI, systemId, chunk, index); setChunkIndex(fNodeExtra, extraDataIndex, chunk, index); int eindex2 = extraDataIndex2 & CHUNK_MASK; setChunkIndex(fNodeExtra, extraDataIndex2, echunk, eindex);
/** Creates a notation in the table. */ public int createDeferredNotation(String notationName, String publicId, String systemId, String baseURI) { // create node int nodeIndex = createNode(Node.NOTATION_NODE); int chunk = nodeIndex >> CHUNK_SHIFT; int index = nodeIndex & CHUNK_MASK; // create extra data node int extraDataIndex = createNode(Node.NOTATION_NODE); int echunk = extraDataIndex >> CHUNK_SHIFT; int eindex = extraDataIndex & CHUNK_MASK; // save name, public id, system id, and notation name setChunkValue(fNodeName, notationName, chunk, index); setChunkValue(fNodeValue, publicId, chunk, index); setChunkValue(fNodeURI, systemId, chunk, index); // in extra data node set baseURI value setChunkIndex(fNodeExtra, extraDataIndex, chunk, index); setChunkValue(fNodeName, baseURI, echunk, eindex); // return node index return nodeIndex; } // createDeferredNotation(String,String,String):int
extraIndex = cloneNode(extraIndex, false); setChunkIndex(fNodeExtra, extraIndex, cchunk, cindex);