Package net.sf.saxon.value

Examples of net.sf.saxon.value.IntegerValue


    }

    public Value transform(Object source, TransformationContext context) {
       Value result = null;
         if (source instanceof Integer) {
             result = new IntegerValue((Integer)source);
         } else if (source instanceof Long) {
             result = new IntegerValue((Long)source);
         } else if (source instanceof Short) {
             result = new IntegerValue((Short)source);
         } else if (source instanceof Byte) {
             result = new IntegerValue((Byte)source);
         } else if (source instanceof Double) {
             result = new DoubleValue((Double)source);
         } else if (source instanceof Float) {
             result = new FloatValue((Float)source);
         } else if (source instanceof BigDecimal) {
View Full Code Here


    }

    public Value transform(Object source, TransformationContext context) {
       Value result = null;
         if (source instanceof Integer) {
             result = new IntegerValue((Integer)source);
         } else if (source instanceof Long) {
             result = new IntegerValue((Long)source);
         } else if (source instanceof Short) {
             result = new IntegerValue((Short)source);
         } else if (source instanceof Byte) {
             result = new IntegerValue((Byte)source);
         } else if (source instanceof Double) {
             result = new DoubleValue((Double)source);
         } else if (source instanceof Float) {
             result = new FloatValue((Float)source);
         } else if (source instanceof BigDecimal) {
View Full Code Here

    }

    public Value transform(Object source, TransformationContext context) {
        Value result = null;
        if (source instanceof Integer) {
            result = new IntegerValue((Integer)source);
        } else if (source instanceof Long) {
            result = new IntegerValue((Long)source);
        } else if (source instanceof Short) {
            result = new IntegerValue((Short)source);
        } else if (source instanceof Byte) {
            result = new IntegerValue((Byte)source);
        } else if (source instanceof Double) {
            result = new DoubleValue((Double)source);
        } else if (source instanceof Float) {
            result = new FloatValue((Float)source);
        } else if (source instanceof BigDecimal) {
View Full Code Here

                "10");

        final UserFunction fn1 = sqc.getUserDefinedFunction("f.ns", "t1", 2);
        final Controller controller = exp1.getController();
        final Value[] arglist = new Value[2];
        arglist[0] = new IntegerValue(10);
        for (int i=3; i<10; i++) {
            arglist[1] = new IntegerValue(i);
            final Value result = fn1.call(arglist, controller);
            System.out.println(arglist[0] + " div " + arglist[1] + " = " + result);
        }
    }
View Full Code Here

        } else {
            NumericValue rstart = start.round();
            // We need to be careful to handle cases such as plus/minus infinity
            if (rstart.compareTo(IntegerValue.ZERO) <= 0) {
                return s;
            } else if (rstart.compareTo(new IntegerValue(slength)) > 0) {
                // this works even where the string contains surrogate pairs,
                // because the Java length is always >= the XPath length
                return "";
            } else {
                try {
View Full Code Here

        } else {
            start = start.round();
            // We need to be careful to handle cases such as plus/minus infinity and NaN
            if (start.compareTo(IntegerValue.ZERO) <= 0) {
                lstart = 0;
            } else if (start.compareTo(new IntegerValue(slength)) > 0) {
                // this works even where the string contains surrogate pairs,
                // because the Java length is always >= the XPath length
                return "";
            } else if (start.isNaN()) {
                return "";
            } else {
                try {
                    lstart = start.longValue();
                } catch (XPathException err) {
                    // this shouldn't happen unless the string length exceeds the bounds
                    // of a long
                    throw new AssertionError("string length out of permissible range");
                }
            }
        }

        NumericValue end;
        try {
            end = start.arithmetic(Token.PLUS, len.round(), context);
        } catch (XPathException e) {
            throw new AssertionError("Unexpected arithmetic failure in substring");
        }
        long lend;
        if (end instanceof IntegerValue) {
            lend = ((IntegerValue)end).longValue();
        } else {
            // We need to be careful to handle cases such as plus/minus infinity and NaN
            if (end.compareTo(IntegerValue.ZERO) <= 0) {
                return "";
            } else if (end.isNaN()) {
                return "";
            } else if (end.compareTo(new IntegerValue(slength)) > 0) {
                // this works even where the string contains surrogate pairs,
                // because the Java length is always >= the XPath length
                lend = slength+1;
            } else {
                try {
View Full Code Here

            sv = StringValue.EMPTY_STRING;
        }
        String s = sv.getStringValue();

        if (shortcut) {
            return new IntegerValue((s.length()>0 ? 1 : 0));
        } else {
            return new IntegerValue(StringValue.getLength(s));
        }
    }
View Full Code Here

            while (true) {
                AtomicValue i = (AtomicValue)base.next();
                if (i==null) break;
                index++;
                if (comparer.comparesEqual(i, value)) {
                    current = new IntegerValue(index);
                    position++;
                    return current;
                }
            }
            return null;
View Full Code Here

    /**
    * Evaluate in a general context
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        return new IntegerValue(c.getContextPosition());
    }
View Full Code Here

            if (!hasNext()) {
                return null;
            }
            long d = currentValue;
            currentValue += increment;
            return new IntegerValue(d);
        }
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.IntegerValue

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.