Examples of XInteger


Examples of xbird.xquery.dm.value.literal.XInteger

        return s;
    }

    public XInteger eval(DynamicContext dynEnv, Item... args) throws XQueryException {
        assert (args.length == 2) : args;
        final XInteger result;
        final Item it1 = args[0];
        final Item it2 = args[1];
        switch(combinedArgTypes(it1, it2)) {
            case INT_INT:
                long ll1 = DivInteger.compute(it1, it2, dynEnv);
                result = new XInteger(ll1);
                break;
            case DECIMAL_DECIMAL:
            case DECIMAL_INT:
            case INT_DECIMAL:
                BigDecimal bd2 = DivDecimal.compute(it1, it2, dynEnv);
                long ll2 = bd2.longValue();
                result = new XInteger(ll2);
                break;
            case FLOAT_INT:
            case FLOAT_FLOAT:
            case FLOAT_DECIMAL:
            case INT_FLOAT:
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

        }
        if(res == Float.NEGATIVE_INFINITY) {
            throw new DynamicError("err:FOAR0002", "result underflow");
        }
        long casted = (long) res;
        return new XInteger(casted);
    }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

        }
        if(res == Double.NEGATIVE_INFINITY) {
            throw new DynamicError("err:FOAR0002", "result underflow");
        }
        long casted = (long) res;
        return new XInteger(casted);
    }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

        if(focus == null) {
            throw new DynamicError("err:XPDY0002", "Focus of fileter is not set");
        }
        int last = focus.getLast();
        if(last != -1) {
            return new XInteger(last);
        }
        final Sequence<? extends Item> src = dynEnv.peekSequence();
        if(src == null) {
            throw new DynamicError("err:XPDY0002", "Source of fileter is not set");
        }
        last = 0;
        IFocus<? extends Item> srcItor = src.iterator();
        for(Item it : srcItor) {
            ++last;
        }
        srcItor.closeQuietly();
        focus.setLast(last);
        return new XInteger(last);
    }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

                final PlusOp op = new PlusOp();
                op.staticAnalysis(dynEnv.getStaticContext(), sum, toadd);
                sum = (XNumber) op.eval(dynEnv, sum, toadd);
            }
            final DivOp op = new DivOp();
            final XInteger divby = XInteger.valueOf(size);
            op.staticAnalysis(dynEnv.getStaticContext(), sum, divby);
            return op.eval(dynEnv, sum, divby);
        } else if(firstItem instanceof DurationValue) {
            // Duration values must either all be xdt:yearMonthDuration values
            // or must all be xdt:dayTimeDuration values.
            DurationValue sum = (DurationValue) firstItem;
            Type firstType = firstItem.getType();
            assert (firstType != null);
            int size;
            for(size = 1; argItor.hasNext(); size++) {
                Item toadd = argItor.next();
                if(toadd instanceof DurationValue) {
                    throw new DynamicError("err:FORG0006", "Duration values must all be `"
                            + firstType + "`, but found `" + toadd.getType() + "`");
                }
                final PlusOp op = new PlusOp();
                op.staticAnalysis(dynEnv.getStaticContext(), sum, toadd);
                sum = (DurationValue) op.eval(dynEnv, sum, toadd);
            }
            final DivOp op = new DivOp();
            final XInteger divby = XInteger.valueOf(size);
            op.staticAnalysis(dynEnv.getStaticContext(), sum, divby);
            return op.eval(dynEnv, sum, divby);
        } else {
            throw new DynamicError("err:FORG0006", "Invalid argument type: " + firstItem.getType());
        }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        Item firstItem = argv.getItem(0);
        String str = firstItem.stringValue();
        int hashvalue = str.hashCode();
        return new XInteger(hashvalue);
    }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

        ForAtEmurationSequence(BindingVariable bindingVar, PositionalVariable posVar, Sequence src, DynamicContext dynEnv) {
            super(bindingVar, src, dynEnv);
            if(posVar == null) {
                throw new IllegalStateException();
            }
            XInteger posv = new XInteger(0);
            posVar.allocateResult(posv, dynEnv);
            this._posv = posv;
        }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

        secondItor.closeQuietly();
        final ValueSequence newSeq = new ValueSequence(dynEnv);
        final int from = ((XInteger) firstItem).getNumber().intValue();
        final int to = ((XInteger) secondItem).getNumber().intValue();
        for(int i = from; i <= to; i++) {
            newSeq.addItem(new XInteger(i));
        }
        return newSeq;
    }
View Full Code Here

Examples of xbird.xquery.dm.value.literal.XInteger

        final AtomicValue value;
        switch(jj_nt.kind) {
            case IntegerLiteral:
                // IntegerLiteral
                currentToken = jj_consume_token(IntegerLiteral);
                value = new XInteger(currentToken.image);
                break;
            case DecimalLiteral:
                // DecimalLiteral
                currentToken = jj_consume_token(DecimalLiteral);
                value = new XDecimal(currentToken.image);
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.