|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.mp3dings.utils.Bean
net.sourceforge.mp3dings.filter.FilterBean
net.sourceforge.mp3dings.filter.AbstractStringFilter
net.sourceforge.mp3dings.filter.StringReplacer
public class StringReplacer
A filter that performs one or more string/regular expression substitution.
| Field Summary | |
|---|---|
static String |
PROPERTY_RULES
|
| Fields inherited from class net.sourceforge.mp3dings.utils.Bean |
|---|
L_NO_ID, NO_ID, PROPERTY_ID, PROPERTY_NAME |
| Constructor Summary | |
|---|---|
StringReplacer()
Constructs a new empty case-sensitive ruleset. |
|
| Method Summary | |
|---|---|
void |
addRule(String pattern,
String replacement)
Adds a new rule to this ruleset. |
protected Pattern |
compile(String pattern)
|
String[] |
deleteRule(int i)
Deletes the rule with index i from this ruleset. |
boolean |
equals(Object o)
|
String |
filterString(String val)
Applies all rules in this ruleset to the specified string and returns the result. |
String[] |
getRule(int i)
Returns the rule with index i as a string pair. |
protected Vector |
getRuleList()
|
String[][] |
getRulesAsStrings()
Returns the ruleset as an array of string pairs. |
int |
getSize()
Returns the number of rules currently in this ruleset. |
int |
hashCode()
|
void |
insertRule(String pattern,
String replacement,
int i)
Adds a new rule to this ruleset. |
boolean |
isCaseSensitive()
|
boolean |
isRegExp()
|
boolean |
isWordMatch()
|
static Bean |
load(Preferences pref,
String key)
returns a StringReplacer or null |
protected void |
replaceRule(String pattern,
String replacement,
int i)
|
protected String[] |
ruleToStrings(Object[] rule,
String[] result)
|
void |
setCaseSensitive(boolean b)
|
void |
setFlags()
|
void |
setRegExp(boolean b)
|
void |
setRulesAsStrings(String[][] rs)
This method is public as an implementation side effect. |
void |
setWordMatch(boolean b)
|
String |
toString()
Returns a String representation of this Object. |
| Methods inherited from class net.sourceforge.mp3dings.filter.AbstractStringFilter |
|---|
filter |
| Methods inherited from class net.sourceforge.mp3dings.utils.Bean |
|---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getConstraints, getId, getName, getPropertyChangeListeners, getPropertyChangeListeners, isSavable, load, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setName |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTY_RULES
| Constructor Detail |
|---|
public StringReplacer()
| Method Detail |
|---|
public static Bean load(Preferences pref,
String key)
protected Vector getRuleList()
public boolean isRegExp()
public void setRegExp(boolean b)
public boolean isCaseSensitive()
public void setCaseSensitive(boolean b)
public boolean isWordMatch()
public void setWordMatch(boolean b)
public String toString()
toString in class Object
public void addRule(String pattern,
String replacement)
pattern - a string or regular expression pattern matching the
parts of the input that you want replacedreplacement - the replacement string
public void insertRule(String pattern,
String replacement,
int i)
pattern - the matching pattern (string or regular expression)replacement - the replacement stringi - the index of the rule in the ruleset. For two rules the
one with smaller index will have higher precedence.protected Pattern compile(String pattern)
protected void replaceRule(String pattern,
String replacement,
int i)
public void setFlags()
public String filterString(String val)
filterString in class AbstractStringFilterval - the String to process (remains unchanged)
public int getSize()
public String[] getRule(int i)
getRulesAsStrings()[i].
i - the index of the rule returned
protected String[] ruleToStrings(Object[] rule,
String[] result)
public String[][] getRulesAsStrings()
getRule(int)public void setRulesAsStrings(String[][] rs)
public String[] deleteRule(int i)
i - the index of the rule to deletepublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||