/** * Construct an empty XNodeSet object. This is used to create a mutable * nodeset to which random nodes may be added. */ private NodeSequence(DTMManager dtmMgr) { super(new NodeVector()); m_last = 0; m_dtmMgr = dtmMgr; }
/** * Insert a node in order in the list. * * @param value Node to insert */ public void insertInOrder(int value) { for (int i = 0; i < m_firstFree; i++) { if (value < m_map[i]) { insertElementAt(value, i); return; } } addElement(value); }
/** * Append the nodes to the list. * * @param nodes The nodes to be appended to this node set. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void appendNodes(NodeVector nodes) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); }
/** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { m_ancestorsPos = m_ancestors.size()-1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; return resetPosition(); }
if(null != vec) int oldNode = vec.elementAt(index); if (oldNode != node && m_cache.useCount() > 1) { final NodeVector nv; try { nv = (NodeVector) vec.clone(); } catch (CloneNotSupportedException e) { vec.setElementAt(node, index); m_last = vec.size();
m_ancestors.addElement(node); nodeID = _parent(nodeID); node = makeNodeHandle(nodeID); m_ancestorsPos = m_ancestors.size()-1; ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL;
int size = vec.size(), i; int child = vec.elementAt(i); vec.insertElementAt(node, insertIndex);
m_currentExpressionNodes.removeAllElements(); m_currentNodes.removeAllElements(); m_iteratorRoots.RemoveAllNoClear(); m_predicatePos.removeAllElements(); m_predicateRoots.RemoveAllNoClear(); m_prefixResolvers.removeAllElements();
/** * Tell if the table contains the given node. * * @param s Node to look for * * @return True if the given node was found. */ public boolean contains(int s) { runTo(-1); return super.contains(s); }
/** * Get the current predicate root. */ public final int getPredicateRoot() { return m_predicateRoots.peepOrNull(); }
/** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(int elem) { runTo(-1); return super.indexOf(elem); }
/** * Clone this NodeSetDTM. * At this time, we only expect this to be used with LocPathIterators; * it may not work with other kinds of NodeSetDTMs. * * @return a new NodeSetDTM of the same type, having the same state... * though unless overridden in the subclasses, it may not copy all * the state information. * * @throws CloneNotSupportedException if this subclass of NodeSetDTM * does not support the clone() operation. */ public Object clone() throws CloneNotSupportedException { NodeSetDTM clone = (NodeSetDTM) super.clone(); return clone; }
public void gotoMark() { m_ancestorsPos = m_markedPos; _currentNode = m_ancestorsPos>=0 ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; } } // end of AncestorIterator
/** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param node Node to set * @param index Index of where to set the node */ public void setElementAt(int node, int index) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } if(index == -1) addElement(node); m_map[index] = node; }
/** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * @param value The node to be inserted. * @param at The index where the insert should occur. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void insertElementAt(int value, int at) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.insertElementAt(value, at); }
m_ancestors.addElement(node); nodeID = _parent(nodeID); node = makeNodeHandle(nodeID); m_ancestorsPos = m_ancestors.size()-1; ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL;
if(null != vec) int oldNode = vec.elementAt(index); if (oldNode != node && m_cache.useCount() > 1) { final NodeVector nv; try { nv = (NodeVector) vec.clone(); } catch (CloneNotSupportedException e) { vec.setElementAt(node, index); m_last = vec.size();
int size = vec.size(), i; int child = vec.elementAt(i); vec.insertElementAt(node, insertIndex);
/** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { m_ancestorsPos = m_ancestors.size()-1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; return resetPosition(); }
m_currentExpressionNodes.removeAllElements(); m_currentNodes.removeAllElements(); m_iteratorRoots.RemoveAllNoClear(); m_predicatePos.removeAllElements(); m_predicateRoots.RemoveAllNoClear(); m_prefixResolvers.removeAllElements();