Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.RippleList


        if (0 == results.size()) {
            return null;
        } else {
            for (Object result : results) {
                RippleList l = (RippleList) result;
                if (!l.isNil()) {
                    return toJavaObject(l.getFirst());
                }
            }

            return null;
        }
View Full Code Here


                    throw new ScriptException("numeric value of unexpected type: " + v);
            }
        } else if (v instanceof RDFValue) {
            return toJavaObject(((RDFValue) v).sesameValue());
        } else if (v instanceof RippleList) {
            RippleList l = (RippleList) v;
            List<Object> javaList = new LinkedList<Object>();
            for (RippleValue v2 : l.toJavaList()) {
                javaList.add(toJavaObject(v2));
            }
            return javaList;
        } else {
            return v.toString();
View Full Code Here

                                     final RippleValue... values) throws RippleException {
        if (0 == values.length) {
            return mc.list();
        }

        RippleList l = mc.list().push(values[0]);
        for (int i = 1; i < values.length; i++) {
            l = l.push(values[i]);
        }

        return l;
    }
View Full Code Here

    }

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

        RippleValue s = stack.getFirst();
        stack = stack.getRest();

        String result = mc.toString(s).toUpperCase();

        solutions.put(
                stack.push(StringLibrary.value(result, mc, s)));
    }
View Full Code Here

            return mc.valueOf((Double) o);
        } else if (o instanceof Integer) {
            return mc.valueOf((Integer) o);
        } else if (o instanceof JSONArray) {
            JSONArray a = (JSONArray) o;
            RippleList l = mc.list();
            for (int i = a.length() - 1; i >= 0; i--) {
                try {
                    l = l.push(toRippleValue(a.get(i), mc));
                } catch (JSONException e) {
                    throw new RippleException(e);
                }
            }
            return l;
View Full Code Here

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

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

        if (x instanceof KeyValueValue) {
            RippleValue result = ((KeyValueValue) x).getValue(key, mc);
            solutions.put(
                    stack.push(result));
        } else {
            throw new RippleException("argument is not a JSON value: " + x);
        }
    }
View Full Code Here

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

        RippleList stack = arg;

        RippleValue a, b, result;

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

        result = mc.valueOf(mc.getComparator().compare(a, b) <= 0);

        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;

        Value v;
        String result;

        v = stack.getFirst().toRDF(mc).sesameValue();
        stack = stack.getRest();

        if (v instanceof Literal) {
            result = ((Literal) v).getLanguage();

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

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

        RippleList stack = arg;

        RippleValue a, b, result;

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

        result = mc.valueOf(mc.getComparator().compare(a, b) >= 0);

        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 a, b, result;

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

        result = mc.valueOf(mc.getComparator().compare(a, b) > 0);

        solutions.put(
                stack.push(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.