Package org.oristool.petrinet
Class PetriNet
A Petri net model.
-
Field Summary
Fields inherited from class org.oristool.util.Featurizable
features
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddInhibitorArc
(Place p, Transition t) Adds an inhibitor arc with multiplicity 1.addInhibitorArc
(Place p, Transition t, int multiplicity) Adds an inhibitor arc with given multiplicity.Adds a place to the Petri net.addPostcondition
(Transition t, Place p) Adds a postcondition with multiplicity 1.addPostcondition
(Transition t, Place p, int multiplicity) Adds a postcondition with given multiplicity.addPrecondition
(Place p, Transition t) Adds a precondition with multiplicity 1.addPrecondition
(Place p, Transition t, int multiplicity) Adds a precondition with given multiplicity.addTransition
(String transitionName) Adds a transition to the Petri net.getEnabledTransitions
(Marking marking) Returns the set of transitions enabled by a given marking.getInhibitorArc
(Place p, Transition t) Returns the existing inhibitor arc between a place and a transition.Gets all the inhibitor arcs of a transition.Gets an existing place with the given name.Returns the names of the places in the Petri net.Returns the places of the Petri net.getPostcondition
(Transition t, Place p) Returns the existing postcondition between a place and a transition.Gets all the postconditions of a transition.getPrecondition
(Place p, Transition t) Returns the existing precondition between a place and a transition.Gets all the preconditions of a transition.getTransition
(String transitionName) Gets an existing transition with the given name.Returns the names of the transitions in the Petri net.Returns the transitions of the Petri net.boolean
isEnabled
(Transition t, Marking m) Checks if a transition is enabled by a marking.Removes the existing inhibitor arc between a place and a transition.removePlace
(Place p) Removes an existing place.Removes the existing postcondition between a place and a transition.Removes the existing precondition between a place and a transition.Removes an existing transition.toString()
Methods inherited from class org.oristool.util.Featurizable
addFeature, getFeature, getFeatures, hasFeature, removeFeature
-
Constructor Details
-
PetriNet
public PetriNet()
-
-
Method Details
-
addPlace
Adds a place to the Petri net.If a place with the same name already exists, the existing place is returned.
- Parameters:
placeName
- the name of the place- Returns:
- the place instance
-
getPlace
Gets an existing place with the given name.- Parameters:
placeName
- name of the place- Returns:
- place instance, or
null
if no place exists with the given name
-
removePlace
Removes an existing place.- Parameters:
p
- place to be removed- Returns:
- the removed place
-
getPlaces
Returns the places of the Petri net.- Returns:
- collection of places
-
getPlaceNames
Returns the names of the places in the Petri net.- Returns:
- names of the places
-
addTransition
Adds a transition to the Petri net.If a transition with the same name already exists, the existing transition is returned.
- Parameters:
transitionName
- the name of the transition- Returns:
- the transition instance
-
getTransition
Gets an existing transition with the given name.- Parameters:
transitionName
- name of the transition- Returns:
- transition instance, or
null
if no transition exists with the given name
-
removeTransition
Removes an existing transition.- Parameters:
t
- transition to be removed- Returns:
- the removed transition
-
getTransitions
Returns the transitions of the Petri net.- Returns:
- collection of transitions
-
getTransitionNames
Returns the names of the transitions in the Petri net.- Returns:
- names of the transitions
-
addPrecondition
Adds a precondition with multiplicity 1.- Parameters:
p
- placet
- transition- Returns:
- the added precondition
-
addPrecondition
Adds a precondition with given multiplicity.- Parameters:
p
- input placet
- target transitionmultiplicity
- precondition multiplicity- Returns:
- the added precondition
-
getPrecondition
Returns the existing precondition between a place and a transition.- Parameters:
p
- input placet
- target transition- Returns:
- precondition between the place and the transition, or
null
if no precondition exists
-
removePrecondition
Removes the existing precondition between a place and a transition.- Parameters:
pre
- existing precondition- Returns:
- precondition between the place and the transition
-
getPreconditions
Gets all the preconditions of a transition.- Parameters:
t
- transition- Returns:
- preconditions of the transition
-
addInhibitorArc
Adds an inhibitor arc with multiplicity 1.- Parameters:
p
- placet
- transition- Returns:
- the added inhibitor arc
-
addInhibitorArc
Adds an inhibitor arc with given multiplicity.- Parameters:
p
- input placet
- target transitionmultiplicity
- inhibitor arc multiplicity- Returns:
- the added inhibitor arc
-
getInhibitorArc
Returns the existing inhibitor arc between a place and a transition.- Parameters:
p
- input placet
- target transition- Returns:
- inhibitor arc between the place and the transition, or
null
if inhibitor arc exists
-
removeInhibitorArc
Removes the existing inhibitor arc between a place and a transition.- Parameters:
ia
- existing inhibitor arc- Returns:
- inhibitor arc between the place and the transition
-
getInhibitorArcs
Gets all the inhibitor arcs of a transition.- Parameters:
t
- transition- Returns:
- inhibitor arcs of the transition
-
addPostcondition
Adds a postcondition with multiplicity 1.- Parameters:
p
- placet
- transition- Returns:
- the added postcondition
-
addPostcondition
Adds a postcondition with given multiplicity.- Parameters:
p
- input placet
- target transitionmultiplicity
- postcondition multiplicity- Returns:
- the added postcondition
-
getPostcondition
Returns the existing postcondition between a place and a transition.- Parameters:
p
- input placet
- target transition- Returns:
- postcondition between the place and the transition, or
null
if no postcondition exists
-
removePostcondition
Removes the existing postcondition between a place and a transition.- Parameters:
post
- existing postcondition- Returns:
- postcondition between the place and the transition
-
getPostconditions
Gets all the postconditions of a transition.- Parameters:
t
- transition- Returns:
- postconditions of the transition
-
toString
- Overrides:
toString
in classFeaturizable<PetriNetFeature>
-
getEnabledTransitions
Returns the set of transitions enabled by a given marking.- Parameters:
marking
- a marking- Returns:
- set of transitions enabled by the marking
-
isEnabled
Checks if a transition is enabled by a marking.- Parameters:
t
- a transitionm
- a marking- Returns:
true
if the transition is enabled by the marking
-