org.processmining.framework.log
Class LogFilter

java.lang.Object
  extended by org.processmining.framework.log.LogFilter
Direct Known Subclasses:
AbstractLogFilter, ActivityInversionFilter, AddArtificialEndTaskLogFilter, AddArtificialStartTaskLogFilter, AddNoiseLogFilter, DataAttributeLogFilter, DefaultLogFilter, DuplicateTasksLogFilter, EndLogFilter, IntermediateRepetitionsFilter, LogAttributeReplacementFilter, LogEventLogFilter, LogOriginatorLogFilter, ObfuscationFilter, RemapElementLogFilter, StartLogFilter, TransitiveCalculationLogFilter

public abstract class LogFilter
extends java.lang.Object

A generic abstract class for a workflow log filter.

When reading a log, the process instances are read one by one. The filter method of the selected log filter is called for each process instance. This filter method can then modify the contents of the given process instance. For example, certain audit trail entries can be deleted. The process instance is completely ignored (discarded) if the filter returns false. The LogFilter objects can be stacked, which means that they are capable of calling eachothers filter method. Note that each LogFilter should call the filter method of the lower level filter first for efficiency reasons. Note: this class has a natural ordering that is inconsistent with equals.

Version:
1.0
Author:
Peter van den Brand

Field Summary
static int FAST
          FAST should be used if the computation time of the filter method does not depend on the size of the process instance (i.e.
protected  LogFilter filter
          A LogFilter with a pointer to the lower level filter.
protected  int load
          A integer that can have three values: FAST, AVERAGE, SLOW.
static int MODERATE
          AVERAGE should be used if the computation time of the filter method depends polynomially on the size of the process instance .
static int SLOW
          SLOW should be used if the computation time of the filter method depends exponentially on the size of the process instance .
 
Constructor Summary
LogFilter(int load, java.lang.String name)
          Instantiates a LogFilter with a pointer to the lower level filter.
 
Method Summary
 boolean changesLog()
          Method to tell whether this LogFilter changes the log or not.
protected abstract  boolean doFiltering(ProcessInstance instance)
          Filters a single process instance.
 boolean filter(ProcessInstance instance)
          Filters a single process instance.
 int getComplexity()
          Returns either SLOW, MODERATE or FAST
 java.lang.String getComplexityAsString()
          Returns either "Slow", "Moderate" or "Fast"
 LogFilter getFilter()
          Provides access to the lower level log filter used by this instance.
 java.lang.String getHelp()
          Returns the help for this LogFilter as HTML text without the and tags!
protected abstract  java.lang.String getHelpForThisLogFilter()
          Returns the help for this LogFilter as HTML text, but without the and tags!
 java.lang.String getName()
          Returns the name of this LogFilter
abstract  LogFilterParameterDialog getParameterDialog(LogSummary summary)
          Returns a Panel for the setting of parameters.
protected  int getThisLogFilterComplexity()
          Returns either SLOW, MODERATE or FAST
protected abstract  void readSpecificXML(org.w3c.dom.Node logFilterSpecifcNode)
          Read the inside of the tag in the XML export file from the InputStream input.
static LogFilter readXML(org.w3c.dom.Node logFilterNode)
          Read the inside of the tag in the XML export file from the InputStream input.
 void setLowLevelFilter(LogFilter filter)
          Sets the lower level filter for this log.
 void setName(java.lang.String name)
          Sets the name of this LogFilter
protected abstract  boolean thisFilterChangesLog()
          Method to tell whether this LogFilter changes the log or not.
 java.lang.String toString()
          Returns the name of this LogFilter
protected abstract  void writeSpecificXML(java.io.BufferedWriter output)
          Write the inside of the tag in the XML export file to the OutputStream output.
 void writeXML(java.io.BufferedWriter output)
          Write the inside of the tag in the XML export file to the OutputStream output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FAST

public static final int FAST
FAST should be used if the computation time of the filter method does not depend on the size of the process instance (i.e. it is constant).

See Also:
Constant Field Values

MODERATE

public static final int MODERATE
AVERAGE should be used if the computation time of the filter method depends polynomially on the size of the process instance .

See Also:
Constant Field Values

SLOW

public static final int SLOW
SLOW should be used if the computation time of the filter method depends exponentially on the size of the process instance .

See Also:
Constant Field Values

load

protected int load
A integer that can have three values: FAST, AVERAGE, SLOW. This should be set in the constructor (default is SLOW) to tell how computationally intensive this filter is. FAST should be used if the computation time of the filter method does not depend on the size of the process instance (i.e. it is constant). AVERAGE if it is linear in the size of the instance and SLOW otherwise.


filter

protected LogFilter filter
A LogFilter with a pointer to the lower level filter. When filtering, the filter(ProcessInstance pi) method should first call filter.filter(pi). If that returns false, no further filtering is necessary.

Constructor Detail

LogFilter

public LogFilter(int load,
                 java.lang.String name)
Instantiates a LogFilter with a pointer to the lower level filter. When filtering, the filter(ProcessInstance pi) method should first call filter.filter(pi). If that returns false, no further filtering is necessary.

Parameters:
lowLevelFilter - the filter that should be checked first, to see if the instance can be discared anyway. Note that this filter can be null.
load - the load of this LogFilter (i.e. SLOW, AVERAGE or FAST)
name - The name of the LogFilter
Method Detail

getFilter

public LogFilter getFilter()
Provides access to the lower level log filter used by this instance.

Returns:

doFiltering

protected abstract boolean doFiltering(ProcessInstance instance)
Filters a single process instance. The process instance can be modified.

Parameters:
instance - the process instance to filter
Returns:
true if the whole process instance passes the filter, false if the process instance should be discarded.

filter

public final boolean filter(ProcessInstance instance)
Filters a single process instance. The process instance can be modified. This method should start with the following code: if ((filter!=null) && !filter.filter(instance) || instance.isEmpty()) {return false;}

Parameters:
instance - the process instance to filter
Returns:
true if the whole process instance passes the filter, false if the process instance should be discarded.

getName

public final java.lang.String getName()
Returns the name of this LogFilter

Returns:
String

setName

public final void setName(java.lang.String name)
Sets the name of this LogFilter

Parameters:
name - new name of this LogFilter

toString

public java.lang.String toString()
Returns the name of this LogFilter

Overrides:
toString in class java.lang.Object
Returns:
String

thisFilterChangesLog

protected abstract boolean thisFilterChangesLog()
Method to tell whether this LogFilter changes the log or not. This method is used in the compare method.

Returns:
boolean True if this LogFilter changes the process instance in the filter() method. False otherwise.

changesLog

public final boolean changesLog()
Method to tell whether this LogFilter changes the log or not. This method is used in the compare method.

Returns:
boolean True if this LogFilter changes the process instance in the filter() method, or the lower level filter does. False otherwise.

getParameterDialog

public abstract LogFilterParameterDialog getParameterDialog(LogSummary summary)
Returns a Panel for the setting of parameters. When a LogFilter can be added to a list in the framework. This panel is shown, and parameters can be set. When the dialog is closed, a new instance of a LogFilter is created by the framework by calling the getNewLogFilter method of the dialog.

Parameters:
summary - A LogSummary to be used for setting parameters.
Returns:
JPanel

setLowLevelFilter

public final void setLowLevelFilter(LogFilter filter)
Sets the lower level filter for this log. Every implementation to this.filter() shold call filter.filter() first!

Parameters:
filter - LogFilter

getThisLogFilterComplexity

protected int getThisLogFilterComplexity()
Returns either SLOW, MODERATE or FAST

Returns:
int

getComplexity

public final int getComplexity()
Returns either SLOW, MODERATE or FAST

Returns:
int

getComplexityAsString

public final java.lang.String getComplexityAsString()
Returns either "Slow", "Moderate" or "Fast"

Returns:
int

getHelp

public final java.lang.String getHelp()
Returns the help for this LogFilter as HTML text without the and tags!

Returns:
the help as string

getHelpForThisLogFilter

protected abstract java.lang.String getHelpForThisLogFilter()
Returns the help for this LogFilter as HTML text, but without the and tags!

Returns:
the help as string

writeSpecificXML

protected abstract void writeSpecificXML(java.io.BufferedWriter output)
                                  throws java.io.IOException
Write the inside of the tag in the XML export file to the OutputStream output.

Parameters:
output - OutputStream
Throws:
java.io.IOException

readSpecificXML

protected abstract void readSpecificXML(org.w3c.dom.Node logFilterSpecifcNode)
                                 throws java.io.IOException
Read the inside of the tag in the XML export file from the InputStream input.

Parameters:
input - InputStream
Throws:
java.io.IOException

writeXML

public void writeXML(java.io.BufferedWriter output)
              throws java.io.IOException
Write the inside of the tag in the XML export file to the OutputStream output.

Parameters:
output - OutputStream
Throws:
java.io.IOException

readXML

public static LogFilter readXML(org.w3c.dom.Node logFilterNode)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException,
                                java.lang.IllegalAccessException,
                                java.lang.InstantiationException
Read the inside of the tag in the XML export file from the InputStream input.

Parameters:
input - InputStream
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException