Package org.exist.dom

Examples of org.exist.dom.NodeProxy$SingleNodeIterator


                                            {throw new XPathException("Internal error: nodeId == null");}
                                        if (node.getNodeType() == Node.DOCUMENT_NODE)
                                            {nodeId = rootId;}
                                        else
                                            {nodeId = rootId.append(nodeId);}
                                        NodeProxy p = new NodeProxy(newDoc, nodeId, node.getNodeType());
                                        if (p != null) {
                                            // replace the node by the NodeProxy
                                            items[j].item = p;
                                        }
                                    }
View Full Code Here


  public PreorderedValueSequence(OrderSpec specs[], Sequence input, int contextId) throws XPathException {
    this.orderSpecs = specs;
    nodes = new OrderedNodeProxy[input.getItemCount()];
    int j = 0;
    for(final SequenceIterator i = input.unorderedIterator(); i.hasNext(); j++) {
      final NodeProxy p = (NodeProxy)i.nextItem();
      nodes[j] = new OrderedNodeProxy(p);
      p.addContextNode(contextId, nodes[j]);
    }
    processAll();
  }
View Full Code Here

  private void processAll() throws XPathException {
    for(int i = 0; i < orderSpecs.length; i++) {
      final Expression expr = orderSpecs[i].getSortExpression();
      final NodeSet result = expr.eval(null).toNodeSet();
      for(final Iterator j = result.iterator(); j.hasNext(); ) {
        final NodeProxy p = (NodeProxy)j.next();
        ContextItem context = p.getContext();
        //TODO : review to consider transverse context
        while(context != null) {
          if(context.getNode() instanceof OrderedNodeProxy) {
            final OrderedNodeProxy cp = (OrderedNodeProxy)context.getNode();
            cp.values[i] = p.atomize();
          }
          context = context.getNextDirect();
        }
      }
    }
View Full Code Here

                                        {throw new XPathException("Internal error: nodeId == null");}
                                    if (node.getNodeType() == Node.DOCUMENT_NODE)
                                        {nodeId = rootId;}
                                    else
                                        {nodeId = rootId.append(nodeId);}
                                    NodeProxy p = new NodeProxy(newDoc, nodeId, node.getNodeType());
                                    if (p != null) {
                                        // replace the node by the NodeProxy
                                        values[j] = p;
                                    }
                                }
View Full Code Here

            {context.getProfiler().message(this, Profiler.OPTIMIZATION_FLAGS, "OPTIMIZATION CHOICE", "nodeSetCompare");}   
    final NodeSet result = new ExtArrayNodeSet();
        final Collator collator = getCollator(contextSequence);
        if (contextSequence != null && !contextSequence.isEmpty()) {
            for (final Iterator<NodeProxy> i = nodes.iterator(); i.hasNext();) {
                final NodeProxy current = i.next();
                ContextItem context = current.getContext();
                if (context==null) {
                   throw new XPathException(this,"Context is missing for node set comparison");
                }
                do {
                    final AtomicValue lv = current.atomize();
                    final Sequence rs = getRight().eval(context.getNode().toSequence());                   
                    if (!rs.hasOne())
                        {throw new XPathException(this,
                                "Type error: sequence with less or more than one item is not allowed here");}                   
                    if (compareAtomic(collator, lv, rs.itemAt(0).atomize(), Constants.TRUNC_NONE, relation))
                        {result.add(current);}
                } while ((context = context.getNextDirect()) != null);
            }
        } else {
            final Sequence rs = getRight().eval(null);
            if (!rs.hasOne())
                {throw new XPathException(this,
                        "Type error: sequence with less or more than one item is not allowed here");}
            final AtomicValue rv = rs.itemAt(0).atomize();
            for (final Iterator<NodeProxy> i = nodes.iterator(); i.hasNext();) {
                final NodeProxy current = i.next();
                final AtomicValue lv = current.atomize();
                if (compareAtomic(collator, lv, rv, Constants.TRUNC_NONE, Constants.EQ))
                    {result.add(current);}
            }
        }
        return result;
View Full Code Here

            nextCollection = null;
            while (pos <= size) {
                if (Type.subTypeOf(values[pos].getType(), Type.NODE)) {
                    final NodeValue node = (NodeValue) values[pos];
                    if (node.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                        final NodeProxy p = (NodeProxy) node;
                        if (!p.getDocument().getCollection().equals(oldCollection)) {
                            nextCollection = p.getDocument().getCollection();
                            break;
                        }
                    }
                }
                pos++;
View Full Code Here

   
    // Scaling last
    int lastlo=last+lo;
   
    for(int k=hi; k>lo; k--) {
      final NodeProxy temp=a[k];
      a[k]=a[lo];
      siftdownByNodeId(a, k, lo, temp, drop);
      if (k==lastlo) {
        drop--;
        last/=2;
View Full Code Here

    // 2b, just two elements
    if(lo0+1 == hi0)  {return;}
   
    // Last case, the general one
    for (int i = lo0 + 1; i < hi0; i++) {
      NodeProxy temp=a[i+1];
      if (temp.getNodeId().compareTo(a[i].getNodeId()) < 0) {
        int j;
       
        for(j=i;j>=lo0 && temp.getNodeId().compareTo(a[j].getNodeId()) < 0;j--) {
          a[j+1]=a[j];
        }
        a[j+1]=temp;
      }
    }
View Full Code Here

        final Sequence seq = getArgument(0).eval(contextSequence, contextItem);
        Sequence result = Sequence.EMPTY_SEQUENCE;
        if (!seq.isEmpty()) {
            final NodeValue value = (NodeValue) seq.itemAt(0);
            if (value.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                final NodeProxy node = (NodeProxy) value;
                //Returns the empty sequence if the node is not a document node.
                if (node.isDocument()) {
                    final XmldbURI path = node.getDocument().getURI();
                    result = new AnyURIValue(path);
                }
            } else {
                if (value instanceof DocumentImpl &&
                    ((DocumentImpl)value).getDocumentURI() != null) {
View Full Code Here

                String uri = null;

                final NodeValue node = (NodeValue) args[1].itemAt(0);
                if (node.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                    NodeProxy proxy = (NodeProxy) node;
                    final NodeSet ancestors = proxy.getAncestors(contextId, true);
                    for (final Iterator<NodeProxy> i = ancestors.iterator(); i.hasNext();) {
                        proxy = i.next();
                        final ElementImpl e = (ElementImpl) proxy.getNode();
                        uri = findNamespaceURI(e, prefix);
                        if (uri != null) {
                            break;
                        }
                    }
View Full Code Here

TOP

Related Classes of org.exist.dom.NodeProxy$SingleNodeIterator

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.