Package adams.flow.template
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 Summary
Fields Modifier and Type Field Description protected BaseRegExp[]m_Findthe regular expressions to find.protected BaseString[]m_Replacethe replacements.-
Fields inherited from class adams.flow.template.FromFile
m_TemplateFile
-
Fields inherited from class adams.flow.template.AbstractActorTemplate
m_Name
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description StringReplace()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected ActordoGenerate()Generates the actor.StringfindTipText()Returns the tip text for this property.BaseRegExp[]getFind()Returns the regular expressions to use for matching.BaseString[]getReplace()Returns the strings to replace the matches with.StringglobalInfo()Returns a string describing the object.protected voidpreGenerate()Hook before generating the actor.StringreplaceTipText()Returns the tip text for this property.voidsetFind(BaseRegExp[] value)Sets the regular expressions to use for matching.voidsetReplace(BaseString[] value)Sets the strings to replace the matches with.-
Methods inherited from class adams.flow.template.FromFile
getTemplateFile, isInteractive, setTemplateFile, templateFileTipText
-
Methods inherited from class adams.flow.template.AbstractActorTemplate
compareTo, equals, forCommandLine, forName, generate, getBaselineCorrections, getDefaultName, getName, nameTipText, postGenerate, setName, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Find
protected BaseRegExp[] m_Find
the regular expressions to find.
-
m_Replace
protected BaseString[] m_Replace
the replacements.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Overrides:
globalInfoin classFromFile- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classFromFile
-
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:
preGeneratein classFromFile
-
doGenerate
protected Actor doGenerate()
Generates the actor.- Overrides:
doGeneratein classFromFile- Returns:
- the generated acto
-
-