Package org.exist.dom

Examples of org.exist.dom.ExtArrayNodeSet


    @Override
    public NodeSet eval(
        final NGramIndexWorker index, final DocumentSet docs, final List<QName> qnames, final NodeSet nodeSet,
        final int axis, final int expressionId) throws XPathException {
        NodeSet result = new ExtArrayNodeSet();
        for (String s : strings) {
            result.addAll(nGramSearch.fixedStringSearch(index, docs, qnames, s, nodeSet, axis));
        }
        result.iterate(); // ensure result is ready to use
        return result;
    }
View Full Code Here


        ResultSet rs = null;
        NodeSet result = null;
        try {
            int disjointPostFiltered = 0;
            rs = ps.executeQuery();
            result = new ExtArrayNodeSet(); //new ExtArrayNodeSet(docs.getLength(), 250)
            while (rs.next()) {
                DocumentImpl doc = null;
                try {
                    doc = (DocumentImpl)broker.getXMLResource(XmldbURI.create(rs.getString("DOCUMENT_URI")));             
                } catch (PermissionDeniedException e) {
View Full Code Here

     *            the function to be applied to all NodeProxys in nodes
     * @return a new NodeSet containing the non-null results of f applied to the NodeProxys in nodes
     * @throws XPathException
     */
    public static NodeSet fmapNodes(final NodeSet nodes, final F<NodeProxy, NodeProxy> f) throws XPathException {
        NodeSet result = new ExtArrayNodeSet();
        for (NodeSetIterator iterator = nodes.iterator(); iterator.hasNext();) {
            NodeProxy node = f.f(iterator.next());
            if (node != null)
                result.add(node);
        }
        result.iterate(); // ensure result is ready to use
        return result;
    }
View Full Code Here

    public NodeSet search(int contextId, DocumentSet docs, List<QName> qnames, String query, String ngram, XQueryContext context, NodeSet contextSet, int axis)
throws XPathException {
        if (qnames == null || qnames.isEmpty())
            qnames = getDefinedIndexes(context.getBroker(), docs);
        final NodeSet result = new ExtArrayNodeSet(docs.getDocumentCount(), 250);
        for (Iterator<org.exist.collections.Collection> iter = docs.getCollectionIterator(); iter.hasNext();) {
            final int collectionId = iter.next().getId();
            for (int i = 0; i < qnames.size(); i++) {
                QName qname = qnames.get(i);
                NGramQNameKey key = new NGramQNameKey(collectionId, qname, index.getBrokerPool().getSymbols(), query);
                final Lock lock = index.db.getLock();
                try {
                    lock.acquire(Lock.READ_LOCK);
                    SearchCallback cb = new SearchCallback(contextId, query, ngram, docs, contextSet, context, result, axis == NodeSet.ANCESTOR);
                    int op = query.codePointCount(0, query.length()) < getN() ? IndexQuery.TRUNC_RIGHT : IndexQuery.EQ;
                    index.db.query(new IndexQuery(op, key), cb);
                } catch (LockException e) {
                    LOG.warn("Failed to acquire lock for '" + index.db.getFile().getName() + "'", e);
                } catch (IOException e) {
                    LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
                } catch (BTreeException e) {
                    LOG.error(e.getMessage() + " in '" + index.db.getFile().getName() + "'", e);
                } finally {
                    lock.release(Lock.READ_LOCK);
                }
            }
        }

        result.iterate(); // ensure result is ready to use

        return result;
    }
View Full Code Here

            NodeSet ancestors = null;
            Match nextMatch = this.match;
            while (nextMatch != null) {
                if (proxy.getNodeId().isDescendantOf(nextMatch.getNodeId())) {
                    if (ancestors == null)
                        ancestors = new ExtArrayNodeSet();
                    ancestors.add(new NodeProxy(proxy.getDocument(), nextMatch.getNodeId()));
                }
                nextMatch = nextMatch.getNextMatch();
            }
            if (ancestors != null && !ancestors.isEmpty()) {
View Full Code Here

        NodeSet ancestors = null;
        Match nextMatch = this.match;
        while (nextMatch != null) {
            if (proxy.getNodeId().isDescendantOf(nextMatch.getNodeId())) {
                if (ancestors == null)
                    {ancestors = new ExtArrayNodeSet();}
                ancestors.add(new NodeProxy(proxy.getDocument(), nextMatch.getNodeId()));
            }
            nextMatch = nextMatch.getNextMatch();
        }
        if (ancestors != null && !ancestors.isEmpty()) {
View Full Code Here

     * @see org.exist.xquery.value.Sequence#toNodeSet()
     */
    public NodeSet toNodeSet() throws XPathException {
        // for this method to work, all items have to be nodes
        if(itemType != Type.ANY_TYPE && Type.subTypeOf(itemType, Type.NODE)) {
            final NodeSet set = new ExtArrayNodeSet();
            //We can't make it from an ExtArrayNodeSet (probably because it is sorted ?)
            //NodeSet set = new ArraySet(100);
            for (int i = 0; i < this.count; i++) {
                NodeValue v = null;
                final Entry temp = items[i];
                v = (NodeValue)temp.item;
                    if(v.getImplementationType() != NodeValue.PERSISTENT_NODE) {
                    set.add((NodeProxy)v);
                } else {
                    set.add((NodeProxy)v);
                }
            }
            return set;
        } else
            {throw new XPathException("Type error: the sequence cannot be converted into" +
View Full Code Here

            } else
              {--start;}
                       
            Sequence tmp;
            if (seq instanceof NodeSet) {
                tmp = new ExtArrayNodeSet();
                ((ExtArrayNodeSet)tmp).keepUnOrdered(unordered);
            } else {
                tmp = new ValueSequence();
                ((ValueSequence)tmp).keepUnOrdered(unordered);
            }
View Full Code Here

            }

            if (processInMem)
                {result = new ValueSequence();}
            else
                {result = new ExtArrayNodeSet();}

            for(final SequenceIterator i = idrefval.iterate(); i.hasNext(); ) {
          nextId = i.nextItem().getStringValue();
                if (nextId.length() == 0) {continue;}
                if(XMLChar.isValidNCName(nextId)) {
View Full Code Here

    private Sequence evalFallback(NodeSet nodes, String pattern, int flags, int indexType) throws XPathException {
        Sequence result;
        if (LOG.isTraceEnabled())
            {LOG.trace("fn:matches: can't use existing range index of type " + Type.getTypeName(indexType) + ". Need a string index.");}
        result = new ExtArrayNodeSet();
        for(final NodeProxy node : nodes) {
            if (match(node.getStringValue(), pattern, flags))
                {result.add(node);}
        }
        return result;
View Full Code Here

TOP

Related Classes of org.exist.dom.ExtArrayNodeSet

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.