Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.NumericValue


                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {

        RippleList stack = arg;

        NumericValue a, b, result;

        b = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();
        a = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();

        result = a.add(b);

        solutions.put(
                stack.push(result));
    }
View Full Code Here


    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        NumericValue a, result;

        a = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();

        result = mc.valueOf((int) Math.floor(a.doubleValue()));

        solutions.put(
                stack.push(result));
    }
View Full Code Here

        public void apply(final RippleList arg,
                          final Sink<RippleList> solutions,
                          final ModelConnection mc) throws RippleException {
            RippleList stack = arg;
            NumericValue x, result;

            x = mc.toNumericValue(stack.getFirst());
            stack = stack.getRest();

            result = mc.valueOf(10).pow(x);
View Full Code Here

    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        NumericValue a, result;

        a = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();

        result = mc.valueOf(Math.cosh(a.doubleValue()));

        solutions.put(
                stack.push(result));
    }
View Full Code Here

    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        NumericValue a, b, result;

        b = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();
        a = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();

        result = a.sub(b);

        solutions.put(
                stack.push(result));
    }
View Full Code Here

    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        NumericValue a, b, result;

        b = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();
        a = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();

        // Note: division by zero simply does not yield a result.
        if (!b.isZero()) {
            result = a.div(b);

            solutions.put(
                    stack.push(result));
        }
    }
View Full Code Here

        public void apply(final RippleList arg,
                          final Sink<RippleList> solutions,
                          final ModelConnection mc) throws RippleException {
            RippleList stack = arg;

            NumericValue a, result;

            a = mc.toNumericValue(stack.getFirst());
            stack = stack.getRest();

            result = a.mul(a);

            solutions.put(
                    stack.push(result));
        }
View Full Code Here

                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        double a;
        NumericValue result;

        a = mc.toNumericValue(stack.getFirst()).doubleValue();
        stack = stack.getRest();

        // Apply the function only if it is defined for the given argument.
View Full Code Here

        RippleList stack = arg;


        double a;
        NumericValue result;

        a = mc.toNumericValue(stack.getFirst()).doubleValue();
        stack = stack.getRest();

        // Apply the function only if it is defined for the given argument.
View Full Code Here

    public void apply(final RippleList arg,
                      final Sink<RippleList> solutions,
                      final ModelConnection mc) throws RippleException {
        RippleList stack = arg;

        NumericValue p, x, result;

        p = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();
        x = mc.toNumericValue(stack.getFirst());
        stack = stack.getRest();
View Full Code Here

TOP

Related Classes of net.fortytwo.ripple.model.NumericValue

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.