org.processmining.framework.log.classic
Class LogReaderClassic

java.lang.Object
  extended by org.processmining.framework.log.LogReader
      extended by org.processmining.framework.log.classic.LogReaderClassic

public class LogReaderClassic
extends LogReader

Reads a workflow log file.

This class allows a workflow log to be read by reading one process instance at a time. A log is explicitly not read into memory completely, to allow very large logs to be read.

A log file will be opened when it is first needed, i.e. when next(), hasNext(), reset() or getLogSummary() is first called. The log file is automatically closed after the last process instance in the log is read.

When the log is first opened, a summary will be read first. This means that the whole log will be read once before actually returning any process instances. This summary information is available by calling the getLogSummary() method.

Version:
1.0
Author:
Peter van den Brand

Nested Class Summary
 class LogReaderClassic.LogReaderClassicIterator
           
 
Field Summary
protected  int[] processInstancesToKeep
           
 
Constructor Summary
protected LogReaderClassic(LogFilter filter, LogFile inputFile)
          Read the given log file, filtered by the given filter.
protected LogReaderClassic(LogReader oldLogReader, int[] pitk)
          Deprecated. use clone(int[]) instead.
 
Method Summary
 LogReader clone(int[] pitk)
          Clones this log reader, including all contained processes and process instances.
static LogReader createInstance(LogFilter filter, LogFile inputFile)
          Read the given log file, filtered by the given filter.
static LogReader createInstance(LogReader oldLogReader, int[] pitk)
          Deprecated. use clone(int[]) instead.
static LogReader createInstance(LogReader reader, LogFilter filter)
          Derive a new log reader, based on the given log reader and filtered by the given filter.
 LogFile getFile()
          Returns the log file instance that was given in the constructor.
 ProcessInstance getInstance(int index)
          Retrieves the process instance located at the given index within the encapsulated log file.
 LogFilter getLogFilter()
          Returns the filter instance that was given in the constructor.
 LogSummary getLogSummary()
          Returns a LogSummary object with summarized info about the workflow log.
 Process getProcess(int index)
          Retrieves the process located at the given index within the encapsulated log file.
 boolean hasNext()
          Iterator interface method.
 java.util.Iterator instanceIterator()
          Retrieves an iterator over the process instances contained in the encapsulated log file.
 boolean isSelection()
          Tells whether or not this logReader object represents a selection of a log, instead of a complete log.
 ProcessInstance next()
          Iterator interface method.
 int numberOfInstances()
          Retrieves the number of process instances contained in this log file.
 int numberOfProcesses()
          Retrieves the number of processes contained in this log file.
 int[] processInstancesToKeep()
          Retrieves the indices of process instances which are not excluded from reading.
 java.util.Iterator processIterator()
          Retrieves an iterator over the processes contained in the encapsulated log file.
 void reset()
          Iterator interface method.
 java.lang.String toString()
          Returns a string representation of this log reader instance.
 
Methods inherited from class org.processmining.framework.log.LogReader
getInstances
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

processInstancesToKeep

protected int[] processInstancesToKeep
Constructor Detail

LogReaderClassic

protected LogReaderClassic(LogFilter filter,
                           LogFile inputFile)
Read the given log file, filtered by the given filter. If the filter parameter is null, no filtering is done. Note that the log file is not actually opened for reading yet.

Parameters:
filter - the filter to use for filtering the log file
inputFile - the log file to read

LogReaderClassic

protected LogReaderClassic(LogReader oldLogReader,
                           int[] pitk)
Deprecated. use clone(int[]) instead.

Read the given log file, filtered by the filter of the original reader, but only give the instances with the given indices. Note that the log file is not actually opened for reading yet. Note also that the int[] processInstancesToKeep should be sorted.

Parameters:
oldLogReader - the original log reader
pitk - the process instances to keep
Method Detail

createInstance

public static LogReader createInstance(LogReader reader,
                                       LogFilter filter)
                                throws java.lang.Exception
Derive a new log reader, based on the given log reader and filtered by the given filter. If the filter parameter is null, no filtering is done. Note that the log file is not actually opened for reading yet.

Parameters:
filter - the filter to use for filtering the log file
inputFile - the log file to read
Throws:
java.lang.Exception

createInstance

public static LogReader createInstance(LogFilter filter,
                                       LogFile inputFile)
Read the given log file, filtered by the given filter. If the filter parameter is null, no filtering is done. Note that the log file is not actually opened for reading yet.

