org.processmining.framework.log.rfb
Class ProcessImpl

java.lang.Object
  extended by org.processmining.framework.log.LogEntity
      extended by org.processmining.framework.log.Process
          extended by org.processmining.framework.log.rfb.ProcessImpl

public class ProcessImpl
extends Process

This class provides a complete implementation for a process, which is essentially a container for process instances with additional attributes.

Notice: This implementation is optimized for random access using indices for addressing specific process instances. Referencing instances by their name is implemented in a rather expensive manner to this date.

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

Field Summary
protected  java.util.HashMap<java.lang.String,java.lang.String> attributes
          Data attributes associated with a process
protected  java.lang.String description
          The process description
protected  java.util.ArrayList<ProcessInstance> instances
          Contains the instances of the process in an ordered fashion.
protected  java.lang.String name
          The process ID
 
Constructor Summary
ProcessImpl(ProcessImpl template)
          Creates a clone of the provided process.
ProcessImpl(java.lang.String name, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> attributes)
          Creates a new process.
 
Method Summary
 void addProcessInstance(ProcessInstance instance)
          Adds a new process instance to this process (appended to the end of the already contained set).
 int clear()
          Removes all contained process instances from this process.
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
          Returns the meta-data, as map of key-value pairs, associated to this entity.
 java.lang.String getDescription()
          Returns the description of this entity.
 ProcessInstance getInstance(int index)
          Retrieves an instance of this process by its relative index, i.e.
 ProcessInstance getInstance(java.lang.String name)
          Retrieves an instance of this process identified by its name, or ID, string.
 java.lang.String[] getInstanceNames()
          Returns an array containing the names, or IDs, of all instances of this process.
 ModelElements getModelElements()
          Returns the set of model elements contained in all instances of this process.
 java.lang.String getName()
          Returns the name of this entity.
 java.util.Iterator iterator()
          Returns an iterator over all instances of this process in the log.
 void removeAttribute(java.lang.String key)
          Removes the attribute with the given key from the set of attributes of this entity.
 ProcessInstance removeProcessInstance(int index)
          Removes the process instance with the given index, i.e.
 boolean removeProcessInstance(ProcessInstance instance)
          Removes the given process instance from the process.
 ProcessInstance removeProcessInstance(java.lang.String name)
          Removes the process instance with the given name, or ID, from this process.
 void setAttribute(java.lang.String key, java.lang.String value)
          Sets an attribute of this entity as a key-value pair.
 void setAttributes(java.util.Map<java.lang.String,java.lang.String> data)
          Sets the set of attributes, given as key-value pairs, for this entity.
 void setDescription(java.lang.String nDescription)
          Sets the description of this entity
 void setName(java.lang.String nName)
          Sets the name, or ID, of this entity
 int size()
          Returns the number of instances for this process contained in the log.
 java.lang.String toString()
          Returns a string representation of this entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instances

protected java.util.ArrayList<ProcessInstance> instances
Contains the instances of the process in an ordered fashion.


name

protected java.lang.String name
The process ID


description

protected java.lang.String description
The process description


attributes

protected java.util.HashMap<java.lang.String,java.lang.String> attributes
Data attributes associated with a process

Constructor Detail

ProcessImpl

public ProcessImpl(java.lang.String name,
                   java.lang.String description,
                   java.util.Map<java.lang.String,java.lang.String> attributes)
Creates a new process.

Parameters:
name - Name / ID of the process.
description - Description string.
attributes - Set of attributes as key-value pairs.

ProcessImpl

public ProcessImpl(ProcessImpl template)
Creates a clone of the provided process. This clone is super-shallow, in the sense that only the meta-information of the process is copied (in a deep manner), but no instances are transferred from template to clone.

This is derived from the practice of cloning, or deriving, log readers, where not always all instances are transferred to the new clone. It is thus up to the implementation of the cloning class to take care of transferring instances (in the depth required).

Parameters:
template - The process to be cloned in a super-shallow manner.
Method Detail

addProcessInstance

