org.processmining.exporting.petrinet.cpnexport
Class ManagerXml

java.lang.Object
  extended by org.processmining.exporting.petrinet.cpnexport.ManagerXml

public class ManagerXml
extends java.lang.Object

This class provides helper methods that are needed for making an export to CPN tools 2.0

Version:
1.0
Author:
Ronny Mans, Anne Rozinat (a.rozinat@tm.tue.nl)

Field Summary
static java.lang.String DtdUri
          Gives the location of the Document Type Definition (DTD) specifying the CPN Tools format.
 
Constructor Summary
ManagerXml()
           
 
Method Summary
static int getXCoordinateArcInscription(int node1, int node2)
          Calculates the the position of the arc inscription on the x axis.
static int getYCoordinateArcInscription(int node1, int node2)
          Calculates the the position of the arc inscription on the y axis.
static void writeArcTag(java.io.BufferedWriter bw, ManagerID idMan, java.lang.String orientation, java.lang.String transEnd, java.lang.String placeEnd, int xPos, int yPos, java.lang.String inscription, java.util.ArrayList bendpoints)
          Writes a complete arc tag in the CPN Tools format.
static void writeBeginMonitorForFunction(java.io.BufferedWriter bw, ManagerID idMan, java.lang.String nameMonitor, java.lang.String nodeidref, java.util.ArrayList<java.lang.String> pageinstanceidrefs)
          Writes information that is needed for creating a monitor for a function in cpn-tools.
static void writeControlFlowDec(java.io.BufferedWriter bw, ManagerID idMan, org.processmining.exporting.petrinet.cpnexport.CpnVarAndType cpnVarForCaseId, IntegerColorSet colorSetForCaseId, boolean timed)
          Writes the block for the control flow declarations in the cpn-file.
static void writeDataDec(java.io.BufferedWriter bw, ManagerID idMan, java.util.List<org.processmining.exporting.petrinet.cpnexport.CpnVarAndType> cpnVarsDataAttr, CpnColorSet colorSetDataAttr, java.util.List<CpnColorSet> colorSetsSepDatAttr)
          Writes the block for the data declarations in the cpn-file
static void writeEnd(java.io.BufferedWriter bw)
          Writes the end of the cpn-file.
static void writeEndGlobbox(java.io.BufferedWriter bw)
          Writes the closing tag of the globbox element
static void writeEndOfPage(java.io.BufferedWriter bw)
          Writes the closing tag for a page in the cpn-file.
static void writeEndTagMonitorBlock(java.io.BufferedWriter bw)
          Writes the end tag for the monitor block
static void writeFusionPlaces(java.io.BufferedWriter bw, ManagerID idMan, java.util.HashMap<java.lang.String,java.util.HashSet> fusionPlaces)
           
static void writeHeader(java.io.BufferedWriter bw)
          Writes the header of the CPN file.
static void writeInstance(java.io.BufferedWriter bw, ColoredPetriNet pn)
          Writes the instance elements in the cpn-file.
static void writeInstances(java.io.BufferedWriter bw, ColoredPetriNet pn)
          Writes the instances elements of the cpn-file.
static void writeLogDeclarations(java.io.BufferedWriter bw, ManagerID idMan, int offset, HighLevelProcess.TimeUnit timeunit)
          Writes the block for the log declarations in the cpn-file.
static void writeMarkingSizeMonitorResources(java.io.BufferedWriter bw, ManagerID idMan, java.util.HashMap<java.lang.String,java.util.ArrayList> infoForMonitoringResources)
          Writes the monitor for keeping track of the resources in the global resources place.
static void writeMonitorActionFunctionForInit(java.io.BufferedWriter bw, ManagerID idMan)
          Writes the action function for the monitor of the initialisation transition that will be used for creating separate files for each case that enters the net.
