net.sf.jeters.components
Class RegExReplacer.RegExReplacement

java.lang.Object
  extended by net.sf.jeters.components.RegExReplacer.Replacement
      extended by net.sf.jeters.components.RegExReplacer.RegExReplacement
All Implemented Interfaces:
RegExReplacer.ReplacementElement
Enclosing class:
RegExReplacer

public static class RegExReplacer.RegExReplacement
extends RegExReplacer.Replacement

a class that represents a single regex-pair together with other necessary information for performing replacements


Field Summary
 java.lang.String regex
          regular expression that will be replaced.
 java.lang.String rwith
          the string the regex is replaced with.
 int times
          how often the replaceAll-function is called for this replacement.
 
Fields inherited from class net.sf.jeters.components.RegExReplacer.Replacement
description, rating
 
Constructor Summary
RegExReplacer.RegExReplacement(int times, java.lang.String regex, java.lang.String rwith)
          constructor that sets description to "" and rating to 0.
RegExReplacer.RegExReplacement(int times, java.lang.String regex, java.lang.String rwith, int rating)
          constructor that sets description to "".
RegExReplacer.RegExReplacement(int times, java.lang.String regex, java.lang.String rwith, java.lang.String description)
          constructor that sets rating to 0.
RegExReplacer.RegExReplacement(int times, java.lang.String regex, java.lang.String rwith, java.lang.String description, int rating)
          constructor that has parameters for all attributes.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regex

public java.lang.String regex
regular expression that will be replaced.


rwith

public java.lang.String rwith
the string the regex is replaced with. May contain back references like $3 (compare "Capturing groups" in Java API entry for java.util.regex.Pattern).


times

public int times
how often the replaceAll-function is called for this replacement. Possible values are -1 (unlimited, until every occurrence of regex is replaced), 0 (this replacement will ignored) and positive integers. The most common values are 1 and -1, others are rarely used.

Explanation/Examples:
Usually, even a value of 1 will replace every occurrence of regex. However, Java's replaceAll-function won't go back to look for regex again.
Examples (regex = "bcd"; rwith = "c"):
times = 1: "bbcdd" -> "bcd"
times = 2: "bbcdd" -> "bcd" -> "c"
times = 1: "bcdbcd" -> "cc"

Constructor Detail

RegExReplacer.RegExReplacement

public RegExReplacer.RegExReplacement(int times,
                                      java.lang.String regex,
                                      java.lang.String rwith,
                                      java.lang.String description,
                                      int rating)
constructor that has parameters for all attributes.


RegExReplacer.RegExReplacement

public RegExReplacer.RegExReplacement(int times,
                                      java.lang.String regex,
                                      java.lang.String rwith)
constructor that sets description to "" and rating to 0. It can be used if you feel that the replacement absolutely does not require the user's attention.


RegExReplacer.RegExReplacement

public RegExReplacer.RegExReplacement(int times,
                                      java.lang.String regex,
                                      java.lang.String rwith,
                                      int rating)
constructor that sets description to "".


RegExReplacer.RegExReplacement

public RegExReplacer.RegExReplacement(int times,
                                      java.lang.String regex,
                                      java.lang.String rwith,
                                      java.lang.String description)
constructor that sets rating to 0.