public void addProcessInstance(ProcessInstance instance)
Adds a new process instance to this process (appended to the end of the already contained set).

Specified by:
addProcessInstance in class Process

removeProcessInstance

public boolean removeProcessInstance(ProcessInstance instance)
Removes the given process instance from the process.

Parameters:
instance - The process instance to be removed.
Returns:
Whether the instance was indeed removed.

getInstance

public ProcessInstance getInstance(int index)
Description copied from class: Process
Retrieves an instance of this process by its relative index, i.e. order of appearance in the log.

Specified by:
getInstance in class Process
Parameters:
index - Index of the requested process instance, must be within the range [0, size()].
Returns:

getInstance

public ProcessInstance getInstance(java.lang.String name)
Description copied from class: Process
Retrieves an instance of this process identified by its name, or ID, string.

Specified by:
getInstance in class Process
Returns:

getInstanceNames

public java.lang.String[] getInstanceNames()
Description copied from class: Process
Returns an array containing the names, or IDs, of all instances of this process.

Specified by:
getInstanceNames in class Process
Returns:

getModelElements

public ModelElements getModelElements()
Description copied from class: Process
Returns the set of model elements contained in all instances of this process.

Specified by:
getModelElements in class Process
Returns:

iterator

public java.util.Iterator iterator()
Description copied from class: Process
Returns an iterator over all instances of this process in the log.

Specified by:
iterator in class Process
Returns:

size

public int size()
Description copied from class: Process
Returns the number of instances for this process contained in the log.

Specified by:
size in class Process
Returns:

clear

public int clear()
Description copied from class: Process
Removes all contained process instances from this process.

Specified by:
clear in class Process
Returns:
The number of removed process instances.

removeProcessInstance

public ProcessInstance removeProcessInstance(java.lang.String name)
Description copied from class: Process
Removes the process instance with the given name, or ID, from this process.

Specified by:
removeProcessInstance in class Process
Parameters:
name - Name of the process instance to remove.
Returns:
The instance, if it was contained and removed; null otherwise.

removeProcessInstance

public ProcessInstance removeProcessInstance(int index)
Description copied from class: Process
Removes the process instance with the given index, i.e. order in the log, from this process.

Specified by:
removeProcessInstance in class Process
Parameters:
index - Index of the process instance to remove.
Returns:
The instance, if it was contained and removed; null otherwise.

toString

public java.lang.String toString()
Description copied from class: LogEntity
Returns a string representation of this entity.

Specified by:
toString in class LogEntity

getAttributes

public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Description copied from class: LogEntity
Returns the meta-data, as map of key-value pairs, associated to this entity.

Specified by:
getAttributes in class LogEntity
Returns:

getDescription

public java.lang.String getDescription()
Description copied from class: LogEntity
Returns the description of this entity.

Specified by:
getDescription in class LogEntity
Returns:

getName

public java.lang.String getName()
Description copied from class: LogEntity
Returns the name of this entity.

Specified by:
getName in class LogEntity
Returns:

removeAttribute

public void removeAttribute(java.lang.String key)
Description copied from class: LogEntity
Removes the attribute with the given key from the set of attributes of this entity.

Specified by:
removeAttribute in class LogEntity

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)
Description copied from class: LogEntity
Sets an attribute of this entity as a key-value pair. If a previous mapping for the given key exists, it will be removed. Otherwise a new mapping will be added.

Specified by:
setAttribute in class LogEntity

setAttributes

public void setAttributes(java.util.Map<java.lang.String,java.lang.String> data)
Description copied from class: LogEntity
Sets the set of attributes, given as key-value pairs, for this entity. Replaces the previously contained set of attributes.

Specified by:
setAttributes in class LogEntity

setDescription

public void setDescription(java.lang.String nDescription)
Description copied from class: LogEntity
Sets the description of this entity

Specified by:
setDescription in class LogEntity

setName

public void setName(java.lang.String nName)
Description copied from class: LogEntity
Sets the name, or ID, of this entity

Specified by:
setName in class LogEntity