org.processmining.exporting.petrinet.cpnexport.HLImplementation
Class HLGroup

java.lang.Object
  extended by org.processmining.exporting.petrinet.cpnexport.HLImplementation.HLGroup
All Implemented Interfaces:
java.lang.Cloneable, HighLevelGroup

public class HLGroup
extends java.lang.Object
implements java.lang.Cloneable, HighLevelGroup

Represents a group, or organizational unit.
It is assumed that at least one resource is associated to a group.

Author:
arozinat, rmans

Constructor Summary
HLGroup(java.lang.String name)
          Constructor.
HLGroup(java.lang.String name, java.util.Set<HighLevelResource> resources)
          Constructor for creating a group with a name and a set of resources
 
Method Summary
 boolean addResource(HighLevelResource resource)
          Adds the given resource to the list of resources that belong to this group, or organizational unit.
 java.lang.Object clone()
          Makes a shalow copy of this object.
 boolean equals(java.lang.Object obj)
          Compares the specified object with this HighLevelGroup for equality.
 boolean equalsName(java.lang.Object obj)
          Compares the specified object with this HighLevelGroup for equality only on the name of a HighLevelGroup.
 java.lang.String getName()
          Retrives the name of this group or organizational unit.
 java.util.Set<HighLevelResource> getResources()
          Retrieves all the resources that are associated to this group.
 int hashCode()
          Returns the hascode for a HighLevelGroup object.
 boolean isInGroup(HighLevelResource resource)
           
 void removeAllResources()
          Remove all the resources in the group
 boolean removeResource(HighLevelResource resource)
          Removes the given resource from the list of resources that belong to this group.
 void setName(java.lang.String name)
          Sets the name for this group.
 java.lang.String toString()
           
 void writeDistributionToDot(java.lang.String boxId, java.lang.String nodeId, java.lang.String addText, java.io.Writer bw)
          Writes the highlevel group to dot.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HLGroup

public HLGroup(java.lang.String name)
Constructor.

Parameters:
name - the name of the group

HLGroup

public HLGroup(java.lang.String name,
               java.util.Set<HighLevelResource> resources)
Constructor for creating a group with a name and a set of resources

Parameters:
name - String the name of the group
resources - HashSet the set of the resources for the group
Method Detail

setName

public void setName(java.lang.String name)
Sets the name for this group.

Specified by:
setName in interface HighLevelGroup
Parameters:
name - String the name

getName

public java.lang.String getName()
Description copied from interface: HighLevelGroup
Retrives the name of this group or organizational unit.

Specified by:
getName in interface HighLevelGroup
Returns:
String the name of this group or organizational unit.

addResource

public boolean addResource(HighLevelResource resource)
Description copied from interface: HighLevelGroup
Adds the given resource to the list of resources that belong to this group, or organizational unit.

Specified by:
addResource in interface HighLevelGroup
Parameters:
resource - the resource to be added

removeResource

public boolean removeResource(HighLevelResource resource)
Description copied from interface: HighLevelGroup
Removes the given resource from the list of resources that belong to this group.

Specified by:
removeResource in interface HighLevelGroup
Parameters:
resource - Resource the resource that has to be removed from this group
Returns:
boolean True if there has been a resource with the same name in this group and that is has been removed correctly. False otherwise (method call had no effect)

removeAllResources

public void removeAllResources()
Remove all the resources in the group


getResources

public java.util.Set<HighLevelResource> getResources()
Description copied from interface: HighLevelGroup
Retrieves all the resources that are associated to this group.

Specified by:
getResources in interface HighLevelGroup
Returns:
a set of Resource objects representing the people that have this group. If no resources are defined for this group an empty set is returned

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equalsName

public boolean equalsName(java.lang.Object obj)
Description copied from interface: HighLevelGroup
Compares the specified object with this HighLevelGroup for equality only on the name of a HighLevelGroup. Returns true if the given object is also a HighLevelGroup object and have both exactly the same name.

Specified by:
equalsName in interface HighLevelGroup
Returns:
boolean if the name of the specified object is equal to the name of this HighLevelGroup.

equals

public boolean equals(java.lang.Object obj)
Compares the specified object with this HighLevelGroup for equality. Returns true if the given object is also a HighLevelGroup object, have both the same name (without leading and trailing whitespaces) and have both the same set of resources.

Specified by:
equals in interface HighLevelGroup
Overrides:
equals in class java.lang.Object
Parameters:
o - Object object to be compared for equality with this HighLevelGroup.
Returns:
boolean true if both HighLevelGroups have the same name and the same set of resources.

hashCode

public int hashCode()
Description copied from interface: HighLevelGroup
Returns the hascode for a HighLevelGroup object. The hashcode value for a HighLevelDataDependency object is calculated according to the recipe of Josha Bloch in Effective Java (Addison-Wesley 2001). For this recipe, we have to consider the following items:

Specified by:
hashCode in interface HighLevelGroup
Overrides:
hashCode in class java.lang.Object
Returns:
int the hashcode value for this highLevelGroup

clone

public java.lang.Object clone()
Makes a shalow copy of this object.

Overrides:
clone in class java.lang.Object
Returns:
Object the cloned object

isInGroup

public boolean isInGroup(HighLevelResource resource)

writeDistributionToDot

public void writeDistributionToDot(java.lang.String boxId,
                                   java.lang.String nodeId,
                                   java.lang.String addText,
                                   java.io.Writer bw)
                            throws java.io.IOException
Description copied from interface: HighLevelGroup
Writes the highlevel group to dot. The general idea is that the relevant information of the highlevel group is written in a box and if needed can be connected to another node in the dot file. In that case the connection has to be an undirected line.

Specified by:
writeDistributionToDot in interface HighLevelGroup
Parameters:
boxId - the identifier of the box (in the DOT file) in which the relevant information of the highlevel group will be written.
nodeId - the identifier of the node (in the DOT file) to which the box that will be created has to be connected. "" has to be provided if the box that will be created does not need to be connected to another node in the DOT file.
addText - additional text that needs to be filled in at the beginning of the box
bw - Writer the BufferedWriter used to stream the data to the file
Throws:
java.io.IOException