Class StringReplace

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, ShallowCopySupporter<AbstractActorTemplate>, SizeOfHandler, Serializable

    public class StringReplace
    extends FromFile
    Replaces strings that match the specified regular expressions in the file before instantiating an actor from it.

    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The new name for the actor; leave empty to use current.
        default:
     
    -template <adams.core.io.PlaceholderFile> (property: templateFile)
        The template file to load.
        default: .
     
    -find <adams.core.base.BaseRegExp> [-find ...] (property: find)
        The regular expressions to use for matching.
        default:
     
    -replace <adams.core.base.BaseString> [-replace ...] (property: replace)
        The strings to replace the matching strings with.
        default:
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Find

        protected BaseRegExp[] m_Find
        the regular expressions to find.
      • m_Replace

        protected BaseString[] m_Replace
        the replacements.
    • Constructor Detail

      • StringReplace

        public StringReplace()
    • Method Detail

      • setFind

        public void setFind​(BaseRegExp[] value)
        Sets the regular expressions to use for matching.
        Parameters:
        value - the expressions
      • getFind

        public BaseRegExp[] getFind()
        Returns the regular expressions to use for matching.
        Returns:
        the file
      • findTipText

        public String findTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setReplace

        public void setReplace​(BaseString[] value)
        Sets the strings to replace the matches with.
        Parameters:
        value - the expressions
      • getReplace

        public BaseString[] getReplace()
        Returns the strings to replace the matches with.
        Returns:
        the file
      • replaceTipText

        public String replaceTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • preGenerate

        protected void preGenerate()
        Hook before generating the actor.

        Checks whether find and replace arrays have the same length.
        Overrides:
        preGenerate in class FromFile
      • doGenerate

        protected Actor doGenerate()
        Generates the actor.
        Overrides:
        doGenerate in class FromFile
        Returns:
        the generated acto