Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.RippleValue


    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()) {
                RippleValue value = ((KeyValueValue) first).getValue(key, mc);
                solutions.put(stack.push(value));
            }
        }
    }
View Full Code Here


        final int times;

        times = mc.toNumericValue(stack.getFirst()).intValue();
        stack = stack.getRest();
        RippleValue p = stack.getFirst();
        final RippleList rest = stack.getRest();

        Sink<Operator> opSink = new Sink<Operator>() {
            public void put(final Operator op) throws RippleException {
                solutions.put(rest.push(
View Full Code Here

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

        RippleList stack = arg;

        RippleValue subj, pred, obj;

        obj = stack.getFirst();
        stack = stack.getRest();
        pred = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

        ScriptEngineWrapper w = scriptEngines.get(name);
        if (null == w) {
            java.lang.System.err.println("no such script engine: " + name);
        } else {
            RippleValue result = w.evaluate(script, mc);

            if (null != result) {
                solutions.put(stack.push(result));
            }
        }
View Full Code Here

        String s;

        s = mc.toString(stack.getFirst());
        stack = stack.getRest();

        RippleValue json = toJson(s, mc);

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

    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>() {
View Full Code Here

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

        RippleValue falseProg = stack.getFirst();
        stack = stack.getRest();
        RippleValue trueProg = stack.getFirst();
        stack = stack.getRest();
        RippleValue criterion = stack.getFirst();
        stack = stack.getRest();

        StackMapping inner = new IfteInner(stack, trueProg, falseProg);
        RippleList newStack = stack.push(criterion).push(Operator.OP)
                .push(new Operator(inner));
View Full Code Here

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

        x = stack.getFirst();
        stack = stack.getRest();
        y = stack.getFirst();
        stack = stack.getRest();
View Full Code Here

        Model model = mc.getModel();
        if (model instanceof SesameModel) {
            final RippleList stack = arg;

            RippleValue subj;

            subj = stack.getFirst();

            Sink<Statement> stSink = new Sink<Statement>() {
                public void put(final Statement st) throws RippleException {
                    Resource context = st.getContext();

                    RippleValue pred = mc.canonicalValue(new RDFValue(st.getPredicate()));
                    RippleValue obj = mc.canonicalValue(new RDFValue(st.getObject()));
                    RippleValue ctx = (null == context) ? mc.list() : mc.canonicalValue(new RDFValue(context));

                    solutions.put(stack.push(pred).push(obj).push(ctx));
                }
            };
View Full Code Here

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

            RippleValue b = arg.getFirst();

            RippleList stack = mc.toBoolean(b)
                    ? originalStack.push(trueProgram).push(Operator.OP)
                    : originalStack.push(falseProgram).push(Operator.OP);
View Full Code Here

TOP

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

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.