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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTokens
(int tokens) Add tokensboolean
canAddTokens
(int tokens) Check if tokens can be addedboolean
canRemoveTokens
(int tokens) Check if tokens are removeableint
getId()
Return the idint
Return the maximal number of tokens that this place can holdint
Return the number of tokens currently at this placeboolean
isFinal()
check if this place is a designated final placeboolean
check if this place is a designated initial placevoid
removeTokens
(int tokens) Remove tokensvoid
setFinal()
specify that this place is a designated final placevoid
setter idvoid
specify that this place is a designated initial placevoid
setMaxtokens
(int maxtokens) Setter maxtokensvoid
setTokens
(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:
setId
in 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:
compareTo
in 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
-