Class StringSimpleReplace

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

    @Deprecated
    public class StringSimpleReplace
    extends TypedAtomicActor
    Deprecated.
    This class is primarily used in models that will be code generated so that regular expressions are not needed in the output. In general, use StringReplace with the regularExpression parameter set to false.
    On each firing, look for instances of the pattern specified by pattern in stringToEdit and replace them with the string given by replacement. If replaceAll is true, then replace all instances that match pattern. Otherwise, replace only the first instance that matches. If there is no match, then the output is the string provided by stringToEdit, unchanged. The pattern is not a regular expression, to use a regular expression, see StringReplace.

    The replacement string, as usual with string-valued parameters in Ptolemy II, can include references to parameter values in scope. E.g., if the enclosing composite actor has a parameter named "x" with value 1, say, then the replacement string a${x}b will become "a1b".

    Note that if the pattern is the two character string \r, then that pattern is handled specially and collapsed to the single character '\r'. This is for use in removing \r's from test output.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Christopher Brooks
    Pt.AcceptedRating:
    red (cxh)
    Pt.ProposedRating:
    ret (cxh)
    • Field Detail

      • stringToEdit

        public PortParameter stringToEdit
        Deprecated.
        The string to edit by replacing substrings that match the specified pattern with the specified replacement. This is a string that defaults to the empty string.
      • output

        public TypedIOPort output
        Deprecated.
        The output port on which the edited string is produced. This has type string.
      • pattern

        public PortParameter pattern
        Deprecated.
        The pattern used to pattern match and replace the stringToEdit string. It is an empty string by default.
      • replacement

        public PortParameter replacement
        Deprecated.
        The replacement string that replaces any matched instance of the pattern. It is an empty string by default.