Package org.exist.numbering

Examples of org.exist.numbering.NodeId


        return( false );
    }

    public boolean matchPreceding( NodeTest test, int position )
            throws EXistException {
        final NodeId myNodeId = getNodeId();
        int    count    = 0;
        for( int i = nodeNumber - 1; i > 0; i-- ) {
            final NodeImpl n = document.getNode( i );
            if( !myNodeId.isDescendantOf( n.getNodeId() ) && test.matches( n ) ) {
                if( ( position < 0 ) || ( ++count == position ) ) {
                    return( true );
                }
                if( count == position ) {
                    break;
View Full Code Here


                    break;
                }
                next = (NodeImpl)next.getNextSibling();
            }
        } else {
            final NodeId myNodeId = getNodeId();
            int    count    = 0;
            int    nextNode = nodeNumber + 1;
            while( nextNode < document.size ) {
                final NodeImpl n = document.getNode( nextNode );
                if( !n.getNodeId().isDescendantOf( myNodeId ) && test.matches( n ) ) {
View Full Code Here

   
    int count=0;
    int next_peek=(drop+1)/2;

    int child=2*(vacant+1);
    final NodeId missingNodeId=missing.getNodeId();
    while(child<n) {
      if(a[child].getNodeId().compareTo(a[child-1].getNodeId())<0)
        {child--;}
      a[vacant]=a[child];
      vacant=child;
View Full Code Here

          } else {
            t.addContextNode(contextId, current);
            t.addMatches(current);
          }
        }
        NodeId parentID = current.getNodeId().getParentId();
        while (parentID != null) {
          ancestor = new NodeProxy(current.getDocument(), parentID,
              Node.ELEMENT_NODE);
          // Filter out the temporary nodes wrapper element
          if (parentID != NodeId.DOCUMENT_NODE
              && !(parentID.getTreeLevel() == 1 && current
                  .getDocument().getCollection()
                  .isTempCollection())) {
            if (test.matches(ancestor)) {
              final NodeProxy t = result.get(ancestor);
              if (t == null) {
                if (Expression.NO_CONTEXT_ID != contextId)
                  {ancestor.addContextNode(contextId, current);}
                else
                  {ancestor.copyContext(current);}
                ancestor.addMatches(current);
                result.add(ancestor);
              } else {
                t.addContextNode(contextId, current);
                t.addMatches(current);
              }
            }
          }
          parentID = parentID.getParentId();
        }
      }
      return result;
    } else if (hasPreloadedData()) {
      DocumentSet docs = getDocumentSet(contextSet);
View Full Code Here

    /* (non-Javadoc)
     * @see org.exist.dom.NodeSet#getParents(boolean)
     */
    public NodeSet getParents(int contextId) {
        final NodeId pid = nodeId.getParentId();
        if (pid == null || pid == NodeId.DOCUMENT_NODE)
            {return NodeSet.EMPTY_SET;}
        final NodeProxy parent = new NodeProxy(doc, pid, Node.ELEMENT_NODE);
        if (contextId != Expression.NO_CONTEXT_ID)
            {parent.addContextNode(contextId, this);}
View Full Code Here

     */
    public NodeSet getAncestors(int contextId, boolean includeSelf) {
        final NodeSet ancestors = new NewArrayNodeSet();
        if (includeSelf)
            {ancestors.add(this);}
        NodeId parentID = nodeId.getParentId();
        while (parentID != null) {
            final NodeProxy parent = new NodeProxy(getDocument(), parentID, Node.ELEMENT_NODE);
            if (contextId != Expression.NO_CONTEXT_ID)
                {parent.addContextNode(contextId, this);}
            else
                {parent.copyContext(this);}
            parent.addMatches(this);
            ancestors.add(parent);
            parentID = parentID.getParentId();
        }
        return ancestors;
    }
View Full Code Here

    public boolean accept(XMLStreamReader reader) {
      if (reader.getEventType() == XMLStreamReader.END_ELEMENT) {
        return true;
      }
      final NodeId refId = referenceNode.getNodeId();
      final NodeId currentId = (NodeId) reader
          .getProperty(EmbeddedXMLStreamReader.PROPERTY_NODE_ID);
      if (!isAfter) {
        isAfter = currentId.equals(refId);
      } else if (currentId.getTreeLevel() == refId.getTreeLevel()
          && test.matches(reader)) {
        NodeProxy sibling = result.get(referenceNode.getDocument(),
            currentId);
        if (sibling == null) {
          sibling = new NodeProxy(referenceNode.getDocument(),
View Full Code Here

            if (reindexRoot == null) {
                listener = broker.getIndexController().getStreamListener();
            }
            final StoredNode previous = (StoredNode) refChild;
            final StoredNode following = (StoredNode) previous.getNextSibling();
            final NodeId followingId = following == null ? null : following.getNodeId();
            final NodeId newNodeId = previous.getNodeId().insertNode(followingId);
            appendChildren(transaction, newNodeId, followingId, new NodeImplRef(getLastNode(previous)), path, nodes, listener);
            setDirty(true);
            broker.updateNode(transaction, this, true);
            broker.getIndexController().reindex(transaction, reindexRoot, StreamListener.STORE);
            broker.flush();
View Full Code Here

            broker.getIndexController().flush();
            broker.getIndexController().setMode(StreamListener.STORE);
            broker.getIndexController().getStreamListener();
            broker.endRemove(transaction);
            children = i;
            final NodeId newNodeId = last == this ? nodeId.newChild() : last.nodeId.nextSibling();
            //Append new content
            appendChildren(transaction, newNodeId, null, new NodeImplRef(last), path, newContent, listener);
            broker.updateNode(transaction, this, false);
            broker.getIndexController().reindex(transaction, reindexRoot, StreamListener.STORE);
            broker.getValueIndex().reindex(valueReindexRoot);
View Full Code Here

                appendChildren(transaction, nodeId.newChild(), null,
                    new NodeImplRef(this), path, appendList, listener);
            } else {
                if (attributes == 0) {
                    final StoredNode firstChild = (StoredNode) getFirstChild();
                    final NodeId newNodeId = firstChild.nodeId.insertBefore();
                    appendChildren(transaction, newNodeId, firstChild.getNodeId(),
                        new NodeImplRef(this), path, appendList, listener);
                } else {
                    final AttribVisitor visitor = new AttribVisitor();
                    accept(visitor);
                    final NodeId firstChildId = visitor.firstChild == null ? null : visitor.firstChild.nodeId;
                    final NodeId newNodeId = visitor.lastAttrib.nodeId.insertNode(firstChildId);
                    appendChildren(transaction, newNodeId, firstChildId, new NodeImplRef(visitor.lastAttrib),
                            path, appendList, listener);
                }
                setDirty(true);
            }
View Full Code Here

TOP

Related Classes of org.exist.numbering.NodeId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.