com.jmw.tzap.filters
Class FindFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
      extended by com.jmw.tzap.IteratingFilter
          extended by com.jmw.tzap.filters.FindFilter
Direct Known Subclasses:
FindMergeFilter

public class FindFilter
extends IteratingFilter

FindFilter searches for all occurances of a given Regex and can save the list in a file.


Field Summary
protected  int count
           
protected  int fileCount
           
protected  java.lang.String outFile
           
protected  java.util.regex.Pattern pattern
           
protected  java.util.Set<java.lang.String> set
           
 
Fields inherited from class com.jmw.tzap.AbstractFilter
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task
 
Constructor Summary
FindFilter()
           
 
Method Summary
 java.lang.StringBuffer doFilter(java.lang.StringBuffer sb, java.lang.String fileName)
          Does the actual filtering.
 void setOutFile(java.lang.String outfile)
          Sets the name of the output file that the found values should be placed into
 void setRegex(java.lang.String regex)
          Sets the regex to search for
 void unload()
          Saves the found regex values into a file if a filename was supplied.
 void validateParameters()
          Validates any parameters needed by the child filters.
 
Methods inherited from class com.jmw.tzap.IteratingFilter
execute, load
 
Methods inherited from class com.jmw.tzap.AbstractFilter
getName, log, log, setEncoding, setTask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

protected java.util.regex.Pattern pattern

count

protected int count

fileCount

protected int fileCount

outFile

protected java.lang.String outFile

set

protected java.util.Set<java.lang.String> set
Constructor Detail

FindFilter

public FindFilter()
Method Detail

unload

public void unload()
Saves the found regex values into a file if a filename was supplied.

Overrides:
unload in class IteratingFilter

doFilter

public java.lang.StringBuffer doFilter(java.lang.StringBuffer sb,
                                       java.lang.String fileName)
Description copied from class: IteratingFilter
Does the actual filtering.

Specified by:
doFilter in class IteratingFilter
Parameters:
sb - the file to be filtered as a StringBuffer
fileName - the name that this file is called on disk
Returns:
the filtered file as a StringBuffer

validateParameters

public void validateParameters()
                        throws java.lang.Exception
Description copied from class: AbstractFilter
Validates any parameters needed by the child filters.

Specified by:
validateParameters in class AbstractFilter
Throws:
java.lang.Exception

setRegex

public void setRegex(java.lang.String regex)
Sets the regex to search for

Parameters:
regex - the regular expression to search for

setOutFile

public void setOutFile(java.lang.String outfile)
Sets the name of the output file that the found values should be placed into

Parameters:
outfile - the name of the output file