org.processmining.mining.dmcscanning.logutils
Class AnchoredEvent

java.lang.Object
  extended by org.processmining.mining.dmcscanning.logutils.AnchoredEvent
All Implemented Interfaces:
java.lang.Comparable, LogItem

public class AnchoredEvent
extends java.lang.Object
implements LogItem

AnchoredEvent is a wrapper class for AuditTrailEntry. It transparently provides all functionality of AuditTrailEntry, augmented by a reference to the originating ProcessInstance, plus the sequence number (or, position) within that trace. Notice: If the AuditTrailEntry is extended with a copy constructor this class can be simplified by deriving it directly from AuditTrailEntry.

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

Field Summary
protected  AuditTrailEntry entry
           
protected  long position
           
protected static java.util.HashMap positions
           
protected  ProcessInstance processInstance
           
 
Constructor Summary
AnchoredEvent(AuditTrailEntry anEntry, ProcessInstance aProcessInstance)
          Creates a new AnchoredEvent that is automatically equipped with a sequence/position counter value, unique to the provided process instance.
AnchoredEvent(AuditTrailEntry anEntry, ProcessInstance aProcessInstance, long aPosition)
          Creates a new AnchoredEvent, wrapping an AuditTrailEntry with augmented Meta-Information
 
Method Summary
 int compareTo(java.lang.Object arg0)
           
 boolean equals(AnchoredEvent other)
          Tests two events for equality, based on their process instance and position
 AuditTrailEntry getAuditTrailEntry()
           
 int getComparisonIndex()
           
 java.util.Map getData()
           
 java.lang.String getElement()
           
 java.util.Date getLeftBoundaryTimestamp()
          Start and end position are expected to represent sub-item boundaries of compound log items.
 java.lang.String getOriginator()
           
 long getPosition()
          The return value represents the logical position of this log item within the sequence of events (starting from zero and ascending).
 ProcessInstance getProcessInstance()
           
 java.util.Date getRightBoundaryTimestamp()
          Start and end position are expected to represent sub-item boundaries of compound log items.
 java.util.Date getTimestamp()
           
 java.lang.String getType()
           
 boolean isAtomic()
          Determines, whether this log event is atomic or durable; Atomic, in this context, is interpreted as tStart == tEnd, in contrast to durable, where tStart < tEnd.
 boolean isInSameProcessInstanceAs(AnchoredEvent other)
          Test, whether another event belongs to the same process instance
protected static long nextCounterFor(java.lang.String processInstanceId)
          provides a convenience facility for automatically managing a set of key-unique counters.
 boolean occurredEarlierThan(AnchoredEvent other)
          -- convenience method --
 boolean occurredLaterThan(AnchoredEvent other)
          -- convenience method --
 long positionRelativeTo(AnchoredEvent other)
          Retrieves the number of steps, that the calling event is away from the other one.
static void resetCounters()
          resets all counters
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

positions

protected static java.util.HashMap positions

entry

protected AuditTrailEntry entry

processInstance

protected ProcessInstance processInstance

position

protected long position
Constructor Detail

AnchoredEvent

public AnchoredEvent(AuditTrailEntry anEntry,
                     ProcessInstance aProcessInstance,
                     long aPosition)
Creates a new AnchoredEvent, wrapping an AuditTrailEntry with augmented Meta-Information

Parameters:
anEntry - the AuditTrailEntry instance to be wrapped
aProcessInstance - process instance the ATE belongs to
aPosition - position of the ATE within the process instance (starting from 0)

AnchoredEvent

public AnchoredEvent(AuditTrailEntry anEntry,
                     ProcessInstance aProcessInstance)
Creates a new AnchoredEvent that is automatically equipped with a sequence/position counter value, unique to the provided process instance.

Parameters:
anEntry - the AuditTrailEntry instance to be wrapped
aProcessInstance - process instance the ATE belongs to
Method Detail

nextCounterFor

protected static long nextCounterFor(java.lang.String processInstanceId)
provides a convenience facility for automatically managing a set of key-unique counters. In short, we maintain to each process instance id a long counter. Requesting a new counter value to a process instance id from this method returns a unique (w.r.t. this process instance id) counter value and transparently increments the counter in the back.

Parameters:
processInstanceId - the process instance id within which the counter value is unique
Returns:
next unique counter value, ascending, starting from 0.

resetCounters

public static void resetCounters()
resets all counters


equals

public boolean equals(AnchoredEvent other)
Tests two events for equality, based on their process instance and position

Parameters:
other -
Returns:

getAuditTrailEntry

public AuditTrailEntry getAuditTrailEntry()
Returns:
the wrapped audit trail entry

getPosition

public long getPosition()
Description copied from interface: LogItem
The return value represents the logical position of this log item within the sequence of events (starting from zero and ascending). If not implemented, return a negative value here.

Specified by:
getPosition in interface LogItem
Returns:
the absolute position of this event with the process instance (starting from 0)

getProcessInstance

public ProcessInstance getProcessInstance()
Returns:
reference to the process instance this event belongs to

isInSameProcessInstanceAs

public boolean isInSameProcessInstanceAs(AnchoredEvent other)
Test, whether another event belongs to the same process instance

Parameters:
other - another AnchoredEvent
Returns:
whether both events refer to the same (object identity) process instance

positionRelativeTo

public long positionRelativeTo(AnchoredEvent other)
Retrieves the number of steps, that the calling event is away from the other one. This distance can also be negative, indicating that the other event is in fact located after the calling one.

Parameters:
other -
Returns:

occurredLaterThan

public boolean occurredLaterThan(AnchoredEvent other)
-- convenience method --

Returns:
whether this event has occurred later than the parameter event

occurredEarlierThan

public boolean occurredEarlierThan(AnchoredEvent other)
-- convenience method --

Returns:
whether this event has occurred earlier than the parameter event

getElement

public java.lang.String getElement()
Returns:
wfm element name

getType

public java.lang.String getType()
Returns:
type of ATE

getTimestamp

public java.util.Date getTimestamp()
Returns:
timestamp of event

getOriginator

public java.lang.String getOriginator()
Returns:
originator of event

getData

public java.util.Map getData()
Returns:
data fields of event

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation

compareTo

public int compareTo(java.lang.Object arg0)
Specified by:
compareTo in interface java.lang.Comparable

getLeftBoundaryTimestamp

public java.util.Date getLeftBoundaryTimestamp()
Description copied from interface: LogItem
Start and end position are expected to represent sub-item boundaries of compound log items. In case the implementing class represents an atomic log item, the respective start- and end-getters are expected to return an identical value.

Specified by:
getLeftBoundaryTimestamp in interface LogItem
Returns:
the timestamp representing the left boundary of this log item

getRightBoundaryTimestamp

public java.util.Date getRightBoundaryTimestamp()
Description copied from interface: LogItem
Start and end position are expected to represent sub-item boundaries of compound log items. In case the implementing class represents an atomic log item, the respective start- and end-getters are expected to return an identical value.

Specified by:
getRightBoundaryTimestamp in interface LogItem
Returns:
the timestamp representing the right boundary of this log item

isAtomic

public boolean isAtomic()
Description copied from interface: LogItem
Determines, whether this log event is atomic or durable; Atomic, in this context, is interpreted as tStart == tEnd, in contrast to durable, where tStart < tEnd.

Specified by:
isAtomic in interface LogItem
Returns:

getComparisonIndex

public int getComparisonIndex()