Examples of PagingProfile


Examples of xbird.xquery.dm.dtm.PagingProfile

    public void export(final XQNode curNode, final XQEventReceiver receiver) throws XQueryException {
        this.export(curNode.getPosition(), receiver);
    }

    public void export(final long nodeid, final XQEventReceiver receiver) throws XQueryException {
        final PagingProfile profile = _store.getPagingProfile();
        Strategy origStrategy = null;
        if(profile != null) {
            origStrategy = profile.getStrategy();
            profile.setStrategy(Strategy.serialization);
        }
        final IDocumentTable doctbl = _store;
        doctbl.ensureOpen();
        switch(doctbl.getNodeKindAt(nodeid)) {
            case NodeKind.DOCUMENT:
                receiver.evStartDocument();
                final long firstChild = doctbl.firstChild(nodeid);
                if(firstChild != -1L) {
                    export(firstChild, receiver);
                    long nextSib = doctbl.nextSibling(firstChild);
                    while(nextSib != 0L) {
                        export(nextSib, receiver);
                        nextSib = doctbl.nextSibling(firstChild);
                    }
                }
                receiver.evEndDocument();
                break;
            case NodeKind.ELEMENT:
                final QualifiedName qname = doctbl.getName(nodeid);
                receiver.evStartElement(nodeid, qname);
                // namespace decl
                final int nsdeclCnt = doctbl.getNamespaceCountAt(nodeid);
                for(int i = 0; i < nsdeclCnt; i++) {
                    final long nsid = doctbl.getNamespaceDecl(nodeid, i);
                    final QualifiedName nsName = doctbl.getAttributeName(nsid);
                    final String uri = doctbl.getText(nsid);
                    receiver.evNamespace(nsid, nsName, uri);
                }
                // attribute
                final int attrCnt = doctbl.getAttributeCountAt(nodeid);
                for(int i = 0; i < attrCnt; i++) {
                    final long attid = doctbl.getAttribute(nodeid, i);
                    final QualifiedName attName = doctbl.getAttributeName(attid);
                    final String attValue = doctbl.getText(attid);
                    receiver.evAttribute(attid, attName, attValue);
                }
                final long elemFirstChild = doctbl.firstChild(nodeid);
                if(elemFirstChild != -1L) {
                    export(elemFirstChild, receiver);
                    long nextSib = doctbl.nextSibling(elemFirstChild);
                    while(nextSib != 0L) {
                        export(nextSib, receiver);
                        nextSib = doctbl.nextSibling(nextSib);
                    }
                }
                receiver.evEndElement(nodeid, qname);
                break;
            case NodeKind.ATTRIBUTE:
                receiver.evAttribute(nodeid, doctbl.getAttributeName(nodeid), doctbl.getText(nodeid));
                break;
            case NodeKind.NAMESPACE:
                receiver.evNamespace(nodeid, doctbl.getAttributeName(nodeid), doctbl.getText(nodeid));
                break;
            case NodeKind.TEXT:
                receiver.evText(nodeid, doctbl.getText(nodeid));
                break;
            case NodeKind.COMMENT:
                receiver.evComment(nodeid, doctbl.getText(nodeid));
                break;
            case NodeKind.PROCESSING_INSTRUCTION:
                final QualifiedName pi = doctbl.getName(nodeid);
                receiver.evProcessingInstruction(nodeid, pi.getLocalPart(), pi.getNamespaceURI());
                break;
            default:
                throw new IllegalStateException("Invalid node kind '"
                        + NodeKind.resolveName(doctbl.getNodeKindAt(nodeid)) + "' for node#"
                        + nodeid);
        }
        if(profile != null) {
            profile.setStrategy(origStrategy);
        }
    }
View Full Code Here

Examples of xbird.xquery.dm.dtm.PagingProfile

            return null;
        }

        @Override
        public final XQNode following(final boolean firstcall) {
            final PagingProfile profile = _store.getPagingProfile();
            final XQNode node;
            if(profile != null) {
                Strategy origStrategy = profile.getStrategy();
                if(origStrategy != Strategy.nextsib) {
                    assert (origStrategy != null);
                    profile.setStrategy(Strategy.nextsib);
                    node = super.following(firstcall);
                    profile.setStrategy(origStrategy);
                } else {
                    node = super.following(firstcall);
                }
            } else {
                node = super.following(firstcall);
View Full Code Here

Examples of xbird.xquery.dm.dtm.PagingProfile

        final NodeSequence<DTMDocument> ret = new NodeSequence<DTMDocument>(dynEnv);
        for(DTMDocument d : docs) {
            ret.addItem(d);
            if(profiler != null && !(d instanceof LazyDTMDocument)) {
                IDocumentTable doctbl = d.documentTable();
                PagingProfile profile = doctbl.getPagingProfile();
                if(profile != null) {
                    profile.setProfiler(profiler);
                }
            }
        }
        return ret;
    }
View Full Code Here

Examples of xbird.xquery.dm.dtm.PagingProfile

                        doctbl = DocumentTableLoader.load(col, docName, _dynEnv);
                    } catch (IOException e) {
                        throw new XQRTException("failed to load document '" + docName
                                + "' is the collection '" + col.getAbsolutePath() + '\'', e);
                    }
                    final PagingProfile profile = doctbl.getPagingProfile();
                    Strategy origStrategy = null;
                    if(profile != null) {
                        profile.setProfiler(profiler);
                        origStrategy = profile.getStrategy();
                        profile.setStrategy(Strategy.index);
                    }
                    DocumentTableModel dtm = new DocumentTableModel(doctbl, true);
                    final int last = matchCounts - 1;
                    for(int i = 0; i <= last; i++) {
                        long ptr = ptrs[i];
                        if(ptr != -1) {
                            XQNode node = dtm.createNode(ptr);
                            ffcous.setContextItem(node);
                            if(i != last) {
                                LongQueue ptrsQueue = new LongQueue(ptrs, i + 1, last);
                                ffcous.enqueue(dtm, ptrsQueue);
                            }
                            if(profile != null) {
                                profile.setStrategy(origStrategy);
                            }
                            return true;
                        }
                    }
                    if(profile != null) {
                        profile.setStrategy(origStrategy);
                    }
                    return false;
                }
            }
            ffcous.setReachedEnd(true);
View Full Code Here

Examples of xbird.xquery.dm.dtm.PagingProfile

    public void export(final XQNode curNode, final XQEventReceiver receiver) throws XQueryException {
        this.export(curNode.getPosition(), receiver);
    }

    public void export(final long nodeid, final XQEventReceiver receiver) throws XQueryException {
        final PagingProfile profile = _store.getPagingProfile();
        Strategy origStrategy = null;
        if(profile != null) {
            origStrategy = profile.getStrategy();
            profile.setStrategy(Strategy.serialization);
        }
        final IDocumentTable doctbl = _store;
        switch(doctbl.getNodeKindAt(nodeid)) {
            case NodeKind.DOCUMENT:
                receiver.evStartDocument();
                final long firstChild = doctbl.firstChild(nodeid);
                if(firstChild != -1L) {
                    export(firstChild, receiver);
                    long nextSib = doctbl.nextSibling(firstChild);
                    while(nextSib != 0L) {
                        export(nextSib, receiver);
                        nextSib = doctbl.nextSibling(firstChild);
                    }
                }
                receiver.evEndDocument();
                break;
            case NodeKind.ELEMENT:
                final QualifiedName qname = doctbl.getName(nodeid);
                receiver.evStartElement(nodeid, qname);
                // namespace decl
                final int nsdeclCnt = doctbl.getNamespaceCountAt(nodeid);
                for(int i = 0; i < nsdeclCnt; i++) {
                    final long nsid = doctbl.getNamespaceDecl(nodeid, i);
                    final QualifiedName nsName = doctbl.getAttributeName(nsid);
                    final String uri = doctbl.getText(nsid);
                    receiver.evNamespace(nsid, nsName, uri);
                }
                // attribute
                final int attrCnt = doctbl.getAttributeCountAt(nodeid);
                for(int i = 0; i < attrCnt; i++) {
                    final long attid = doctbl.getAttribute(nodeid, i);
                    final QualifiedName attName = doctbl.getAttributeName(attid);
                    final String attValue = doctbl.getText(attid);
                    receiver.evAttribute(attid, attName, attValue);
                }
                final long elemFirstChild = doctbl.firstChild(nodeid);
                if(elemFirstChild != -1L) {
                    export(elemFirstChild, receiver);
                    long nextSib = doctbl.nextSibling(elemFirstChild);
                    while(nextSib != 0L) {
                        export(nextSib, receiver);
                        nextSib = doctbl.nextSibling(nextSib);
                    }
                }
                receiver.evEndElement(nodeid, qname);
                break;
            case NodeKind.ATTRIBUTE:
                receiver.evAttribute(nodeid, doctbl.getAttributeName(nodeid), doctbl.getText(nodeid));
                break;
            case NodeKind.NAMESPACE:
                receiver.evNamespace(nodeid, doctbl.getAttributeName(nodeid), doctbl.getText(nodeid));
                break;
            case NodeKind.TEXT:
                receiver.evText(nodeid, doctbl.getText(nodeid));
                break;
            case NodeKind.COMMENT:
                receiver.evComment(nodeid, doctbl.getText(nodeid));
                break;
            case NodeKind.PROCESSING_INSTRUCTION:
                final QualifiedName pi = doctbl.getName(nodeid);
                receiver.evProcessingInstruction(nodeid, pi.getLocalPart(), pi.getNamespaceURI());
                break;
            default:
                throw new IllegalStateException("Invalid node kind '"
                        + NodeKind.resolveName(doctbl.getNodeKindAt(nodeid)) + "' for node#"
                        + nodeid);
        }
        if(profile != null) {
            profile.setStrategy(origStrategy);
        }
    }
View Full Code Here

Examples of xbird.xquery.dm.dtm.PagingProfile

            return null;
        }

        @Override
        public final XQNode following(final boolean firstcall) {
            final PagingProfile profile = _store.getPagingProfile();
            final XQNode node;
            if(profile != null) {
                Strategy origStrategy = profile.getStrategy();
                if(origStrategy != Strategy.nextsib) {
                    assert (origStrategy != null);
                    profile.setStrategy(Strategy.nextsib);
                    node = super.following(firstcall);
                    profile.setStrategy(origStrategy);
                } else {
                    node = super.following(firstcall);
                }
            } else {
                node = super.following(firstcall);
View Full Code Here

Examples of xbird.xquery.dm.dtm.PagingProfile

                        doctbl = DocumentTableLoader.load(col, docName, _dynEnv);
                    } catch (IOException e) {
                        throw new XQRTException("failed to load document '" + docName
                                + "' is the collection '" + col.getAbsolutePath() + '\'', e);
                    }
                    final PagingProfile profile = doctbl.getPagingProfile();
                    Strategy origStrategy = null;
                    if(profile != null) {
                        profile.setProfiler(profiler);
                        origStrategy = profile.getStrategy();
                        profile.setStrategy(Strategy.index);
                    }
                    DocumentTableModel dtm = new DocumentTableModel(doctbl, true);
                    final int last = matchCounts - 1;
                    for(int i = 0; i <= last; i++) {
                        long ptr = ptrs[i];
                        if(ptr != -1) {
                            XQNode node = dtm.createNode(ptr);
                            ffcous.setContextItem(node);
                            if(i != last) {
                                LongQueue ptrsQueue = new LongQueue(ptrs, i + 1, last);
                                ffcous.enqueue(dtm, ptrsQueue);
                            }
                            if(profile != null) {
                                profile.setStrategy(origStrategy);
                            }
                            return true;
                        }
                    }
                    if(profile != null) {
                        profile.setStrategy(origStrategy);
                    }
                    return false;
                }
            }
            ffcous.setReachedEnd(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.