com.jmw.tzap.filters
Class MergeFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
      extended by com.jmw.tzap.filters.MergeFilter

public class MergeFilter
extends AbstractFilter

Filter for merging several files.

Author:
Judah Wischnitzer

Field Summary
protected  Grouper grouper
          The grouper used by this filter
protected  org.apache.tools.ant.util.FileNameMapper mapper
          The mapper used by this filter
protected  int newcount
          the number of files created
protected  Sequencer orderer
          The orderer used by this filter
protected  int startcount
          the number of files processed
 
Fields inherited from class com.jmw.tzap.AbstractFilter
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task
 
Constructor Summary
MergeFilter()
           
 
Method Summary
 void add(Grouper grouper)
          Sets the grouper.
 void add(Sequencer orderer)
          Sets the Sequencer.
 void addConfigured(org.apache.tools.ant.util.FileNameMapper mapper)
          Sets the Mapper with the new style.
 void addConfigured(org.apache.tools.ant.types.Mapper mapper)
          Sets the Mapper.
 FilterFile[] execute(FilterFile[] files)
          Executes the filter by grouping and ordering and then merging the files.
 void load()
          Does any initilaztion of the filter before it can be used.
 FilterFile merge(FilterFile[] files)
          Merges an array of FilterFile's into one file.
 void unload()
          Does any clean up after the filter has been finished.
 void validateParameters()
          Validates filter parameters.
 
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

startcount

protected int startcount
the number of files processed


newcount

protected int newcount
the number of files created


grouper

protected Grouper grouper
The grouper used by this filter


orderer

protected Sequencer orderer
The orderer used by this filter


mapper

protected org.apache.tools.ant.util.FileNameMapper mapper
The mapper used by this filter

Constructor Detail

MergeFilter

public MergeFilter()
Method Detail

execute

public FilterFile[] execute(FilterFile[] files)
Executes the filter by grouping and ordering and then merging the files.

Specified by:
execute in class AbstractFilter
Parameters:
files - an array of FilterFiles to process
Returns:
Description of the Return Value

load

public void load()
Description copied from class: AbstractFilter
Does any initilaztion of the filter before it can be used. Note; Only called once, before any filters are run.

Specified by:
load in class AbstractFilter

unload

public void unload()
Description copied from class: AbstractFilter
Does any clean up after the filter has been finished. Note; Only called once, when all files have been filtered.

Specified by:
unload in class AbstractFilter

merge

public FilterFile merge(FilterFile[] files)
Merges an array of FilterFile's into one file.

Parameters:
files - Description of the Parameter
Returns:
a new single FilterFile

add

public void add(Grouper grouper)
Sets the grouper.

Parameters:
grouper - the grouper to be used

add

public void add(Sequencer orderer)
Sets the Sequencer.

Parameters:
orderer - the orderer to be used

addConfigured

public void addConfigured(org.apache.tools.ant.types.Mapper mapper)
Sets the Mapper.

Parameters:
mapper - the orderer to be used

addConfigured

public void addConfigured(org.apache.tools.ant.util.FileNameMapper mapper)
Sets the Mapper with the new style.

Parameters:
mapper - the orderer to be used

validateParameters

public void validateParameters()
                        throws java.lang.Exception
Validates filter parameters.

Specified by:
validateParameters in class AbstractFilter
Throws:
java.lang.Exception - thrown if parameters are invalid