Parameters:
filter - the filter to use for filtering the log file
inputFile - the log file to read

createInstance

public static LogReader createInstance(LogReader oldLogReader,
                                       int[] pitk)
                                throws java.lang.Exception
Deprecated. use clone(int[]) instead.

Read the given log file, filtered by the filter of the original reader, but only give the instances with the given indices. Note that the log file is not actually opened for reading yet. Note also that the int[] processInstancesToKeep should be sorted.

Parameters:
oldLogReader - the original log reader
pitk - the process instances to keep
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Description copied from class: LogReader
Returns a string representation of this log reader instance.

Specified by:
toString in class LogReader

isSelection

public boolean isSelection()
Description copied from class: LogReader
Tells whether or not this logReader object represents a selection of a log, instead of a complete log.

Specified by:
isSelection in class LogReader
Returns:
true if it it a selection

getFile

public LogFile getFile()
Description copied from class: LogReader
Returns the log file instance that was given in the constructor.

Specified by:
getFile in class LogReader
Returns:
the log file instance that was given in the constructor

getLogFilter

public LogFilter getLogFilter()
Description copied from class: LogReader
Returns the filter instance that was given in the constructor.

Specified by:
getLogFilter in class LogReader
Returns:
the filter instance that was given in the constructor

getLogSummary

public LogSummary getLogSummary()
Description copied from class: LogReader
Returns a LogSummary object with summarized info about the workflow log. Note that, if a filter is used, any information provided in this object is based on the filtered log, not on the real contents of the log file.

Specified by:
getLogSummary in class LogReader
Returns:
a LogSummary object with summarized info about the workflow log

hasNext

public boolean hasNext()
Description copied from class: LogReader
Iterator interface method.

Probes whether the log reader has another process instance available for reading.

Specified by:
hasNext in class LogReader
Returns:

next

public ProcessInstance next()
Description copied from class: LogReader
Iterator interface method.

Retrieves the next process instance from the log.

Specified by:
next in class LogReader
Returns:
The next process instance from the log.

reset

public void reset()
Description copied from class: LogReader
Iterator interface method.

Resets the main iterator to the first process instance.

Specified by:
reset in class LogReader

processInstancesToKeep

public int[] processInstancesToKeep()
Description copied from class: LogReader
Retrieves the indices of process instances which are not excluded from reading.

Specified by:
processInstancesToKeep in class LogReader
Returns:

numberOfInstances

public int numberOfInstances()
Description copied from class: LogReader
Retrieves the number of process instances contained in this log file.

Specified by:
numberOfInstances in class LogReader
Returns:
the number of process instances contained in this log file.

getInstance

public ProcessInstance getInstance(int index)
Description copied from class: LogReader
Retrieves the process instance located at the given index within the encapsulated log file.

Specified by:
getInstance in class LogReader
Parameters:
index - index of the requested process instance in the log
Returns:
referenced process instance.

clone

public LogReader clone(int[] pitk)
Description copied from class: LogReader
Clones this log reader, including all contained processes and process instances. The contained process instances, whose indices are contained in the given integer array, are excluded and will not be contained in the returned clone.

Notice that this method will yield a deep copy of the cloned instance. This implies doubling this instance's memory consumption (either in random access memory or filesystem space consumption, depending on the implementation) and no synchronization of changes between original and clone.

Specified by:
clone in class LogReader
Parameters:
pitk - The contained process instances, whose indices are contained in the given integer array, are excluded and will not be contained in the returned clone.
Returns:
A clone of this log reader, excluding the process instances whose indices are given in the supplied array.

getProcess

public Process getProcess(int index)
Description copied from class: LogReader
Retrieves the process located at the given index within the encapsulated log file.

Specified by:
getProcess in class LogReader
Parameters:
index - index of the requested process in the log
Returns:
referenced process.

instanceIterator

public java.util.Iterator instanceIterator()
Description copied from class: LogReader
Retrieves an iterator over the process instances contained in the encapsulated log file.

Specified by:
instanceIterator in class LogReader
Returns:
an iterator over the contained process instances.

numberOfProcesses

public int numberOfProcesses()
Description copied from class: LogReader
Retrieves the number of processes contained in this log file.

Specified by:
numberOfProcesses in class LogReader
Returns:
the number of processes contained in this log file.

processIterator

public java.util.Iterator processIterator()
Description copied from class: LogReader
Retrieves an iterator over the processes contained in the encapsulated log file.

Specified by:
processIterator in class LogReader
Returns:
an iterator over the contained processes.