static void writeMonitorActionFunctionNormal(java.io.BufferedWriter bw, ManagerID idMan, java.lang.String nameTransition, java.lang.String eventType, java.lang.String cpnTypeOfCaseId, java.lang.String cpnTypeOfOriginator, java.lang.String cpnTypeOfDataVar, java.util.HashMap nameDataAttrAndType)
          Writes the action function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.
static void writeMonitorInitFunction(java.io.BufferedWriter bw, ManagerID idMan)
          Writes the init function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.
static void writeMonitorInitFunctionForFolderGeneration(java.io.BufferedWriter bw, ManagerID idMan)
          Writes the init function for generating the logs folder in which the logs need to be stored.
static void writeMonitorObserverFunction(java.io.BufferedWriter bw, ManagerID idMan, java.lang.String namePage, java.lang.String nameTransition, java.util.ArrayList<java.lang.String> boundedVars, java.util.ArrayList<java.lang.String> valuesTrue, java.util.ArrayList<java.lang.String> valuesFalse, int numberInstantiations)
          Writes the observer function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.
static void writeMonitorPredicateFunction(java.io.BufferedWriter bw, ManagerID idMan, java.lang.String namePage, java.lang.String nameTransition, java.util.ArrayList<java.lang.String> boundedVars, int numberInstantiations)
          Writes the predicate function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.
static void writeMonitorStopFunctionAndEndMonitor(java.io.BufferedWriter bw, ManagerID idMan)
          Writes the stop function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.
static void writeOptionsBinders(java.io.BufferedWriter bw)
          Writes the tags for the options and binders elements at almost the end of the cpn-file.
static void writePlaceTag(java.io.BufferedWriter bw, java.lang.String placeID, ManagerID idMan, int xPos, int yPos, java.lang.String label, int width, int height, java.lang.String placeType, java.lang.String initMark, java.lang.String portType, java.lang.String nameFusionPlace)
          Writes a complete place tag in the CPN Tools format.
static void writePossibilityDependencies(java.io.BufferedWriter bw, ManagerID idMan, java.util.HashSet<org.processmining.exporting.petrinet.cpnexport.CpnVarAndType> probDeps)
          Write information about the possibility dependencies to the cpn-file.
static void writeProductColorSetsForPlaces(java.io.BufferedWriter bw, ManagerID idMan, java.util.Set<ProductColorSet> productColorSetsForPlaces, boolean timed)
          Writes the product color set declarations that are needed for some places in the cpn model.
static void writeRandomValuesFunctions(java.io.BufferedWriter bw, ManagerID idMan, java.util.ArrayList<org.processmining.exporting.petrinet.cpnexport.CpnFunction> numericTypeDataAttrCpnFunc)
          Writes the functions that generate random values which are needed for some data attributes
static void writeResourceDec(java.io.BufferedWriter bw, ManagerID idMan, java.util.List<org.processmining.exporting.petrinet.cpnexport.CpnVarAndType> cpnVarsGroups, java.util.List<SubSetColorSet> colorSetsGroups)
          Writes the block for the group and the resources declarations in the cpn-file
static void writeStandDecl(java.io.BufferedWriter bw, ManagerID idMan)
          Writes the block for the standard declarations in the cpn-file.
static void writeStartCase(java.io.BufferedWriter bw, ManagerID idMan, org.processmining.exporting.petrinet.cpnexport.CpnVarAndType cpnVarForStartCase, StringColorSet colorSetStartCase)
           
static void writeStartGlobbox(java.io.BufferedWriter bw)
          Writes the starting tag of the globbox element
static void writeStartTagMonitorBlock(java.io.BufferedWriter bw)
          Writes the starting tag for the monitor block
static void writeThroughputTimeMonitor(java.io.BufferedWriter bw, ManagerID idMan, java.lang.String cpnID, java.util.ArrayList<java.lang.String> pageInstanceIdRefs, java.lang.String dataVar)
          Writes the monitor for calculating the throughput time to the cpn file
