| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object | +--COM.stevesoft.pat.Transformer
This feature can be used to prevent transformations from
occurring in certain regions. For example, if I add the rule
s'//.*'$&' and then add the
rule s/hello/goodbye/ the Transformer will replace "hello"
with "goodbye" except when it occurs inside a double-slash
style of comment. The transformation on the comment goes first,
does nothing, and precludes transformation on the same region
of text as the s/hello/goodbye/ rule.
So far, at least, this class does not have the capability of turning into a giant robot :-)
| Constructor Summary | |
| Transformer(boolean auto)
Instantiate a new Transformer object. |
|
| Method Summary | |
| void | add(Regex r)
Add a new Regex to the set of Regex's. |
| void | add(java.lang.String rs)
Add a new Regex by calling Regex.perlCode |
| void | add(java.lang.String[] array)
Add an array of Strings (which will be converted to Regex's via the Regex.perlCode method. |
| Regex | getRegexAt(int i)
Get the Regex at position i in this Transformer. |
| Replacer | getReplacer()
Get a replacer to that works with the current Regex. |
| int | patterns()
Returns the number of Regex's in this Transformer. |
| java.lang.String | replaceAllFrom(java.lang.String s,
int start)
Replace all matching patterns beginning at position start. |
| java.lang.String | replaceAllRegion(java.lang.String s,
int start,
int end)
Replace all matching patterns beginning between the positions start and end inclusive. |
| java.lang.String | replaceAll(java.lang.String s)
Replace all matches in the current String. |
| java.lang.String | replaceFirstFrom(java.lang.String s,
int start)
Replace the first matching pattern after position start in String s. |
| java.lang.String | replaceFirstRegion(java.lang.String s,
int start,
int end)
Replace the first matching pattern that begins between start and end inclusive. |
| java.lang.String | replaceFirst(java.lang.String s)
Replace the first matching pattern in String s. |
| void | setRegexAt(Regex rx,
int i)
Set the Regex at position i in this Transformer. |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Constructor Detail |
public Transformer(boolean auto)
| Method Detail |
public Replacer getReplacer()
public void add(Regex r)
public int patterns()
public Regex getRegexAt(int i)
public void setRegexAt(Regex rx,
int i)
public void add(java.lang.String rs)
public void add(java.lang.String[] array)
public java.lang.String replaceAll(java.lang.String s)
public java.lang.String replaceAllFrom(java.lang.String s,
int start)
public java.lang.String replaceAllRegion(java.lang.String s,
int start,
int end)
public java.lang.String replaceFirst(java.lang.String s)
public java.lang.String replaceFirstFrom(java.lang.String s,
int start)
public java.lang.String replaceFirstRegion(java.lang.String s,
int start,
int end)
| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||