Package xbird.xquery.dm.value

Examples of xbird.xquery.dm.value.Item


    }

    public boolean next(IFocus focus) throws XQueryException {
        final Iterator<? extends Item> itor = focus.getBaseFocus();
        if(itor.hasNext()) {
            Item it = itor.next();
            focus.setContextItem(it);
            return true;
        }
        return false;
    }
View Full Code Here


                    GroupingSpec spec = specs[i];
                    Sequence result = spec.getKeyExpr().eval(contextSeq, dynEnv);
                    Sequence atomized = result.atomize(dynEnv);
                    IFocus atomizedItor = atomized.iterator();

                    final Item groupKey;
                    if(atomizedItor.hasNext()) {
                        AtomicValue atom = (AtomicValue) atomizedItor.next();
                        if(atomizedItor.hasNext()) {
                            atomizedItor.closeQuietly();
                            throw new DynamicError("err:XQDY0095", "Illegal resulting value for a grouping variable: "
View Full Code Here

                final Sequence prevValue = nonGroupingVaribales.get(var);
                if(prevValue == null) {
                    nonGroupingVaribales.put(var, result);
                } else {
                    if(prevValue instanceof ValueSequence) {
                        Item resultItem = SingleCollection.wrap(result, dynEnv);
                        ((ValueSequence) prevValue).addItem(resultItem);
                    } else {
                        final List<Item> list = new ArrayList<Item>(4);
                        list.add(SingleCollection.wrap(prevValue, dynEnv));
                        list.add(SingleCollection.wrap(result, dynEnv));
View Full Code Here

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        final int size = in.readInt();
        ArrayList<Item> items = new ArrayList<Item>(size);
        for(int i = 0; i < size; i++) {
            Item e = (Item) in.readObject();
            items.add(e);
        }
        _items.addAll(items);
    }
View Full Code Here

    public void writeExternal(ObjectOutput out) throws IOException {
        final List<Item> items = _items;
        final int size = items.size();
        out.writeInt(size);
        for(int i = 0; i < size; i++) {
            Item it = items.get(i);
            out.writeObject(it);
        }
    }
View Full Code Here

        final StringBuilder buf = new StringBuilder();
        for(int i = 0; i < _items.size(); i++) {
            if(i != 0) {
                buf.append(' ');
            }
            Item it = _items.get(i);
            buf.append(it.stringValue());
        }
        return buf.toString(); // TODO cache
    }
View Full Code Here

    }

    public boolean next(IFocus focus) throws XQueryException {
        final int pos = focus.getContextPosition();
        if(pos < _items.size()) {
            Item it = _items.get(pos);
            focus.setContextItem(it);
            return true;
        }
        return false;
    }
View Full Code Here

        return _items.isEmpty();
    }

    public int compareTo(Item trg) {
        if(size() > 0) {
            Item it = _items.get(0);
            return it.compareTo(trg);
        }
        return -1; // TODO empty last?
    }
View Full Code Here

        if(_reachedEnd) {
            return null;
        }
        int rest = _fetchedQueue.size();
        if(rest > 0) {
            Item head = _fetchedQueue.poll();
            this._citem = head;
            ++_cpos;
            return head;
        }
        if(_nomoreFetch) {
            this._reachedEnd = true;
            close(true);
            return null;
        }
        int fetchedLength = fetch();
        if(fetchedLength == 0) {
            this._reachedEnd = true;
            close(true);
            return null;
        }
        Item head = _fetchedQueue.peek();
        this._citem = head;
        ++_cpos;
        return head;
    }
View Full Code Here

                if(!hasmore) {
                    break;
                }
                ++count;
                Object ro = ois.readObject();
                Item fetched = (Item) ro;
                _fetchedQueue.offer(fetched);
                if(count == _fetchSize) {
                    break;
                }
            }
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.