org.processmining.mining.dmcscanning.logutils
Class FilteredIterator

java.lang.Object
  extended by org.processmining.mining.dmcscanning.logutils.FilteredIterator
All Implemented Interfaces:
java.util.Iterator

public class FilteredIterator
extends java.lang.Object
implements java.util.Iterator

FilteredIterator This class implements a read-only iterator over a ProcessInstance, or rather the AuditTrailEntries contained within it. Notice that this implies that you cannot alter the iterated set in any way, i.e. no removal or insertion methods are implemented. Instances of this class can be equipped with an EventFilter instance. This is used to filter the set of audit trail entries from the wrapped ProcessInstance following its specified constraints. Notice: Although a FilteredIterator can only be equipped with one EventFilter instance at a time, you can use e.g. the BooleanFilter to compose more sophisticated filter criteria (e.g. multiple filters of which all (AND), one (OR), etc. have to match).

Author:
Christian W. Guenther (christian at deckfour dot org)

Field Summary
protected  int cachedNextPosition
           
protected  java.util.ArrayList entries
           
protected  EventFilter filter
           
protected  ProcessInstance instance
           
protected  int position
           
 
Constructor Summary
FilteredIterator(FilteredIterator toClone)
          copy constructor
FilteredIterator(ProcessInstance anInstance)
          constructor
FilteredIterator(ProcessInstance anInstance, EventFilter aFilter)
           
 
Method Summary
 Bookmark bookmark()
           
 java.lang.Object clone()
          clone method
 java.util.Collection filteredList()
          Convenience method.
 EventFilter getFilter()
           
 ProcessInstance getProcessInstance()
           
 boolean hasNext()
           
protected  boolean match(int index)
          Tests, whether all active EventFilters match the given audit trail entry
 java.lang.Object next()
           
 AuditTrailEntry nextAuditTrailEntry()
           
 void remove()
          This class implements a read-only iterator, i.e.
 void reset()
          Resets the iterator to its initial state, i.e.
 boolean reset(Bookmark bookmark)
          Resets the iterator's state (i.e.
 void setFilter(EventFilter aFilter)
          Sets the event filter to be used in filtering the result set
 void setProcessInstance(ProcessInstance anInstance)
          Sets the process instance to be iterated over
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected ProcessInstance instance

entries

protected java.util.ArrayList entries

position

protected int position

cachedNextPosition

protected int cachedNextPosition

filter

protected EventFilter filter
Constructor Detail

FilteredIterator

public FilteredIterator(ProcessInstance anInstance)
constructor


FilteredIterator

public FilteredIterator(ProcessInstance anInstance,
                        EventFilter aFilter)

FilteredIterator

public FilteredIterator(FilteredIterator toClone)
copy constructor

Parameters:
toClone -
Method Detail

clone

public java.lang.Object clone()
clone method

Overrides:
clone in class java.lang.Object

setFilter

public void setFilter(EventFilter aFilter)
Sets the event filter to be used in filtering the result set

Parameters:
aFilter -

getFilter

public EventFilter getFilter()
Returns:
the currently set event filter

setProcessInstance

public void setProcessInstance(ProcessInstance anInstance)
Sets the process instance to be iterated over

Parameters:
anInstance -

getProcessInstance

public ProcessInstance getProcessInstance()
Returns:
the process instance currently iterated over

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator
Returns:
the next matched AuditTrailEntry instance (casted to Object for compliance)

nextAuditTrailEntry

public AuditTrailEntry nextAuditTrailEntry()
Returns:
the next matched AuditTrailEntry instance

remove

public void remove()
This class implements a read-only iterator, i.e. neither insert nor remove operations are supported. Thus, this method (from Iterator) has been overwritten with an empty (NOP) implementation.

Specified by:
remove in interface java.util.Iterator

bookmark

public Bookmark bookmark()
Returns:
bookmark containing the current iterator state (i.e. position) for later reset

reset

public boolean reset(Bookmark bookmark)
Resets the iterator's state (i.e. position) to a previously created bookmark

Parameters:
bookmark -
Returns:

reset

public void reset()
Resets the iterator to its initial state, i.e. to the start position


filteredList

public java.util.Collection filteredList()
Convenience method.

Returns:
the subset of the wrapped audit trail entries that match the filter criteria, in their original order

match

protected boolean match(int index)
Tests, whether all active EventFilters match the given audit trail entry

Parameters:
index -
Returns: