Package net.sf.saxon.value

Examples of net.sf.saxon.value.NumericValue.round()


            case FLOOR:
                return val.floor();
            case CEILING:
                return val.ceiling();
            case ROUND:
                return val.round();
            case HALF_EVEN:
                int scale = 0;
                if (argument.length==2) {
                    AtomicValue scaleVal0 = (AtomicValue)argument[1].evaluateItem(context);
                    NumericValue scaleVal = (NumericValue)scaleVal0;
View Full Code Here


        if (e != this) {
            return e;
        }
        if (getNumberOfArguments() == 2 && Literal.isAtomic(argument[1])) {
            NumericValue start = (NumericValue)((Literal)argument[1]).getValue();
            start = start.round();
            long intstart = start.longValue();
            if (intstart > Integer.MAX_VALUE) {
                return new Literal(EmptySequence.getInstance());
            }
            return new TailExpression(argument[0], (int)intstart);
View Full Code Here

                lstart = startVal.longValue();
                if (lstart <= 1) {
                    return seq;
                }
            } else {
                startVal = startVal.round();
                if (startVal.compareTo(Int64Value.PLUS_ONE) <= 0) {
                    return seq;
                } else if (startVal.compareTo(Int64Value.MAX_LONG) > 0) {
                    return EmptyIterator.getInstance();
                } else if (startVal.isNaN()) {
View Full Code Here

                startVal = startVal.round();

                if (lengthVal.isNaN()) {
                    return EmptyIterator.getInstance();
                }
                lengthVal = lengthVal.round();

                if (lengthVal.compareTo(Int64Value.ZERO) <= 0) {
                    return EmptyIterator.getInstance();
                }
                NumericValue rend = (NumericValue)ArithmeticExpression.compute(
View Full Code Here

            case FLOOR:
                return val.floor();
            case CEILING:
                return val.ceiling();
            case ROUND:
                return val.round();
            case HALF_EVEN:
                int scale = 0;
                if (argument.length==2) {
                    AtomicValue scaleVal0 = (AtomicValue)argument[1].evaluateItem(context);
                    NumericValue scaleVal = (NumericValue)scaleVal0.getPrimitiveValue();
View Full Code Here

                    if (val instanceof NumericValue) {
                        num = (NumericValue) val;
                    } else {
                        num = NumberFn.convert(val);
                    }
                    num = num.round();
                    if (num.compareTo(IntegerValue.MAX_LONG) > 0) {
                        DynamicError e = new DynamicError("A number is too large to be formatted");
                        e.setXPathContext(context);
                        e.setErrorCode("SAXON:0000");
                        throw e;
View Full Code Here

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        SequenceIterator seq = argument[0].iterate(context);
        AtomicValue startVal0 = (AtomicValue)argument[1].evaluateItem(context);
        NumericValue startVal = (NumericValue)startVal0.getPrimitiveValue();
        int start = (int)startVal.round().longValue();

        if (argument.length==3) {
            AtomicValue lengthVal0 = (AtomicValue)argument[2].evaluateItem(context);
            NumericValue lengthVal = (NumericValue)lengthVal0.getPrimitiveValue();
            int end = start + (int)lengthVal.round().longValue() - 1;
View Full Code Here

        int start = (int)startVal.round().longValue();

        if (argument.length==3) {
            AtomicValue lengthVal0 = (AtomicValue)argument[2].evaluateItem(context);
            NumericValue lengthVal = (NumericValue)lengthVal0.getPrimitiveValue();
            int end = start + (int)lengthVal.round().longValue() - 1;
            if (start < 1) {
                start = 1;
            }
            return PositionIterator.make(seq, start, end);
        } else {
View Full Code Here

            case FLOOR:
                return val.floor();
            case CEILING:
                return val.ceiling();
            case ROUND:
                return val.round();
            case HALF_EVEN:
                int scale = 0;
                if (argument.length==2) {
                    AtomicValue scaleVal0 = (AtomicValue)argument[1].evaluateItem(context);
                    NumericValue scaleVal = (NumericValue)scaleVal0;
View Full Code Here

        if (e != this) {
            return e;
        }
        if (getNumberOfArguments() == 2 && Literal.isAtomic(argument[1])) {
            NumericValue start = (NumericValue)((Literal)argument[1]).getValue();
            start = start.round();
            long intstart = start.longValue();
            if (intstart > Integer.MAX_VALUE) {
                return new Literal(EmptySequence.getInstance());
            }
            return new TailExpression(argument[0], (int)intstart);
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.