public static class SubstringReplacerRules.SubstringReplacerMatchRule
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
m_attsToApplyTo
The attributes to apply the match-replace rule to
|
protected boolean |
m_ignoreCase
True if case should be ignored when matching
|
protected Logger |
m_logger |
protected java.lang.String |
m_match
The substring literal/regex to use for matching
|
protected java.lang.String |
m_matchS |
protected boolean |
m_regex
True if a regular expression match is to be used
|
protected java.util.regex.Pattern |
m_regexPattern
Precompiled regex
|
protected java.lang.String |
m_replace
The string to replace with
|
protected java.lang.String |
m_replaceS |
protected int[] |
m_selectedAtts |
protected java.lang.String |
m_statusMessagePrefix |
| Constructor and Description |
|---|
SubstringReplacerMatchRule()
Constructor
|
SubstringReplacerMatchRule(java.lang.String setup)
Constructor
|
SubstringReplacerMatchRule(java.lang.String match,
java.lang.String replace,
boolean regex,
boolean ignoreCase,
java.lang.String selectedAtts)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
apply(Instance inst)
Apply this rule to the supplied instance
|
protected java.lang.String |
apply(java.lang.String source)
Apply this rule to the supplied string
|
void |
apply(java.lang.String[] stringVals)
Apply this rule to the supplied array of strings.
|
java.lang.String |
getAttsToApplyTo()
Get the attributes to apply the rule to
|
boolean |
getIgnoreCase()
Get whether to ignore case when matching
|
java.lang.String |
getMatch()
Get the string/regex to use for matching
|
boolean |
getRegex()
Get whether this is a regular expression match or not
|
java.lang.String |
getReplace()
Get the replace string
|
void |
init(Environment env,
Instances structure)
Initialize this match replace rule by substituting any environment
variables in the attributes, match and replace strings.
|
protected void |
parseFromInternal(java.lang.String setup) |
void |
setAttsToApplyTo(java.lang.String a)
Set the attributes to apply the rule to
|
void |
setIgnoreCase(boolean ignore)
Set whether to ignore case when matching
|
void |
setMatch(java.lang.String match)
Set the string/regex to use for matching
|
void |
setRegex(boolean regex)
Set whether this is a regular expression match or not
|
void |
setReplace(java.lang.String replace)
Set the replace string
|
java.lang.String |
toString()
Return a textual description of this rule
|
java.lang.String |
toStringInternal()
Return the internally encoded representation of this rule
|
protected java.lang.String m_match
protected java.lang.String m_replace
protected boolean m_regex
protected java.util.regex.Pattern m_regexPattern
protected boolean m_ignoreCase
protected java.lang.String m_attsToApplyTo
protected java.lang.String m_matchS
protected java.lang.String m_replaceS
protected int[] m_selectedAtts
protected java.lang.String m_statusMessagePrefix
protected Logger m_logger
public SubstringReplacerMatchRule()
public SubstringReplacerMatchRule(java.lang.String setup)
setup - an internally encoded representation of all the match and
replace information for this rulepublic SubstringReplacerMatchRule(java.lang.String match,
java.lang.String replace,
boolean regex,
boolean ignoreCase,
java.lang.String selectedAtts)
match - the match stringreplace - the replace stringregex - true if this is a regular expression matchignoreCase - true if case is to be ignoredselectedAtts - the attributes to apply the rule toprotected void parseFromInternal(java.lang.String setup)
public void setMatch(java.lang.String match)
match - the match stringpublic java.lang.String getMatch()
public void setReplace(java.lang.String replace)
replace - the replace stringpublic java.lang.String getReplace()
public void setRegex(boolean regex)
regex - true if this is a regular expression matchpublic boolean getRegex()
public void setIgnoreCase(boolean ignore)
ignore - true if case is to be ignoredpublic boolean getIgnoreCase()
public void setAttsToApplyTo(java.lang.String a)
a - the attributes to apply the rule to.public java.lang.String getAttsToApplyTo()
public void init(Environment env, Instances structure)
env - the environment variablesstructure - the structure of the incoming instancespublic void apply(Instance inst)
inst - the instance to apply topublic void apply(java.lang.String[] stringVals)
stringVals - an array of strings containing string values from an
input instanceprotected java.lang.String apply(java.lang.String source)
source - the string to apply topublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringInternal()