Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.RippleList


    }

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

        RippleValue l;

        final RippleValue x = stack.getFirst();
        stack = stack.getRest();
        l = stack.getFirst();
        final RippleList rest = stack.getRest();

        Sink<RippleList> listSink = new Sink<RippleList>() {
            public void put(final RippleList list) throws RippleException {
                solutions.put(
                        rest.push(list.push(x)));
            }
        };

        mc.toList(l, listSink);
    }
View Full Code Here


    public void apply(final RippleList arg,
                      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.
        if (a >= -1 && a <= 1) {
            result = mc.valueOf(Math.asin(a));

            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;
        RippleValue z, y, x;

        z = stack.getFirst();
        stack = stack.getRest();
        y = stack.getFirst();
        stack = stack.getRest();
        x = stack.getFirst();
        stack = stack.getRest();

        solutions.put(
                stack.push(y).push(z).push(x));
    }
View Full Code Here

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

        RippleList stack = arg;

        RDFValue context = stack.getFirst().toRDF(mc);
        stack = stack.getRest();
        RDFValue pred = stack.getFirst().toRDF(mc);
        stack = stack.getRest();

        RDFPredicateMapping mapping = getMapping(pred, context);

        solutions.put(
                stack.push(new Operator(mapping)));
    }
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.mul(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;
        RippleValue first = stack.getFirst();
        stack = stack.getRest();

        if (first instanceof KeyValueValue) {
            for (String key : ((KeyValueValue) first).getKeys()) {
                solutions.put(stack.push(mc.valueOf(key)));
            }
        }
    }
View Full Code Here

    }

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

        w = stack.getFirst();
        stack = stack.getRest();
        z = stack.getFirst();
        stack = stack.getRest();
        y = stack.getFirst();
        stack = stack.getRest();
        x = stack.getFirst();
        stack = stack.getRest();

        solutions.put(
                stack.push(z).push(y).push(x).push(w));
    }
View Full Code Here

    }

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

        NumericValue result;

        result = mc.valueOf(Math.random());

        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.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;

        // Note: stack may be null (and this should not be a problem).
        RippleList result = stack.push(
                new ModelConnectionHelper(mc).createRandomURI());
//System.out.println( "Creating a new node" );

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

TOP

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

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.