|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatt.grappa.Element
att.grappa.Subgraph
att.grappa.Graph
org.processmining.framework.models.ModelGraph
org.processmining.framework.models.petrinet.PetriNet
public class PetriNet
A Petri net is a data structure that is used to model concurrent behavior. It
can be represented as a bipartite (that is, the two types of node can only be
connected in an alternating manner), directed graph connecting
Transition
nodes with Place
nodes.
Transition
,
Place
,
PNEdge
,
Token
Field Summary |
---|
Fields inherited from class org.processmining.framework.models.ModelGraph |
---|
DOESNTCROSS_REGION, ENTERS_REGION, EXITS_REGION, identifier, nodeMapping, vertices, visualObject |
Fields inherited from class att.grappa.Graph |
---|
INDENT_STRING, REFCNTXT |
Fields inherited from class att.grappa.Subgraph |
---|
currentSelection, defaultNamePrefix |
Fields inherited from class att.grappa.Element |
---|
counter, highlight, linewidth, object, printAllAttributes, printDefaultAttributes, usePrintList, visible |
Fields inherited from interface att.grappa.GrappaConstants |
---|
_NO_TYPE, ANONYMOUS_PREFIX, BBOX_ATTR, BBOX_HASH, BOX_SHAPE, BOX_TYPE, CLUSTERRANK_ATTR, COLOR_ATTR, COLOR_HASH, COLOR_TYPE, CUSTOM_ATTR, CUSTOM_HASH, CUSTOM_SHAPE, DELETION_MASK, DIAMOND_SHAPE, DIR_ATTR, DIR_HASH, DIR_TYPE, DISTORTION_ATTR, DISTORTION_HASH, DOUBLE_TYPE, DOUBLECIRCLE_SHAPE, DOUBLEOCTAGON_SHAPE, EDGE, EGG_SHAPE, FILLCOLOR_ATTR, FILLCOLOR_HASH, FONTCOLOR_ATTR, FONTCOLOR_HASH, FONTNAME_ATTR, FONTNAME_HASH, FONTSIZE_ATTR, FONTSIZE_HASH, FONTSTYLE_ATTR, FONTSTYLE_HASH, FONTSTYLE_TYPE, GRAPPA_BACKGROUND_COLOR_ATTR, GRAPPA_BACKGROUND_COLOR_HASH, GRAPPA_DELETION_STYLE_ATTR, GRAPPA_DELETION_STYLE_HASH, GRAPPA_FONTSIZE_ADJUSTMENT_ATTR, GRAPPA_FONTSIZE_ADJUSTMENT_HASH, GRAPPA_SELECTION_STYLE_ATTR, GRAPPA_SELECTION_STYLE_HASH, GRAPPA_SHAPE, HASHLIST_TYPE, HEIGHT_ATTR, HEIGHT_HASH, HEXAGON_SHAPE, HIGHLIGHT_MASK, HIGHLIGHT_OFF, HIGHLIGHT_ON, HIGHLIGHT_TOGGLE, HOUSE_SHAPE, IDENTXFRM, IMAGE_ATTR, IMAGE_HASH, INTEGER_TYPE, INVERTEDHOUSE_SHAPE, INVERTEDTRAPEZIUM_SHAPE, INVERTEDTRIANGLE_SHAPE, LABEL_ATTR, LABEL_HASH, LINE_SHAPE, LINE_TYPE, LOG10, LP_ATTR, LP_HASH, MARGIN_ATTR, MARGIN_HASH, MCIRCLE_SHAPE, MCLIMIT_ATTR, MCLIMIT_HASH, MDIAMOND_SHAPE, MINBOX_ATTR, MINBOX_HASH, MINLEN_ATTR, MINLEN_HASH, MINSIZE_ATTR, MINSIZE_HASH, MRECORD_SHAPE, MSQUARE_SHAPE, NBSP, NEW_LINE, NO_SHAPE, NODE, NODESEP_ATTR, NODESEP_HASH, OCTAGON_SHAPE, ORIENTATION_ATTR, ORIENTATION_HASH, OVAL_SHAPE, PACKAGE_PREFIX, PARALLELOGRAM_SHAPE, PATCH_ATTR, PATCH_HASH, PENTAGON_SHAPE, PERIPHERIES_ATTR, PERIPHERIES_HASH, PERIPHERY_GAP, PKG_LOWER, PKG_UPLOW, PKG_UPPER, PLAINTEXT_SHAPE, POINT_TYPE, PointsPerInch, POLYGON_SHAPE, POS_ATTR, POS_HASH, PRINTLIST_ATTR, PRINTLIST_HASH, RANKDIR_ATTR, RANKDIR_HASH, RANKSEP_ATTR, RANKSEP_HASH, RECORD_SHAPE, RECTS_ATTR, RECTS_HASH, ROTATION_ATTR, ROTATION_HASH, ROUNDEDBOX_SHAPE, SELECTION_MASK, SHAPE_ATTR, SHAPE_HASH, SHAPE_MASK, SHAPE_TYPE, SIDES_ATTR, SIDES_HASH, SIZE_ATTR, SIZE_HASH, SIZE_TYPE, SKEW_ATTR, SKEW_HASH, STRING_TYPE, STYLE_ATTR, STYLE_HASH, STYLE_TYPE, SUBGRAPH, SYSTEM, TAG_ATTR, TAG_HASH, TIP_ATTR, TIP_HASH, TRAPEZIUM_SHAPE, TRIANGLE_SHAPE, TRIPLEOCTAGON_SHAPE, TYPES_SHIFT, WEIGHT_ATTR, WEIGHT_HASH, WIDTH_ATTR, WIDTH_HASH |
Constructor Summary | |
---|---|
PetriNet()
Creates an empty Petri net. |
Method Summary | |
---|---|
boolean |
addAndLinkEdge(PNEdge e,
Place p,
Transition t)
Adds a given edge from the given place (source node) to the given transition (target node). |
boolean |
addAndLinkEdge(PNEdge e,
Transition t,
Place p)
Adds an edge from the given transition (source node) to the given place (target node). |
Place |
addAndLinkPlace(Place p)
Adds a given place to this Petri net. |
Transition |
addAndLinkTransition(Transition t)
Adds a given Transition to this Petri net. |
void |
addCluster(TransitionCluster tc)
Adds a given cluster of transitions to the Petri net. |
boolean |
addEdge(Place p,
Transition t)
Adds a new PNEdge from the given place (source node) to the given transition (target node). |
boolean |
addEdge(Transition t,
Place p)
Adds an edge from the given transition (source node) to the given place (target node). |
void |
addNet(PetriNet pn)
Adds ... |
Place |
addPlace(Place p)
Adds a given place to this Petri net. |
Place |
addPlace(java.lang.String identifier)
Adds a new place with a given identifier to this Petri net. |
boolean |
addToken(java.util.Date timestamp,
Place p)
Adds a token to the given place in this Petri net. |
Transition |
addTransition(LogEvent e)
Deprecated. Please now use addTransition(Transition t); |
Transition |
addTransition(Transition t)
Adds a given transition to this Petri net. |
java.lang.Object |
clone()
Makes a deep copy of the object, i.e., reconstructs the Petri net structure with cloned transitions, places, edges, and clusters. |
void |
delPlace(Place p)
Deletes a given place from this Petri net. |
void |
delTransition(Transition t)
Deletes a given transition to this Petri net. |
PetriNet |
extractNet(java.util.Set<att.grappa.Node> nodes)
Returns the a cloned subnet of this PetriNet containing the nodes of the input set argument. |
Place |
findPlace(java.util.Set in,
java.util.Set out)
Finds a place in the Petri net based on a given set of predecessor and successor nodes. |
Place |
findPlace(java.lang.String identifier)
Finds a place in the Petri net based on a given identifier (which is assumed to be unique). |
Transition |
findRandomTransition(LogEvent lme)
Finds a transition having the specified log event. |
Transition |
findTransition(LogEvent lme)
Deprecated. Please use findTransition(Transition t) instead |
Transition |
findTransition(Transition t)
Finds a transition in the Petri net which is equal to the given one (based on the equals method). |
java.util.ArrayList |
findTransitions(LogEvent lme)
Finds all transitions having the specified log event. |
protected void |
finishDotWriting(java.io.Writer bw)
This is the finishing part of the writeToDot
procedure. |
java.util.ArrayList<TransitionCluster> |
getClusters()
Returns all TransitionCluster objects known to this
PetriNet. |
cern.colt.matrix.DoubleMatrix2D |
getIncidenceMatrix()
Builds the incidence matrix belonging to this Petri net. |
cern.colt.matrix.DoubleMatrix2D |
getInputArcsTransitionsIncidenceMatrix()
Builds the incidence matrix for the input arcs of transitions in this Petri net. |
java.util.ArrayList |
getInvisibleTasks()
Retrieves the invisible tasks contained in this net. |
java.util.ArrayList<PNNode> |
getNodes()
|
int |
getNumberOfInvisibleTasks()
Retrieves the number of invisible tasks, i.e., those that do not have a corresponding log event. |
int |
getNumberOfNonDuplicateTasks()
Retrieves the number of visible tasks without counting duplicate tasks multiple times. |
int |
getNumberOfVisibleTasks()
Retrieves the number of transitions without counting invisible tasks, i.e., those that do not have a corresponding log event. |
cern.colt.matrix.DoubleMatrix2D |
getOutputArcsTransitionsIncidenceMatrix()
Builds the incidence matrix for the output arcs of transitions in this Petri net. |
java.util.ArrayList<Place> |
getPlaces()
Gets the Place nodes contained in this Petri net. |
ModelGraphVertex |
getSink()
Returns the first sink found in the nodes of this Petri net |
ModelGraphVertex |
getSource()
Returns the first source found in the nodes of this Petri net |
java.util.ArrayList<Transition> |
getTransitions()
Gets the Transition nodes contained in this Petri net. |
java.util.ArrayList |
getVisibleTasks()
Retrieves the visible tasks contained in this net. |
protected void |
initDotWriting(java.io.Writer bw)
This is the part of the writeToDot procedure which
initializes the temporary dot file by setting font, size, margin, etc. |
boolean |
isAcyclic()
Determines if this net is acyclic |
void |
makeClusters()
Clusters transitions based on their LogEvents. |
Place |
mergePlaces(Place p1,
Place p2)
Merges two given places into one single place. |
int |
numberOfNodes()
Returns the number of nodes in this PetriNet, i.e., transitions plus places |
int |
numberOfPlaces()
Returns the number of places in this PetriNet |
int |
numberOfTransitions()
Returns the number of transitions in this PetriNet |
void |
removeVertex(ModelGraphVertex v)
|
void |
Test(java.lang.String tag)
Print key indicators of the PetriNet to the Test tab. |
protected void |
writeClustersToDot(java.io.Writer bw)
This is the cluster writing part of the writeToDot
procedure. |
protected void |
writeEdgesToDot(java.io.Writer bw)
This is the edge writing part of the writeToDot
procedure. |
protected void |
writePlacesToDot(java.io.Writer bw)
This is the place writing part of the writeToDot
procedure. |
void |
writeToDot(java.io.Writer bw)
Writes a DOT representation of this graph to the given Writer . |
protected void |
writeTransitionsToDot(java.io.Writer bw)
This is the transition writing part of the writeToDot
procedure. |
Methods inherited from class org.processmining.framework.models.ModelGraph |
---|
addEdge, addEdge, addVertex, calculateAllNonCompRegions, calculateAllRegions, calculateMinimalRegions, calculateRegionsMaxSize, delEdge, getAllEdges, getEdgeObjects, getEdges, getEdgesBetween, getFirstEdge, getGrappaVisualization, getIdentifier, getNumberOfEdges, getPostRegions, getPreRegions, getShortestDistances, getVerticeList, getWeightedArcs, reduceTransitively, removeEdge, removeEdges, setIdentifier, setWeightedArcs |
Methods inherited from class att.grappa.Graph |
---|
addPanel, attributeType, buildShapes, decrementIndent, dropcloth, getErrorWriter, getGlobalAttribute, getGlobalAttributeKeys, getGlobalAttributePairs, getGlobalAttributeSize, getGrappaAttribute, getGrappaAttributeKeys, getGrappaAttributeValue, getId, getIndent, getSynchronizePaint, getToolTipText, incrementIndent, isDirected, isEditable, isMenuable, isSelectable, isStrict, paintImmediately, printError, printError, printGraph, printGraph, removePanel, repaint, reset, reset, resync, setEditable, setErrorWriter, setGrappaAttribute, setMenuable, setSelectable, setSynchronizePaint, setToolTipText, validGrappaAttributeKey |
Methods inherited from class att.grappa.Subgraph |
---|
addEdge, addNode, addSubgraph, addTypeTag, clearPatchWork, compare, computePatchWork, countOfElements, countOfLocalElements, createElement, edgeElements, elements, elements, equals, findEdgeByName, findNodeByName, findSubgraphByName, getBoundingBox, getEdgeAttribute, getEdgeAttributeKeys, getEdgeAttributePairs, getEdgeAttributeValue, getNodeAttribute, getNodeAttributeKeys, getNodeAttributePairs, getNodeAttributeValue, getShowEdgeLabels, getShowNodeLabels, getShowSubgraphLabels, getType, hasEmptySubgraphs, hasTypeTag, hasTypeTags, isCluster, isLR, isRoot, isSubgraph, nodeElements, patchWork, preparePatchWork, printSubgraph, removeEdge, removeEmptySubgraphs, removeNode, removeSubgraph, removeTypeTag, removeTypeTags, resetBoundingBox, setAttribute, setAttribute, setEdgeAttribute, setEdgeAttribute, setName, setNodeAttribute, setNodeAttribute, setShowEdgeLabels, setShowNodeLabels, setShowSubgraphLabels, subgraphElements, vectorOfElements |
Methods inherited from class att.grappa.Element |
---|
addTag, attrNotOfInterest, attrOfInterest, bdfs, buildShape, canonString, canonValue, clearBBox, delete, getAttribute, getAttributePairs, getAttributeValue, getDefaultAttribute, getDefaultAttribute, getGraph, getGrappaNexus, getId, getIdKey, getLocalAttribute, getLocalAttributeKeys, getLocalAttributePairs, getName, getSubgraph, getThisAttribute, getThisAttributeValue, hasAttributeForKey, hasDefaultTag, hasDefaultTags, hasLocalTag, hasLocalTags, hasTag, hasTags, isEdge, isNode, isOfInterest, listAttrsOfInterest, printElement, removeTag, removeTags, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setIdKey, setSubgraph, setUserAttributeType, toString, typeString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PetriNet()
Method Detail |
---|
public void addCluster(TransitionCluster tc)
tc
- the TransitionCluster to be addedpublic java.util.ArrayList<TransitionCluster> getClusters()
TransitionCluster
objects known to this
PetriNet.
TransitionCluster
public java.util.ArrayList<Transition> getTransitions()
Transition
nodes contained in this Petri net.
public java.util.ArrayList<Place> getPlaces()
Place
nodes contained in this Petri net.
public java.util.ArrayList<PNNode> getNodes()
public Place mergePlaces(Place p1, Place p2)
p1
- the first place to be mergedp2
- the second place to be merged
Null
otherwise.public Transition addTransition(Transition t)
addAndLinkTransition(Transition t)
instead.
t
- the transition to be added
public Transition addAndLinkTransition(Transition t)
addTransition(Transition t)
instead.
t
- the transition to be added
public Transition addTransition(LogEvent e)
e
- the LogEvent of the transition to be added
Adds a new transition to this Petri net. The transition is backed up by a
LogEvent
public void delTransition(Transition t)
t
- the transition to be removedpublic void delPlace(Place p)
p
- the place to be removedpublic Place addPlace(Place p)
addAndLinkPlace(Place p)
instead.
p
- the place to be added
public Place addAndLinkPlace(Place p)
addPlace(Place p)
instead.
p
- the place to be added
public Place addPlace(java.lang.String identifier)
identifier
- the string specifying the identifier
public void addNet(PetriNet pn)
pn
- the Petri net to be addedpublic boolean addEdge(Place p, Transition t)
p
- the place specified as the source node for the new edget
- the transition specified as the target node for the new edge
true
if both the transition and the place are
contained in this Petri net, false
otherwisepublic boolean addAndLinkEdge(PNEdge e, Place p, Transition t)
e
- the edge to be added from p to tp
- the place specified as the source node for the new edget
- the transition specified as the target node for the new edge
true
if both the transition and the place are
contained in this Petri net, false
otherwisepublic boolean addEdge(Transition t, Place p)
t
- the transition specified as the source node for the new edgep
- the place specified as the target node for the new edge
true
if both the transition and the place are
contained in this Petri net, false
otherwisepublic boolean addAndLinkEdge(PNEdge e, Transition t, Place p)
e
- the edge to be added from t to pt
- the transition specified as the source node for the new edgep
- the place specified as the target node for the new edge
true
if both the transition and the place are
contained in this Petri net, false
otherwisepublic void writeToDot(java.io.Writer bw) throws java.io.IOException
Writer
.
This representation is used by the getGrappaVisualization
method
to generate the visualization. Note that this function should have a call to
nodeMapping.clear()
at the beginning and it should call
nodeMapping.put(new String(
nodeID),
nodeObject);
after writing a node to the dot file
When a petri net is asked for its visualization, a temporary dot file is written and afterwards read by grappa to convert it into a java frame. Therefore, to modify the vizualization of a Petri net, this method needs to be overridden.
Since internally the write procedure is decomposed into semantically distinct sections, it is recommended to only override the sub procedures that are affected by the given modifications.
The partial steps include: initDotWriting, writeTransitionsToDot, writePlacesToDot, writeEdgesToDot, and writeAdditionsToDot.
writeToDot
in interface DotFileWriter
writeToDot
in class ModelGraph
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failsprotected void initDotWriting(java.io.Writer bw) throws java.io.IOException
writeToDot
procedure which
initializes the temporary dot file by setting font, size, margin, etc.
parameters.
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failsprotected void writeTransitionsToDot(java.io.Writer bw) throws java.io.IOException
writeToDot
procedure.
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failsprotected void writePlacesToDot(java.io.Writer bw) throws java.io.IOException
writeToDot
procedure.
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failsprotected void writeEdgesToDot(java.io.Writer bw) throws java.io.IOException
writeToDot
procedure.
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failsprotected void writeClustersToDot(java.io.Writer bw) throws java.io.IOException
writeToDot
procedure. The transition clusters are visualized drawing a blue box
around those transitions belonging to one group, i.e., cluster.
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failsgetClusters
,
makeClusters
protected void finishDotWriting(java.io.Writer bw) throws java.io.IOException
writeToDot
procedure. Here the graph is only closed but overriding classes might
want to add additional visualization elements after writing the acutal
Petri net.
bw
- the writer used by the framework to create the temporary dot
file
java.io.IOException
- if writing to the writer failspublic boolean addToken(java.util.Date timestamp, Place p)
timestamp
- the date to be attached with the tokenp
- the place where the token should be added
true
if the token could be added,
false
otherwisepublic Transition findRandomTransition(LogEvent lme)
Use this method if you know that there are no multiple transitions associated to the same log event (i.e., duplicate tasks), or if finding one of them would suffice.
If you want to get a complete list of transitions having the specified
log event, use findTransitions
instead.
lme
- the log event specified
Null
otherwise.public java.util.ArrayList findTransitions(LogEvent lme)
Use this method if you expect the net having multiple transitions associated to the same log event (i.e., duplicate tasks).
If this cannot happen or finding one of them would suffice, you can use
findRandomTransition
instead, which will
directly return the first element of that list.
lme
- the log event specified
public Transition findTransition(LogEvent lme)
e
- the LogEvent to compare with
Null
otherwise.Finds a transition in the Petri net
with a link to the given LogEvent. In case there are more, it
returns the first
public Transition findTransition(Transition t)
equals
method).
t
- the transition to compare with
Null
otherwise.public Place findPlace(java.lang.String identifier)
identifier
- the string specifying the identifier
Null
otherwise.public Place findPlace(java.util.Set in, java.util.Set out)
in
- the set of predecessor nodesout
- the set of successor nodes
Null
otherwise.public void makeClusters()
public cern.colt.matrix.DoubleMatrix2D getIncidenceMatrix()
public cern.colt.matrix.DoubleMatrix2D getInputArcsTransitionsIncidenceMatrix()
public cern.colt.matrix.DoubleMatrix2D getOutputArcsTransitionsIncidenceMatrix()
public int getNumberOfVisibleTasks()
public int getNumberOfInvisibleTasks()
public java.util.ArrayList getInvisibleTasks()
public java.util.ArrayList getVisibleTasks()
public int getNumberOfNonDuplicateTasks()
public ModelGraphVertex getSource()
public ModelGraphVertex getSink()
public PetriNet extractNet(java.util.Set<att.grappa.Node> nodes)
A
- set of nodes that belongs to this PetriNet
public int numberOfPlaces()
public int numberOfTransitions()
public int numberOfNodes()
public boolean isAcyclic()
public void removeVertex(ModelGraphVertex v)
removeVertex
in class ModelGraph
ModelGraph.removeVertex(org.processmining.framework.models.ModelGraphVertex)
public java.lang.Object clone()
clone
in class ModelGraph
public void Test(java.lang.String tag)
Test
in class ModelGraph
tag
- String The tag to use for the indicators.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |