Package xbird.xquery.dm.value

Examples of xbird.xquery.dm.value.Item


            throw new XQRTException("failed to deserialize the fetched items", ioe);
        }
        try {
            for(int i = 0; i < fetchedLength; i++) {
                Object ro = ois.readObject();
                Item fetched = (Item) ro;
                _fetchedQueue.offer(fetched);
            }
        } catch (IOException ioe) {
            throw new XQRTException("failed to deserialize the fetched items", ioe);
        } catch (ClassNotFoundException cnf) {
View Full Code Here


        if(item instanceof SingleCollection) {
            final IFocus<Item> focus = item.iterator();
            item = focus.next();
            assert (!focus.hasNext());
        }
        Item prev = _citem;
        this._citem = item;
        return prev;
    }
View Full Code Here

    }

    public boolean next(IFocus focus) throws XQueryException {
        final Iterator<? extends XQNode> delItor = focus.getBaseFocus();
        if(delItor.hasNext()) {
            Item delItem = delItor.next();
            final XQNode node;
            if(delItem instanceof XQNode) {
                node = (XQNode) delItem;
            } else { // TODO REVIEWME work around
                node = XQueryDataModel.createText(delItem.stringValue());
            }
            focus.setContextItem(node);
            return true;
        }
        focus.closeQuietly();
View Full Code Here

    @SuppressWarnings("unchecked")
    public boolean next(IFocus<Item> focus) throws XQueryException {
        ChainedIterator<Item> itor = (ChainedIterator<Item>) focus.getBaseFocus();
        while(itor.hasNext()) {
            Item it = itor.next();
            focus.setContextItem(it);
            return true;
        }
        focus.setReachedEnd(true);
        IFocus firstItor = (IFocus) itor.getFirstIterator();
View Full Code Here

                return false;
            }
            if(seeked != null) {
                return true;
            }
            final Item nextItem = emurateNext();
            if(nextItem != null) {
                this.seeked = nextItem;
                return true;
            } else {
                return false;
View Full Code Here

        }

        private Item emurateNext() {
            assert (!reachedEnd);
            assert (seeked == null);
            final Item item;
            try {
                item = exqueue_.take();
            } catch (InterruptedException e) {
                LOG.error(PrintUtils.prettyPrintStackTrace(e));
                throw new IllegalStateException(e);
View Full Code Here

        public Item next() {
            if(reachedEnd) {
                throw new NoSuchElementException("Already reached end");
            }
            if(seeked != null) {
                Item curr = seeked;
                this.seeked = null;
                this._citem = curr;
                _cpos++;
                return curr;
            }
            final Item next = emurateNext();
            if(next == null) {
                throw new NoSuchElementException();
            }
            this._citem = next;
            _cpos++;
View Full Code Here

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        assert (argv != null && argv.size() == 2);
        // If $qname is the empty sequence, returns the empty sequence.
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        XString qname = (XString) firstItem;
        String qnameStr = qname.getValue();
        final int pos = qnameStr.indexOf(':');
        final String nsuri;
        if(pos == -1) {
            // If the $qname has no prefix, and there is no namespace binding for $element
            // corresponding to the default (unnamed) namespace, then the resulting expanded-QName
            // has no namespace part.
            nsuri = XMLUtils.NULL_NS_URI;
        } else {
            final String prefix = qnameStr.substring(0, pos - 1);
            Item secondItem = argv.getItem(1);
            XQNode element = (XQNode) secondItem;
            nsuri = NamespaceUriForPrefix.resolveNamespaceUri(element, prefix);
            if(nsuri == null) {
                // If the $qname has a prefix and if there is no namespace binding for $element
                // that matches this prefix, then an error is raised [err:FONS0004].
View Full Code Here

    @SuppressWarnings("unchecked")
    public boolean next(IFocus focus) throws XQueryException {
        final MultiplexingIterator<Item> itor = (MultiplexingIterator<Item>) focus.getBaseFocus();
        while(itor.hasNext()) {
            Item it = itor.next();
            focus.setContextItem(it);
            return true;
        }
        focus.setReachedEnd(true);
        IOUtils.closeQuietly(itor);
View Full Code Here

                        notify();
                    }
                }
                break;
            }
            Item result = delegate.next();
            oos.writeBoolean(true /* hasNext */);
            oos.writeObject(result);
            if(i == atleast) {
                synchronized(this) {
                    notify();
View Full Code Here

TOP

Related Classes of xbird.xquery.dm.value.Item

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.