Package ptolemy.data

Examples of ptolemy.data.StringToken


        if (_currentLines != null) {
            int outputs = ((IntToken) numberOfOutputs.getToken()).intValue();
            int size = ((IntToken) blockSize.getToken()).intValue();
            for (int i = 0; i < outputs; i++) {
                for (int j = 0; j < size; j++) {
                    output.send(i, new StringToken(_currentLines[i][j]));
                }
            }
        }
    }
View Full Code Here


            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        // Uncomment the next line to see debugging statements
        //addDebugListener(new ptolemy.kernel.util.StreamListener());
        command = new PortParameter(this, "command", new StringToken(
                "echo \"Hello, world.\""));

        // Make command be a StringParameter (no surrounding double quotes).
        command.setStringMode(true);
        new Parameter(command.getPort(), "_showName", BooleanToken.TRUE);
View Full Code Here

                            + processReturnCode + ".\nThe last input was: "
                            + line
                            + ".\nThe standard output was: " + outputString
                            + "\nThe error output was: " + errorString);
                } else {
                    error.send(0, new StringToken(errorString));
                    output.send(0, new StringToken(outputString));
                }
            }
        } catch (InterruptedException interrupted) {
            throw new InternalErrorException(this, interrupted,
                    "_process.waitFor() was interrupted");
        }

        String outputString = _outputGobbler.getAndReset();
        String errorString = _errorGobbler.getAndReset();

        if (_debugging) {
            _debug("Exec: Error: '" + errorString + "'");
            _debug("Exec: Output: '" + outputString + "'");
        }

        // We could have a parameter that if it was set
        // we would throw an exception if there was any error data.
        error.send(0, new StringToken(errorString));
        output.send(0, new StringToken(outputString));
    }
View Full Code Here

            if (environmentTokens.length() >= 1) {
                environmentArray = new String[environmentTokens.length()];

                for (int i = 0; i < environmentTokens.length(); i++) {
                    StringToken nameToken = (StringToken) (((RecordToken) environmentTokens
                            .getElement(i)).get("name"));
                    StringToken valueToken = (StringToken) (((RecordToken) environmentTokens
                            .getElement(i)).get("value"));
                    environmentArray[i] = nameToken.stringValue() + "="
                            + valueToken.stringValue();

                    if (_debugging) {
                        _debug("  " + i + ". \"" + environmentArray[i] + "\"");
                    }
View Full Code Here

        super.fire();

        // Check whether a command is ready.
        if (_commandReady()) {
            Command command = _getCommand();
            receivedCommand.send(0, new StringToken(_commandToString(command)));
        } else {
            receivedCommand.send(0, _EMPTY_STRING);
        }
    }
View Full Code Here

                        if (_debugging) {
                            _debug("Path: " + path);
                        }

                        result.add(new StringToken(path));
                    }
                }

                if (result.size() == 0) {
                    throw new IllegalActionException(this,
                            "No files or directories that match the pattern.");
                }

                StringToken[] resultArray = new StringToken[result.size()];

                for (int i = 0; i < resultArray.length; i++) {
                    resultArray[i] = (StringToken) result.get(i);
                }

                output.broadcast(new ArrayToken(BaseType.STRING, resultArray));
            } else if (sourceFile.isFile()) {
                StringToken[] result = new StringToken[1];
                result[0] = new StringToken(sourceFile.toString());

                if (_debugging) {
                    _debug("Listing just the specified file: "
                            + result[0].stringValue());
                }
View Full Code Here

                                                }

                                                // FIXME: Is there any way to tell whether
                                                // the result is a directory or file?
                                                resultsList
                                                        .add(new StringToken(
                                                                base + target));
                                            }

                                            sawHREF = false;
                                        }
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        super.fire();

        if (_currentLine != null) {
            output.broadcast(new StringToken(_currentLine));
        }
    }
View Full Code Here

        numberOfCycles.setTypeEquals(BaseType.INT);
        numberOfCycles.setExpression("UNBOUNDED");

        // Set the output signal type as DISCRETE to indicate
        // that the outputs of this actor are discrete events.
        new Parameter(output, "signalType", new StringToken("DISCRETE"));

        // Set the trigger signal type as DISCRETE.
        new Parameter(trigger, "signalType", new StringToken("DISCRETE"));
    }
View Full Code Here

                throws PtalonRuntimeException {
            for (ActorTree child : _children) {
                String paramName = child.getActorParameter();
                PtalonParameter param = actor.getPtalonParameter(paramName);
                try {
                    param.setToken(new StringToken(child.getExpression()));
                } catch (IllegalActionException ex) {
                    throw new PtalonRuntimeException(
                            "Unable to set token for name " + paramName, ex);
                }
            }
View Full Code Here

TOP

Related Classes of ptolemy.data.StringToken

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.