static void writeTransitionTag(java.io.BufferedWriter bw, java.lang.String transitionID, ManagerID idMan, int xPos, int yPos, java.lang.String label, int width, int height, java.lang.String guard, java.lang.String timeDelay, java.lang.String codeInscription, java.lang.String subpageID, java.lang.String subpageTagName, java.util.ArrayList portsToSockets, boolean isInvisibleTask)
          Writes a complete transition tag in the CPN Tools format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DtdUri

public static final java.lang.String DtdUri
Gives the location of the Document Type Definition (DTD) specifying the CPN Tools format.

See Also:
Constant Field Values
Constructor Detail

ManagerXml

public ManagerXml()
Method Detail

writeHeader

public static void writeHeader(java.io.BufferedWriter bw)
                        throws java.io.IOException
Writes the header of the CPN file.

Parameters:
bw - the BufferedWriter used to stream the data to the file
Throws:
java.io.IOException

writeStartGlobbox

public static void writeStartGlobbox(java.io.BufferedWriter bw)
                              throws java.io.IOException
Writes the starting tag of the globbox element

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file
Throws:
java.io.IOException

writeEndGlobbox

public static void writeEndGlobbox(java.io.BufferedWriter bw)
                            throws java.io.IOException
Writes the closing tag of the globbox element

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file
Throws:
java.io.IOException

writeStandDecl

public static void writeStandDecl(java.io.BufferedWriter bw,
                                  ManagerID idMan)
                           throws java.io.IOException
Writes the block for the standard declarations in the cpn-file. In this block the declarations for the types E, INT, BOOL and STRING can be found.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
Throws:
java.io.IOException

writeControlFlowDec

public static void writeControlFlowDec(java.io.BufferedWriter bw,
                                       ManagerID idMan,
                                       org.processmining.exporting.petrinet.cpnexport.CpnVarAndType cpnVarForCaseId,
                                       IntegerColorSet colorSetForCaseId,
                                       boolean timed)
                                throws java.io.IOException
Writes the block for the control flow declarations in the cpn-file. In this block the declarations for the color set for representing the case IDs and the variable that is used to bind the CASE_ID token while moving it through the process model can be found.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
cpnVarForCaseId - the cpn variable for the case id.
colorSetForCaseId - the color set for the case id.
timed - needs the color set to be timed or not.
Throws:
java.io.IOException

writeStartCase

public static void writeStartCase(java.io.BufferedWriter bw,
                                  ManagerID idMan,
                                  org.processmining.exporting.petrinet.cpnexport.CpnVarAndType cpnVarForStartCase,
                                  StringColorSet colorSetStartCase)
                           throws java.io.IOException
Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
cpnVarForStartCase - CpnVarAndType the cpn variable that has to keep the start timestamp for a case
colorSetStartCase - StringColorSet the color set for keeping the start timestamp for a case
Throws:
java.io.IOException

writeResourceDec

public static void writeResourceDec(java.io.BufferedWriter bw,
                                    ManagerID idMan,
                                    java.util.List<org.processmining.exporting.petrinet.cpnexport.CpnVarAndType> cpnVarsGroups,
                                    java.util.List<SubSetColorSet> colorSetsGroups)
                             throws java.io.IOException
Writes the block for the group and the resources declarations in the cpn-file

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
cpnVarsGroups - List the cpn-variables that are related to the resources and the groups
colorSetsGroups - List the color sets that are related to the resources and the groups
Throws:
java.io.IOException

writeDataDec

public static void writeDataDec(java.io.BufferedWriter bw,
                                ManagerID idMan,
                                java.util.List<org.processmining.exporting.petrinet.cpnexport.CpnVarAndType> cpnVarsDataAttr,
                                CpnColorSet colorSetDataAttr,
                                java.util.List<CpnColorSet> colorSetsSepDatAttr)
                         throws java.io.IOException
Writes the block for the data declarations in the cpn-file

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
cpnVarsDataAttr - List the variables that are used for representing all data attributes in the cpn-file
colorSetDataAttr - CpnColorSet the color that contains all the data attributes
colorSetsSepDatAttr - List the color sets for all the separate data attributes
Throws:
java.io.IOException

