Package net.fortytwo.ripple.model

Examples of net.fortytwo.ripple.model.RippleValue


*/
public class RandomTest extends RippleTestCase {
    public void testSingleSolution() throws Exception {
        Collection<RippleList> results;
        RippleList l;
        RippleValue v;
        double d;
        Set<Double> values = new HashSet<Double>();

        for (int i = 0; i < 1000; i++) {
            results = reduce("random.");
View Full Code Here


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

        RippleValue l;

        l = stack.getFirst();
        stack = stack.getRest();
        final int i = mc.toNumericValue(stack.getFirst()).intValue();
        final RippleList rest = stack.getRest();
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();
        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

    }

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

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

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

        final RippleValue mappingVal = stack.getFirst();
        stack = stack.getRest();
        RippleValue listVal = stack.getFirst();
        final RippleList rest = stack.getRest();

        // Note: it is simply assumed that these mappings have a production of
        // exactly one item.
        final Collector<Operator> operators = new Collector<Operator>();
        Operator.createOperator(mappingVal, operators, mc);

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

                // TODO: this is probably a little more complicated than it needs to be
                else {
                    RippleList inverted = list.invert();
                    RippleValue f = inverted.getFirst();

                    for (Operator operator : operators) {
                        StackMapping inner = new InnerMapping(mc.list(), inverted.getRest(), operator);
                        solutions.put(rest.push(f).push(mappingVal).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 {

        RippleValue l;

        l = arg.getFirst();
        final RippleList rest = arg.getRest();

        Sink<RippleList> listSink = new Sink<RippleList>() {
            public void put(RippleList list) throws RippleException {
                RippleValue result = null;
                while (!list.isNil()) {
                    RippleValue v = list.getFirst();
                    if (null == result || mc.getComparator().compare(v, result) < 0) {
                        result = v;
                    }

                    list = list.getRest();
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();

            RippleList newListRest = constructedList.push(first);

            if (invertedListHead.isNil()) {
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();
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();
        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 ModelConnection mc) throws RippleException {

        RippleList stack = arg;

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

        Sink<Operator> opSink = new Sink<Operator>() {
            public void put(final Operator op) throws RippleException {
                RippleValue inverse = new StackMappingWrapper(op.getMapping().getInverse(), mc);
                solutions.put(rest.push(inverse));
            }
        };

        Operator.createOperator(f, opSink, mc);
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.