Package net.sf.saxon.functions

Examples of net.sf.saxon.functions.NumberFn


        if (th.isSubType(type0, BuiltInAtomicType.INTEGER) &&
                th.isSubType(type1, BuiltInAtomicType.INTEGER) &&
                (operator == Token.PLUS || operator == Token.MINUS || operator == Token.MULT)) {
            ArithmeticExpression arith = new ArithmeticExpression(operand0, operator, operand1);
            arith.simplified = true;
            NumberFn n = (NumberFn)SystemFunction.makeSystemFunction("number", new Expression[]{arith});
            return n.typeCheck(visitor, contextItemType);
        }

        if (calculator == null) {
            operand0 = createConversionCode(operand0, th, type0);
        }
View Full Code Here


        condition = new BooleanExpression(condition, Token.OR, isString);
        condition = new BooleanExpression(condition, Token.OR, isUntypedAtomic);
        condition = new BooleanExpression(condition, Token.OR, isBoolean);

        var = new LocalVariableReference(let);
        NumberFn fn = (NumberFn)SystemFunction.makeSystemFunction("number", new Expression[]{var});

        var = new LocalVariableReference(let);
        var.setStaticType(SequenceType.SINGLE_ATOMIC, null, 0);
        Expression action = Choose.makeConditional(condition, fn, var);
        let.setAction(action);
View Full Code Here

                    cardOK = Cardinality.subsumes(reqCard, suppliedCard);
                    itemTypeOK = true;
                }
                // rule 3
                if (reqItemType.equals(BuiltInAtomicType.NUMERIC) || reqItemType.equals(BuiltInAtomicType.DOUBLE)) {
                    NumberFn fn = (NumberFn)SystemFunction.makeSystemFunction("number", new Expression[]{exp});
                    try {
                        exp = visitor.typeCheck(visitor.simplify(fn), AnyItemType.getInstance());
                    } catch (XPathException err) {
                        err.maybeSetLocation(exp);
                        throw err.makeStatic();
View Full Code Here

        // If the operator is one of <, >, <=, >=, then convert both operands to sequences of xs:double
        // using the number() function

        if (operator == Token.LT || operator == Token.LE || operator == Token.GT || operator == Token.GE) {
            iter0 = new ItemMappingIterator(iter0, new NumberFn(), true);
            iter1 = new ItemMappingIterator(iter1, new NumberFn(), true);
        }

        // Compare all pairs of atomic values in the two atomized sequences

        List seq1 = null;
View Full Code Here

            } else if (reqItemType == Type.NUMBER_TYPE || Type.isSubType(reqItemType, Type.DOUBLE_TYPE)) {
                // TODO: in the Nov 2003 draft, the rules have changed so that number() is called
                // only if the supplied value doesn't match the expected type. We're currently
                // returning different results for round(()) depending on whether the arg value
                // is known statically or not.
                NumberFn fn = (NumberFn)SystemFunction.makeSystemFunction("number", env.getNamePool());
                Expression[] args = new Expression[1];
                args[0] = exp;
                fn.setArguments(args);
                if (exp instanceof Value) {
                    try {
                        exp = ExpressionTool.eagerEvaluate(fn, null);
                    } catch (XPathException err) {
                        throw new StaticError(err);
                    }
                } else {
                    fn.adoptChildExpression(exp);
                    exp = fn;
                }
                suppliedItemType = Type.DOUBLE_TYPE;
                suppliedCard = StaticProperty.EXACTLY_ONE;
                cardOK = Cardinality.subsumes(reqCard, suppliedCard);
View Full Code Here

        // If the operator is one of <, >, <=, >=, then convert both operands to sequences of xs:double
        // using the number() function

        if (operator == Token.LT || operator == Token.LE || operator == Token.GT || operator == Token.GE) {
            iter0 = new ItemMappingIterator(iter0, new NumberFn());
            iter1 = new ItemMappingIterator(iter1, new NumberFn());
        }

        // Compare all pairs of atomic values in the two atomized sequences

        List seq1 = null;
View Full Code Here

                    cardOK = Cardinality.subsumes(reqCard, suppliedCard);
                    itemTypeOK = true;
                }
                // rule 3
                if (reqItemType.equals(BuiltInAtomicType.NUMERIC) || reqItemType.equals(BuiltInAtomicType.DOUBLE)) {
                    NumberFn fn = (NumberFn)SystemFunction.makeSystemFunction("number", new Expression[]{exp});
                    try {
                        exp = visitor.typeCheck(visitor.simplify(fn), AnyItemType.getInstance());
                    } catch (XPathException err) {
                        err.maybeSetLocation(exp);
                        throw err.makeStatic();
View Full Code Here

        condition = new BooleanExpression(condition, Token.OR, isString);
        condition = new BooleanExpression(condition, Token.OR, isUntypedAtomic);
        condition = new BooleanExpression(condition, Token.OR, isBoolean);

        var = new LocalVariableReference(let);
        NumberFn fn = (NumberFn)SystemFunction.makeSystemFunction("number", new Expression[]{var});

        var = new LocalVariableReference(let);
        var.setStaticType(SequenceType.SINGLE_ATOMIC, null, 0);
        Expression action = Choose.makeConditional(condition, fn, var);
        let.setAction(action);
View Full Code Here

TOP

Related Classes of net.sf.saxon.functions.NumberFn

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.