writeProductColorSetsForPlaces

public static void writeProductColorSetsForPlaces(java.io.BufferedWriter bw,
                                                  ManagerID idMan,
                                                  java.util.Set<ProductColorSet> productColorSetsForPlaces,
                                                  boolean timed)
                                           throws java.io.IOException
Writes the product color set declarations that are needed for some places in the cpn model.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
productColorSetsForPlaces - Set the set in which the product color sets can be found that are needed for some places in the cpn model.
timed - is the net timed or not.
Throws:
java.io.IOException

writeRandomValuesFunctions

public static void writeRandomValuesFunctions(java.io.BufferedWriter bw,
                                              ManagerID idMan,
                                              java.util.ArrayList<org.processmining.exporting.petrinet.cpnexport.CpnFunction> numericTypeDataAttrCpnFunc)
                                       throws java.io.IOException
Writes the functions that generate random values which are needed for some data attributes

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
numericTypeDataAttrCpnFunc - a list with the cpn functions of data attributes that are of a numeric type
Throws:
java.io.IOException

writeLogDeclarations

public static void writeLogDeclarations(java.io.BufferedWriter bw,
                                        ManagerID idMan,
                                        int offset,
                                        HighLevelProcess.TimeUnit timeunit)
                                 throws java.io.IOException
Writes the block for the log declarations in the cpn-file.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
offset - the year offset for logging
Throws:
java.io.IOException

writePossibilityDependencies

public static void writePossibilityDependencies(java.io.BufferedWriter bw,
                                                ManagerID idMan,
                                                java.util.HashSet<org.processmining.exporting.petrinet.cpnexport.CpnVarAndType> probDeps)
                                         throws java.io.IOException
Write information about the possibility dependencies to the cpn-file.

Parameters:
bw - BufferedWriter.
idMan - ManagerID the BufferedWriter used to stream the data to the file.
probDep - CpnVarAndType the cpn variable that has to represent the value for one of the possibility dependencies
Throws:
java.io.IOException

writeInstances

public static void writeInstances(java.io.BufferedWriter bw,
                                  ColoredPetriNet pn)
                           throws java.io.IOException
Writes the instances elements of the cpn-file. This element is needed for displaying the separate models in the CPN Tools program itself.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
pn - ColoredPetriNet the Simulated Petri Net that is the root of the hierarchical structure of ColoredPetriNet models.
Throws:
java.io.IOException

writeInstance

public static void writeInstance(java.io.BufferedWriter bw,
                                 ColoredPetriNet pn)
                          throws java.io.IOException
Writes the instance elements in the cpn-file. If a transition has a link to another simulatedPetriNet then an instantation of the transition has to be made in the cpn-file.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
pn - ColoredPetriNet the ColoredPetriNet that has transitions that have a link to another Simulated PetriNet.
Throws:
java.io.IOException

writeOptionsBinders

public static void writeOptionsBinders(java.io.BufferedWriter bw)
                                throws java.io.IOException
Writes the tags for the options and binders elements at almost the end of the cpn-file.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
Throws:
java.io.IOException

writeFusionPlaces

public static void writeFusionPlaces(java.io.BufferedWriter bw,
                                     ManagerID idMan,
                                     java.util.HashMap<java.lang.String,java.util.HashSet> fusionPlaces)
                              throws java.io.IOException
Parameters:
bw - BufferedWriter
idMan - ManagerID
fusionPlaces - HashMap
Throws:
java.io.IOException

writeEnd

public static void writeEnd(java.io.BufferedWriter bw)
                     throws java.io.IOException
Writes the end of the cpn-file. So, the tag for the indexNode element is written and also the closing tags for the cpnet and workspaceElements elements are written.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
Throws:
java.io.IOException

writeEndOfPage

public static void writeEndOfPage(java.io.BufferedWriter bw)
                           throws java.io.IOException
Writes the closing tag for a page in the cpn-file.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
Throws:
java.io.IOException

