Class TokenReader

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    @Deprecated
    public class TokenReader
    extends FileReader
    Deprecated.
    Use LineReader followed by ExpressionToToken.
    An actor that reads a string expression from a file or URL upon receiving a signal on its trigger input port, and outputs a token that is the result of evaluating the read string. The file or URL is specified by the FileOrURL parameter or set using the FileOrURL port. If the file or URL cannot be read, the expression cannot be parsed successfully, or the resulting token does not match the type constraint of the output port, the value of the errorHandlingStrategy parameter determines the behavior of this actor. TODO: describe automatic port constraint setting FIXME: More here. Particularly, document output type handling.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee, Marten Lohstroh
    Pt.AcceptedRating:
    Red (reviewmoderator)
    Pt.ProposedRating:
    Red (eal)
    • Field Detail

      • errorHandlingStrategy

        public StringParameter errorHandlingStrategy
        Deprecated.
        The error handled strategy. The strategy to use if:
        • the file or URL cannot be read,
        • the data read from the file or the URL cannot be parsed,
        • the parsed token cannot be converted into a token of the type given by outputType, if such a type is given, or
        • the parsed token cannot be converted to a token of the resolved type of the output, if no outputType is given.
        This is a string that has the following possible values: "Do Nothing" or "Throw Exception", where "Throw Exception" is the default.
      • outputType

        public Parameter outputType
        Deprecated.
        If this parameter has a value, then the value specifies the type of the output port. When the actor reads from the file or URL, it expects the data read to be a string that can be parsed into a token that is convertible to (or identical to) this output type. If it is not, then the action taken is specified by the errorHandlingStrategy parameter. If this parameter has no value (the default), then the output type will be set to match whatever is first read from the file or URL and will be updated on each subsequent firing if the data read from the file or URL cannot be converted to the type determined by the first read.
    • Constructor Detail