Package org.exist.numbering

Examples of org.exist.numbering.NodeId


           DocumentImpl doc, boolean pooled) {
        int pos = start;
        pos += LENGTH_SIGNATURE_LENGTH;
        final int dlnLen = ByteConversion.byteToShort(data, pos);
        pos += NodeId.LENGTH_NODE_ID_UNITS;
        final NodeId dln = doc.getBrokerPool().getNodeFactory().createFromData(dlnLen, data, pos);
        int nodeIdLen = dln.size();
        pos += nodeIdLen;
        String cdata = new String(data, pos, len - (pos - start), UTF_8 );
        //OK : we have the necessary material to build the comment
        CommentImpl comment;
        if(pooled)
View Full Code Here


                        // persistent node. We scan the current sequence and replace all
                        // in-memory nodes with their new persistent node objects.
                        final DocumentImpl expandedDoc = doc.expandRefs(null);
                        final org.exist.dom.DocumentImpl newDoc = expandedDoc.makePersistent();
                        if (newDoc != null) {
                            NodeId rootId = newDoc.getBrokerPool().getNodeFactory().createInstance();
                            for (int j = i; j < count; j++) {
                                v = (NodeValue) items[j].item;
                                if(v.getImplementationType() != NodeValue.PERSISTENT_NODE) {
                                    NodeImpl node = (NodeImpl) v;
                                    if (node.getDocument() == doc) {
                                        node = expandedDoc.getNode(node.getNodeNumber());
                                        NodeId nodeId = node.getNodeId();
                                        if (nodeId == null)
                                            {throw new XPathException("Internal error: nodeId == null");}
                                        if (node.getNodeType() == Node.DOCUMENT_NODE)
                                            {nodeId = rootId;}
                                        else
View Full Code Here

    public NodeSet getParents(int contextId) {
        final NodeSet parents = new NewArrayNodeSet();
        NodeProxy parent = null;
        for (final Iterator<NodeProxy> i = iterator(); i.hasNext();) {
            final NodeProxy current = i.next();
            final NodeId parentID = current.getNodeId().getParentId();
            if (parentID != null && !(parentID.getTreeLevel() == 1 &&
                    current.getDocument().getCollection().isTempCollection())) {
                if (parent == null || parent.getDocument().getDocId() !=
                        current.getDocument().getDocId() || !parent.getNodeId().equals(parentID)) {
                    if (parentID != NodeId.DOCUMENT_NODE) {
                        parent = new NodeProxy(current.getDocument(), parentID, Node.ELEMENT_NODE,
View Full Code Here

            if (includeSelf) {
                if (Expression.NO_CONTEXT_ID != contextId)
                    {current.addContextNode(contextId, current);}
                ancestors.add(current);
            }
            NodeId parentID = current.getNodeId().getParentId();
            while (parentID != null) {
                //Filter out the temporary nodes wrapper element
                if (parentID != NodeId.DOCUMENT_NODE &&
                    !(parentID.getTreeLevel() == && current.getDocument().getCollection().isTempCollection())) {
                    final NodeProxy parent = new NodeProxy(current.getDocument(), parentID, Node.ELEMENT_NODE);
                    if (Expression.NO_CONTEXT_ID != contextId)
                        {parent.addContextNode(contextId, current);}
                    else
                        {parent.copyContext(current);}
                    ancestors.add(parent);
                }
                parentID = parentID.getParentId();
            }
        }
        ancestors.mergeDuplicates();
        return ancestors;
    }
View Full Code Here

   
    private void ensureCapacity() {
    if(size == names.length) {
      // resize
      final int newSize = names.length * 3 / 2;
            NodeId tnodeIds[] = new NodeId[newSize];
            System.arraycopy(nodeIds, 0, tnodeIds, 0, nodeIds.length);

      QName tnames[] = new QName[newSize];
      System.arraycopy(names, 0, tnames, 0, names.length);
     
View Full Code Here

        final NodeIdFactory nodeFactory = getDatabase().getNodeFactory();
        nodeId[0] = nodeFactory.documentNodeId();
        if (size == 1) {
            return;
        }
        NodeId nextId = nodeFactory.createInstance();
        NodeImpl next = (NodeImpl)getFirstChild();
        while (next != null) {
            computeNodeIds(nextId, next.nodeNumber);
            next = (NodeImpl)next.getNextSibling();
            nextId = nextId.nextSibling();
        }
    }
View Full Code Here

    }

    private void computeNodeIds(NodeId id, int nodeNum) {
        nodeId[nodeNum] = id;
        if (nodeKind[nodeNum] == Node.ELEMENT_NODE) {
            NodeId nextId = id.newChild();
            int attr = document.alpha[nodeNum];
            if (-1 < attr) {
                while ((attr < document.nextAttr) && (document.attrParent[attr] == nodeNum)) {
                    attrNodeId[attr] = nextId;
                    nextId = nextId.nextSibling();
                    ++attr;
                }
            }
            int nextNode = getFirstChildFor(nodeNum);
            while (nextNode > nodeNum) {
                computeNodeIds(nextId, nextNode);
                nextNode = document.next[nextNode];
                if (nextNode > nodeNum) {
                    nextId = nextId.nextSibling();
                }
            }
        }
    }
View Full Code Here

        pos += StoredNode.LENGTH_SIGNATURE_LENGTH;
        int children = ByteConversion.byteToInt(data, pos);
        pos += LENGTH_ELEMENT_CHILD_COUNT;
        final int dlnLen = ByteConversion.byteToShort(data, pos);
        pos += NodeId.LENGTH_NODE_ID_UNITS;
        final NodeId dln = doc.getBrokerPool().getNodeFactory().createFromData(dlnLen, data, pos);
        pos += dln.size();
        short attributes = ByteConversion.byteToShort(data, pos);
        pos += LENGTH_ATTRIBUTES_COUNT;
        final short id = (short) Signatures.read(idSizeType, data, pos);
        pos += Signatures.getLength(idSizeType);
        short nsId = 0;
View Full Code Here

     *
     * @param child
     * @throws DOMException
     */
    public void appendChildInternal(StoredNode prevNode, StoredNode child) throws DOMException {
        NodeId childId;
        if (prevNode == null) {
            childId = getNodeId().newChild();
        } else {
            if (prevNode.getNodeId() == null) {
                LOG.warn(getQName() + " : " + prevNode.getNodeName());
View Full Code Here

            {throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "invalid node");}
        children += nodes.getLength();
        for (int i = 0; i < nodes.getLength(); i++) {
            final Node child = nodes.item(i);
            appendChild(transaction, newNodeId, last, lastPath, child, listener);
            NodeId next = newNodeId.nextSibling();
            if (followingId != null && next.equals(followingId)) {
                next = newNodeId.insertNode(followingId);
                if (LOG.isDebugEnabled())
                    {LOG.debug("Node ID collision on " + followingId + ". Using " + next + " instead.");}
            }
            newNodeId = next;
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.