Package caltrop.interpreter

Examples of caltrop.interpreter.InputChannel


            final String[] vars = inputPattern.getVariables();
            final Expression repExpr = inputPattern.getRepeatExpr();

            if (repExpr == null) {
                for (int j = 0; j < vars.length; j++) {
                    final InputChannel channel = ((InputPort) (inputPortMap
                            .get(inputPattern.getPortname()))).getChannel(0); // FIXME
                    local.bind(vars[j], new SingleTokenReaderThunk(channel, j));
                }
            } else {
                SimpleThunk repExprThunk = new SimpleThunk(repExpr, context,
                        local);
                local.bind(new EnvironmentKey(inputPattern.getPortname()),
                        repExprThunk);

                for (int j = 0; j < vars.length; j++) {
                    final InputChannel channel = ((InputPort) (inputPortMap
                            .get(inputPattern.getPortname()))).getChannel(0); // FIXME
                    local.bind(vars[j], new MultipleTokenReaderThunk(channel,
                            j, vars.length, repExprThunk, context));
                }
            }
View Full Code Here


        for (int i = 0; i < inputPatterns.length; i++) {
            final InputPattern inputPattern = inputPatterns[i];

            // FIXME: handle multiports
            final InputChannel channel = ((InputPort) (inputPortMap
                    .get(inputPattern.getPortname()))).getChannel(0);

            if (inputPattern.getRepeatExpr() == null) {
                if (!channel.hasAvailable(inputPattern.getVariables().length)) {
                    // System.out.println("Not enough inputs:" + inputPattern.getVariables().length);
                    return false;
                }
            } else {
                int repeatVal = context.intValue(env.get(new EnvironmentKey(
                        inputPattern.getPortname())));

                if (!channel.hasAvailable(inputPattern.getVariables().length
                        * repeatVal)) {
                    // System.out.println("Not enough repeated inputs:" + inputPattern.getVariables().length * repeatVal);
                    return false;
                }
            }
View Full Code Here

        for (int i = 0; i < inputPatterns.length; i++) {
            final InputPattern inputPattern = inputPatterns[i];

            // FIXME: handle multiports
            final InputChannel channel = ((InputPort) (inputPortMap
                    .get(inputPattern.getPortname()))).getChannel(0);

            if (inputPattern.getRepeatExpr() == null) {
                if (!channel.hasAvailable(inputPattern.getVariables().length)) {
                    throw new InterpreterException("Not enough inputs:"
                            + inputPattern.getVariables().length);
                }
            } else {
                int repeatVal = context.intValue(env.get(new EnvironmentKey(
                        inputPattern.getPortname())));

                if (!channel.hasAvailable(inputPattern.getVariables().length
                        * repeatVal)) {
                    throw new InterpreterException(
                            "Not enough repeated inputs:"
                                    + (inputPattern.getVariables().length * repeatVal));
                }
View Full Code Here

TOP

Related Classes of caltrop.interpreter.InputChannel

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.