Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.NumericValue.longValue()


                case FLOAT:
                    return n.floatValue();
                case INTEGER:
                    return n.intValue();
                case LONG:
                    return n.longValue();
                default:
                    throw new ScriptException("numeric value of unexpected type: " + v);
            }
        } else if (v instanceof RDFValue) {
            return toJavaObject(((RDFValue) v).sesameValue());
View Full Code Here


        switch (a.getDatatype()) {
            case INTEGER:
                return new SesameNumericValue(Math.abs(a.intValue()));
            case LONG:
                return new SesameNumericValue(Math.abs(a.longValue()));
            case FLOAT:
                return new SesameNumericValue(Math.abs(a.floatValue()));
            case DOUBLE:
                return new SesameNumericValue(Math.abs(a.doubleValue()));
            case DECIMAL:
View Full Code Here

        switch (a.getDatatype()) {
            case INTEGER:
                return new SesameNumericValue(-a.intValue());
            case LONG:
                return new SesameNumericValue(-a.longValue());
            case FLOAT:
                return new SesameNumericValue(-a.floatValue());
            case DOUBLE:
                // Note: avoids negative zero.
                return new SesameNumericValue(0.0 - a.doubleValue());
View Full Code Here

        Type precision = maxPrecision(a, b);
        switch (precision) {
            case INTEGER:
                return new SesameNumericValue(a.intValue() + b.intValue());
            case LONG:
                return new SesameNumericValue(a.longValue() + b.longValue());
            case FLOAT:
                return new SesameNumericValue(a.floatValue() + b.floatValue());
            case DOUBLE:
                return new SesameNumericValue(a.doubleValue() + b.doubleValue());
            case DECIMAL:
View Full Code Here

        Type precision = maxPrecision(a, b);
        switch (precision) {
            case INTEGER:
                return new SesameNumericValue(a.intValue() - b.intValue());
            case LONG:
                return new SesameNumericValue(a.longValue() - b.longValue());
            case FLOAT:
                return new SesameNumericValue(a.floatValue() - b.floatValue());
            case DOUBLE:
                return new SesameNumericValue(a.doubleValue() - b.doubleValue());
            case DECIMAL:
View Full Code Here

        Type precision = maxPrecision(a, b);
        switch (precision) {
            case INTEGER:
                return new SesameNumericValue(a.intValue() * b.intValue());
            case LONG:
                return new SesameNumericValue(a.longValue() * b.longValue());
            case FLOAT:
                return new SesameNumericValue(a.floatValue() * b.floatValue());
            case DOUBLE:
                return new SesameNumericValue(a.doubleValue() * b.doubleValue());
            case DECIMAL:
View Full Code Here

        Type precision = maxPrecision(a, b);
        switch (precision) {
            case INTEGER:
                return new SesameNumericValue(a.intValue() / b.intValue());
            case LONG:
                return new SesameNumericValue(a.longValue() / b.longValue());
            case FLOAT:
                return new SesameNumericValue(a.floatValue() / b.floatValue());
            case DOUBLE:
                return new SesameNumericValue(a.doubleValue() / b.doubleValue());
            case DECIMAL:
View Full Code Here

        Type precision = maxPrecision(a, b);
        switch (precision) {
            case INTEGER:
                return new SesameNumericValue(a.intValue() % b.intValue());
            case LONG:
                return new SesameNumericValue(a.longValue() % b.longValue());
            case FLOAT:
                return new SesameNumericValue(a.floatValue() % b.floatValue());
            case DOUBLE:
                return new SesameNumericValue(a.doubleValue() % b.doubleValue());
            case DECIMAL:
View Full Code Here

        // Create a long literal.
        l = mc.valueOf(42l);
        assertTrue(l instanceof NumericValue);
        assertEquals(NumericValue.Type.LONG, l.getDatatype());
        assertEquals(42l, l.longValue());
        l = mc.valueOf(0l);
        assertTrue(l instanceof NumericValue);
        assertEquals(NumericValue.Type.LONG, l.getDatatype());
        assertEquals(0l, l.longValue());
        l = mc.valueOf(-42l);
View Full Code Here

        assertEquals(NumericValue.Type.LONG, l.getDatatype());
        assertEquals(42l, l.longValue());
        l = mc.valueOf(0l);
        assertTrue(l instanceof NumericValue);
        assertEquals(NumericValue.Type.LONG, l.getDatatype());
        assertEquals(0l, l.longValue());
        l = mc.valueOf(-42l);
        assertTrue(l instanceof NumericValue);
        assertEquals(NumericValue.Type.LONG, l.getDatatype());
        assertEquals(-42l, l.longValue());
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.