Class Place
java.lang.Object
org.tweetyproject.logics.petri.syntax.PetriNetNode
org.tweetyproject.logics.petri.syntax.Place
- All Implemented Interfaces:
Comparable<Place>,Node
A class to describe places in a Petri net
- Author:
- Benedikt Knopp
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTokens(int tokens) Add tokensbooleancanAddTokens(int tokens) Check if tokens can be addedbooleancanRemoveTokens(int tokens) Check if tokens are removeableintgetId()Return the idintReturn the maximal number of tokens that this place can holdintReturn the number of tokens currently at this placebooleanisFinal()check if this place is a designated final placebooleancheck if this place is a designated initial placevoidremoveTokens(int tokens) Remove tokensvoidsetFinal()specify that this place is a designated final placevoidsetter idvoidspecify that this place is a designated initial placevoidsetMaxtokens(int maxtokens) Setter maxtokensvoidsetTokens(int tokens) setter tokensMethods inherited from class org.tweetyproject.logics.petri.syntax.PetriNetNode
getName, setName
-
Constructor Details
-
Place
-
Place
-
-
Method Details
-
getId
-
setId
setter id- Overrides:
setIdin classPetriNetNode- Parameters:
id- the id to set
-
getTokens
public int getTokens()Return the number of tokens currently at this place- Returns:
- the number of tokens currently at this place
-
setTokens
public void setTokens(int tokens) setter tokens- Parameters:
tokens- the number of tokens currently at this place
-
getMaxtokens
public int getMaxtokens()Return the maximal number of tokens that this place can hold- Returns:
- the maximal number of tokens that this place can hold
-
setMaxtokens
public void setMaxtokens(int maxtokens) Setter maxtokens- Parameters:
maxtokens- the maximal number of tokens that this place can hold
-
addTokens
public void addTokens(int tokens) Add tokens- Parameters:
tokens- the number of tokens to be added to this place- Throws:
IllegalArgumentException- if this number of tokens can not be added
-
removeTokens
public void removeTokens(int tokens) Remove tokens- Parameters:
tokens- the number of tokens to be removed from this place- Throws:
IllegalArgumentException- if this number of tokens can not be removed
-
canAddTokens
public boolean canAddTokens(int tokens) Check if tokens can be added- Parameters:
tokens- the number of tokens to be added to this place- Returns:
- true if this number can be added with respect to the token limit and the current number of tokens
-
canRemoveTokens
public boolean canRemoveTokens(int tokens) Check if tokens are removeable- Parameters:
tokens- the number of tokens to be removed from this place- Returns:
- true if this number can be removed with respect to current number of tokens
-
compareTo
- Specified by:
compareToin interfaceComparable<Place>
-
isInitial
public boolean isInitial()check if this place is a designated initial place- Returns:
- true iff this place is a designated initial place
-
setInitial
public void setInitial()specify that this place is a designated initial place -
isFinal
public boolean isFinal()check if this place is a designated final place- Returns:
- true iff this place is a designated final place
-
setFinal
public void setFinal()specify that this place is a designated final place
-