public final class EfficientPetrinetSemanticsImpl extends java.lang.Object implements EfficientPetrinetSemantics
PetrinetSemanticsImpl
avoiding
object creation.EfficientPetrinetSemantics.PlaceVisitor
Constructor and Description |
---|
EfficientPetrinetSemanticsImpl(EfficientPetrinetSemanticsImpl semantics)
Creates a copy of the supplied semantics with an independent state.
|
EfficientPetrinetSemanticsImpl(PetrinetGraph net)
Creates the semantics for the supplied
PetrinetGraph and an empty
initial marking. |
EfficientPetrinetSemanticsImpl(PetrinetGraph net,
Marking initialMarking)
Creates the semantics for the supplied
PetrinetGraph and initial
Marking . |
Modifier and Type | Method and Description |
---|---|
Marking |
convert(byte[] marking)
convert a primative int array to a marking object based on the internal
index representation of the petri net's places.
|
byte[] |
convert(Marking marking)
allows to convert a given marking to an equivalent int array based on the
internal index representation of the petri net's places.
|
void |
directExecuteExecutableTransition(Transition transition)
Executes (fires) a transition.
|
boolean |
equalMarking(byte[] marking1,
Marking marking2) |
boolean |
equalOrLessMarking(byte[] marking1,
Marking marking2) |
org.processmining.models.semantics.ExecutionInformation |
executeExecutableTransition(Transition transition)
For a more efficient implementation use
directExecuteExecutableTransition(Transition) , which does not
return any information about the execution. |
void |
forEachMarkedPlace(EfficientPetrinetSemantics.PlaceVisitor placeVisitor)
Visits each place that is marked with one or more tokens.
|
void |
forEachPlace(EfficientPetrinetSemantics.PlaceVisitor placeVisitor)
Visits each place.
|
Marking |
getCurrentState()
Convenience method of the original
PetrinetSemantics interface. |
java.util.Collection<Transition> |
getExecutableTransitions()
For better performance, use method
EfficientPetrinetSemantics.isEnabled(Transition)
instead. |
int |
getIndex(Place p) |
int |
getIndex(Transition t) |
byte[] |
getMissingTokensToEnable(int transitionIndex) |
byte[] |
getMissingTokensToEnable(Transition t)
figures out whether a certain transition t is missing any tokens to be
fired.
|
Place |
getPlace(int index) |
java.util.Map<Place,java.lang.Integer> |
getPlaceMap() |
byte[] |
getState() |
Marking |
getStateAsMarking()
Use
getCurrentState() instead. |
Transition |
getTransition(int index) |
void |
initialize(java.util.Collection<Transition> transitions,
Marking initialState)
This method cannot be used in this implementation.
|
boolean |
isEnabled(int transitionIndex) |
boolean |
isEnabled(Transition transition) |
boolean |
isMarked(byte[] marking,
Place place) |
void |
setCurrentState(Marking marking)
Convenience method of the original
PetrinetSemantics interface. |
void |
setState(byte[] marking)
Sets the state to the supplied state (marking).
|
void |
setStateAsMarking(Marking marking)
Use
setCurrentState(Marking) instead. |
public EfficientPetrinetSemanticsImpl(EfficientPetrinetSemanticsImpl semantics)
semantics
- public EfficientPetrinetSemanticsImpl(PetrinetGraph net)
PetrinetGraph
and an empty
initial marking. This semantics class treat all PetrinetGraph
s as
a Petrinet
(so do not honor the semantics of reset or inhibitor
nets).net
- with the graph structurepublic EfficientPetrinetSemanticsImpl(PetrinetGraph net, Marking initialMarking)
PetrinetGraph
and initial
Marking
. This semantics class treat all PetrinetGraph
s as
a Petrinet
(so do not honor the semantics of reset or inhibitor
nets).net
- with the graph structureinitialMarking
- public byte[] getState()
getState
in interface EfficientPetrinetSemantics
public void setState(byte[] marking)
EfficientPetrinetSemantics
setState
in interface EfficientPetrinetSemantics
public void directExecuteExecutableTransition(Transition transition)
EfficientPetrinetSemantics
directExecuteExecutableTransition
in interface EfficientPetrinetSemantics
public boolean isEnabled(Transition transition)
isEnabled
in interface EfficientPetrinetSemantics
public boolean isEnabled(int transitionIndex)
isEnabled
in interface EfficientPetrinetSemantics
public boolean isMarked(byte[] marking, Place place)
isMarked
in interface EfficientPetrinetSemantics
marking
- obtained with EfficientPetrinetSemantics.getState()
place
- of the netpublic void forEachMarkedPlace(EfficientPetrinetSemantics.PlaceVisitor placeVisitor)
EfficientPetrinetSemantics
forEachMarkedPlace
in interface EfficientPetrinetSemantics
public void forEachPlace(EfficientPetrinetSemantics.PlaceVisitor placeVisitor)
EfficientPetrinetSemantics
forEachPlace
in interface EfficientPetrinetSemantics
public boolean equalMarking(byte[] marking1, Marking marking2)
equalMarking
in interface EfficientPetrinetSemantics
public boolean equalOrLessMarking(byte[] marking1, Marking marking2)
equalOrLessMarking
in interface EfficientPetrinetSemantics
public void setCurrentState(Marking marking)
PetrinetSemantics
interface.
Use #setState(int[])
instead for a more efficient implementation.setCurrentState
in interface org.processmining.models.semantics.Semantics<Marking,Transition>
public Marking getCurrentState()
PetrinetSemantics
interface.
Use getState()
instead for a more efficient implementation.getCurrentState
in interface org.processmining.models.semantics.Semantics<Marking,Transition>
public java.util.Collection<Transition> getExecutableTransitions()
EfficientPetrinetSemantics
EfficientPetrinetSemantics.isEnabled(Transition)
instead.getExecutableTransitions
in interface EfficientPetrinetSemantics
getExecutableTransitions
in interface org.processmining.models.semantics.Semantics<Marking,Transition>
public org.processmining.models.semantics.ExecutionInformation executeExecutableTransition(Transition transition) throws org.processmining.models.semantics.IllegalTransitionException
directExecuteExecutableTransition(Transition)
, which does not
return any information about the execution.executeExecutableTransition
in interface EfficientPetrinetSemantics
executeExecutableTransition
in interface org.processmining.models.semantics.Semantics<Marking,Transition>
org.processmining.models.semantics.IllegalTransitionException
public void initialize(java.util.Collection<Transition> transitions, Marking initialState)
initialize
in interface org.processmining.models.semantics.Semantics<Marking,Transition>
public Marking getStateAsMarking()
getCurrentState()
instead.getStateAsMarking
in interface EfficientPetrinetSemantics
Marking
public void setStateAsMarking(Marking marking)
setCurrentState(Marking)
instead.setStateAsMarking
in interface EfficientPetrinetSemantics
public java.util.Map<Place,java.lang.Integer> getPlaceMap()
Place
to its index in the marking returned by
getState()
.public int getIndex(Transition t)
getIndex
in interface EfficientPetrinetSemantics
public int getIndex(Place p)
getIndex
in interface EfficientPetrinetSemantics
EfficientPetrinetSemantics.getState()
public byte[] getMissingTokensToEnable(Transition t)
EfficientPetrinetSemantics
getMissingTokensToEnable
in interface EfficientPetrinetSemantics
t
- transition to firepublic Place getPlace(int index)
getPlace
in interface EfficientPetrinetSemantics
index
- of the placepublic Transition getTransition(int index)
getTransition
in interface EfficientPetrinetSemantics
index
- of the transitionpublic byte[] getMissingTokensToEnable(int transitionIndex)
getMissingTokensToEnable
in interface EfficientPetrinetSemantics
public byte[] convert(Marking marking)
EfficientPetrinetSemantics
convert
in interface EfficientPetrinetSemantics
marking
- of the petri net used wihtin semanticspublic Marking convert(byte[] marking)
EfficientPetrinetSemantics
convert
in interface EfficientPetrinetSemantics
marking
- to transform (int arr)