writeStartTagMonitorBlock

public static void writeStartTagMonitorBlock(java.io.BufferedWriter bw)
                                      throws java.io.IOException
Writes the starting tag for the monitor block

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
Throws:
java.io.IOException

writeEndTagMonitorBlock

public static void writeEndTagMonitorBlock(java.io.BufferedWriter bw)
                                    throws java.io.IOException
Writes the end tag for the monitor block

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
Throws:
java.io.IOException

writeBeginMonitorForFunction

public static void writeBeginMonitorForFunction(java.io.BufferedWriter bw,
                                                ManagerID idMan,
                                                java.lang.String nameMonitor,
                                                java.lang.String nodeidref,
                                                java.util.ArrayList<java.lang.String> pageinstanceidrefs)
                                         throws java.io.IOException
Writes information that is needed for creating a monitor for a function in cpn-tools.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
nameMonitor - String the name of the monitor (usually the name of the transition for which this monitor has been defined)
nodeidref - String the CPN id of the transition
pageinstanceidrefs - String the instance ID of the page on which the transition will be located
Throws:
java.io.IOException

writeMonitorInitFunction

public static void writeMonitorInitFunction(java.io.BufferedWriter bw,
                                            ManagerID idMan)
                                     throws java.io.IOException
Writes the init function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
Throws:
java.io.IOException

writeMonitorInitFunctionForFolderGeneration

public static void writeMonitorInitFunctionForFolderGeneration(java.io.BufferedWriter bw,
                                                               ManagerID idMan)
                                                        throws java.io.IOException
Writes the init function for generating the logs folder in which the logs need to be stored.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
Throws:
java.io.IOException

writeMonitorPredicateFunction

public static void writeMonitorPredicateFunction(java.io.BufferedWriter bw,
                                                 ManagerID idMan,
                                                 java.lang.String namePage,
                                                 java.lang.String nameTransition,
                                                 java.util.ArrayList<java.lang.String> boundedVars,
                                                 int numberInstantiations)
                                          throws java.io.IOException
Writes the predicate function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
namePage - String the name of the page on which the transition that will be monitored is located.
nameTransition - String the name of the transition that will be monitored.
boundedVars - ArrayList a list of Strings that represent the variables that have to be bound when the transition is going to be executed.
numberInstantiations - the number of instantations of the transition to which the monitor is attached.
Throws:
java.io.IOException

writeMonitorObserverFunction

public static void writeMonitorObserverFunction(java.io.BufferedWriter bw,
                                                ManagerID idMan,
                                                java.lang.String namePage,
                                                java.lang.String nameTransition,
                                                java.util.ArrayList<java.lang.String> boundedVars,
                                                java.util.ArrayList<java.lang.String> valuesTrue,
                                                java.util.ArrayList<java.lang.String> valuesFalse,
                                                int numberInstantiations)
                                         throws java.io.IOException
Writes the observer function for the monitor (of a transition) that is used for the logging functionality in cpn-tools.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
namePage - String the name of the page on which the transition that will be monitored is located.
nameTransition - String the name of the transition that will be monitored.
boundedVars - ArrayList a list of Strings that represent the variables that have to be bound when the transition is going to be executed.
valuesTrue - ArrayList a list of Strings that represent the values (may be a variable) that are extracted from the net and send to the action function in the case that the vars in boundedVars are all bounded
valuesFalse - ArrayList a list of Strings that represent values that are needed when not all vars in boundedVars are bounded when the transition is executed. Although these values will never be used, they need to be provided because of the way how the observer function is set-up in cpn (if-then-else). Actually, the observer function will only be executed when the transition is executed and that means that all variables are bounded.
numberInstantiations - the number of instantiations of the transition to which this monitor is attached.
Throws:
java.io.IOException

writeMonitorActionFunctionForInit

public static void writeMonitorActionFunctionForInit(java.io.BufferedWriter bw,
                                                     ManagerID idMan)
                                              throws java.io.IOException
