Package org.oristool.petrinet
Class Marking
java.lang.Object
org.oristool.petrinet.Marking
A marking, assigning a token count to each place of a Petri net.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a specified number of tokens in a place.boolean
containsSubMarking
(Marking subMarking) Checks whether this marking contains the same token counts for a subset of places.boolean
Returns the names of places with nonzero token counts.int
Returns the number of tokens of a place from its string name.int
Returns the number of tokens in a place.int
hashCode()
void
removeTokens
(Place place, int number) Removes a specified number of tokens from a place.void
Sets the number of tokens of a place.void
Resets this marking to the token counts of the input one.toString()
-
Constructor Details
-
Marking
public Marking()Builds an empty marking. -
Marking
Builds the copy of a marking.- Parameters:
m
- input marking
-
-
Method Details
-
setTokensFrom
Resets this marking to the token counts of the input one.- Parameters:
m
- input marking
-
getTokens
Returns the number of tokens in a place.- Parameters:
place
- the input place- Returns:
- token count of the place
-
getTokens
Returns the number of tokens of a place from its string name.- Parameters:
placeName
- name of the place- Returns:
- number of tokens of the place
-
setTokens
Sets the number of tokens of a place.- Parameters:
place
- target placetokens
- count of the place
-
addTokens
Adds a specified number of tokens in a place.- Parameters:
place
- target placenumber
- tokens to be added
-
removeTokens
Removes a specified number of tokens from a place.- Parameters:
place
- target placenumber
- tokens to be removed
-
hashCode
public int hashCode() -
equals
-
toString
-
containsSubMarking
Checks whether this marking contains the same token counts for a subset of places.- Parameters:
subMarking
- marking for a subset of places- Returns:
- true if this marking contains (as a subset) the same token assignments of the input one
-
getNonEmptyPlacesNames
Returns the names of places with nonzero token counts.- Returns:
- a set of strings of place names
-