Writes the action function for the monitor of the initialisation transition that will be used for creating separate files for each case that enters the net.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
Throws:
java.io.IOException

writeMonitorActionFunctionNormal

public static void writeMonitorActionFunctionNormal(java.io.BufferedWriter bw,
                                                    ManagerID idMan,
                                                    java.lang.String nameTransition,
                                                    java.lang.String eventType,
                                                    java.lang.String cpnTypeOfCaseId,
                                                    java.lang.String cpnTypeOfOriginator,
                                                    java.lang.String cpnTypeOfDataVar,
                                                    java.util.HashMap nameDataAttrAndType)
                                             throws java.io.IOException
Writes the action function for the monitor (of a transition) that is used for the logging functionality in cpn-tools. The action function calls the addATE method that adds an audit trail entry to the xml file that corresponds to the case-id for which the transition is executed.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
nameTransition - String the name of the transition which needs to be monitored
eventType - String the eventType (e.g. schedule, start, complete)
cpnTypeOfCaseId - String the cpn-type of the case id (uppercase).
cpnTypeOfOriginator - String the cpn-type of the originator. "" if no originator can be provided.
cpnTypeOfDataVar - String the cpn-type of the variable that represents the data attributes. "" if no data attributes can be provided.
nameDataAttrAndType - HashMap if data attributes can be provided then the hashmap should be filled with the name of the separate data attribute and the corresponding cpn-type.
Throws:
java.io.IOException

writeMonitorStopFunctionAndEndMonitor

public static void writeMonitorStopFunctionAndEndMonitor(java.io.BufferedWriter bw,
                                                         ManagerID idMan)
                                                  throws java.io.IOException
Writes the stop function for the monitor (of a transition) that is used for the logging functionality in cpn-tools. Furthermore, the closing tag for the monitor itself is written.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
Throws:
java.io.IOException

writeMarkingSizeMonitorResources

public static void writeMarkingSizeMonitorResources(java.io.BufferedWriter bw,
                                                    ManagerID idMan,
                                                    java.util.HashMap<java.lang.String,java.util.ArrayList> infoForMonitoringResources)
                                             throws java.io.IOException
Writes the monitor for keeping track of the resources in the global resources place.

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
infoForMonitoringResources - HashMap In the case that the global fusion place is attached to transitions the hashmap contains the cpnid of these transitions and the corresponding pageinstanceidrefs of the pages on which the transition is located. In the case that the global fusion place is not attached to a transition, the hashmap only contains the cpnid of the place and the corresponding pageinstanceidrefs of the pages on which the transition is located.
Throws:
java.io.IOException

writeThroughputTimeMonitor

public static void writeThroughputTimeMonitor(java.io.BufferedWriter bw,
                                              ManagerID idMan,
                                              java.lang.String cpnID,
                                              java.util.ArrayList<java.lang.String> pageInstanceIdRefs,
                                              java.lang.String dataVar)
                                       throws java.io.IOException
Writes the monitor for calculating the throughput time to the cpn file

Parameters:
bw - BufferedWriter the BufferedWriter used to stream the data to the file.
idMan - ManagerID the idManager that generates new cpn IDs.
cpnID - String the cpn ID of the transition to which the monitor has been attached.
pageInstanceIdRefs - String the pageinstanceidref of the page on which the transition is located
dataVar - the cpn variable for the data. "" may be used if no data information is available
Throws:
java.io.IOException

writePlaceTag

public static void writePlaceTag(java.io.BufferedWriter bw,
                                 java.lang.String placeID,
                                 ManagerID idMan,
                                 int xPos,
                                 int yPos,
                                 java.lang.String label,
                                 int width,
                                 int height,
                                 java.lang.String placeType,
                                 java.lang.String initMark,
                                 java.lang.String portType,
                                 java.lang.String nameFusionPlace)
                          throws java.io.IOException
Writes a complete place tag in the CPN Tools format.

Parameters:
bw - the BufferedWriter used to stream the data to the file
placeID - the ID number for the place
idMan - the ID Manager of the simulated Petri Net in which the place can be found
xPos - the position of the place on the x axis
yPos - the position of the place on the y axis
label - the name of the place
width - the width of the ellipse forming the place's shape
height - the height of the ellipse forming the place's shape
placeType - the type of the place (must be existing color set)
initMark - the initial marking of the place
portType - the port type (an empty String should be passed if the place is not a port place)
nameFusionPlace - The name of the fusion place, "" needs to be provided if the place is not a fusion place.
Throws:
java.io.IOException

writeTransitionTag

public static void writeTransitionTag(java.io.BufferedWriter bw,
                                      java.lang.String transitionID,
                                      ManagerID idMan,
                                      int xPos,
                                      int yPos,
                                      java.lang.String label,
                                      int width,
                                      int height,
                                      java.lang.String guard,
                                      java.lang.String timeDelay,
                                      java.lang.String codeInscription,
                                      java.lang.String subpageID,
                                      java.lang.String subpageTagName,
                                      java.util.ArrayList portsToSockets,
                                      boolean isInvisibleTask)
                               throws java.io.IOException
Writes a complete transition tag in the CPN Tools format.

Parameters:
bw - the BufferedWriter used to stream the data to the file
transitionID - the cpn-id for the transition
idMan - ManagerID the idManager that generates new cpn IDs.
xPos - the position of the transition on the x axis
yPos - the position of the transition on the y axis
label - the name of the transition
width - the width of the rectangle forming the transition's shape
height - the height of the rectangle forming the transition's shape
guard - the guard condition (an empty String should be passed if the guard is not specified for this transition)
timeDelay - the time delay specification (an empty String should be passed if the time delay is not specified for this transition)
codeInscription - the code inscription for this transition (an empty String should be passed if no code inscription is specified for this transition)
subpageID - the complete ID of the related subpage (null should be passed if the transition is no substitution transition)
subpageTagName - the name to be displayed as the subpage tag. Without a given subpageID the subpageTagName will be ignored
portsToSockets - a list specifying the assignment from port to socket places for this substitution transition. The list should contain a list of two ID numbers [socketIDno,portIDno] for each element. Without a given subpageID the list will be ignored
isInvisibleTask - true if the transition corresponds to an invisible task, false otherwise
Throws:
java.io.IOException

writeArcTag

public static void writeArcTag(java.io.BufferedWriter bw,
                               ManagerID idMan,
                               java.lang.String orientation,
                               java.lang.String transEnd,
                               java.lang.String placeEnd,
                               int xPos,
                               int yPos,
                               java.lang.String inscription,
                               java.util.ArrayList bendpoints)
                        throws java.io.IOException
Writes a complete arc tag in the CPN Tools format.

Parameters:
bw - the BufferedWriter used to stream the data to the file
idMan - ManagerID the idManager that generates new cpn IDs.
orientation - the orientation of the arc (PtoT | TtoP)
transEnd - the ID number for the connected transition
placeEnd - the ID number for the connected place
xPos - the x coordinate of the arc inscription
yPos - the y coordinate of the arc inscription
inscription - the actual arc inscription (should be a valid variable or expression)
bendpoints - a list of bendpoints, each consisting of a list with two elements [xCoord,yCoord] (should be null if there are no bendpoints specified)
Throws:
java.io.IOException

getXCoordinateArcInscription

public static int getXCoordinateArcInscription(int node1,
                                               int node2)
Calculates the the position of the arc inscription on the x axis.

Parameters:
node1 - the head node connected to the arc
node2 - the tail node connected to the arc
Returns:
int the position on the x axis

getYCoordinateArcInscription

public static int getYCoordinateArcInscription(int node1,
                                               int node2)
Calculates the the position of the arc inscription on the y axis.

Parameters:
node1 - the head node connected to the arc
node2 - the tail node connected to the arc
Returns:
int the position on the y axis