Interface EfficientPetrinetSemantics

  • All Superinterfaces:
    PetrinetSemantics, org.processmining.models.semantics.Semantics<Marking,​Transition>, java.io.Serializable
    All Known Implementing Classes:
    EfficientPetrinetSemanticsImpl

    public interface EfficientPetrinetSemantics
    extends PetrinetSemantics
    Petrinet semantics designed with good performance characteristics avoiding object creation overhead. Therefore, multiple additional methods are added, to allow for direct access and manipulation of the data structures.

    The original PetrinetSemantics interface is also supported, but using methods of this interface might not lead to the best performance.

    Author:
    F. Mannhardt, S.J. van Zelst
    • Method Detail

      • directExecuteExecutableTransition

        void directExecuteExecutableTransition​(Transition transition)
        Executes (fires) a transition. For performance reasons, this method does not check whether the transition is actually enabled and does not return information on what changed.
        Parameters:
        transition -
      • equalMarking

        boolean equalMarking​(byte[] marking1,
                             Marking marking2)
        Parameters:
        marking1 -
        marking2 -
        Returns:
        whether marking2 is equal to marking1
      • equalOrLessMarking

        boolean equalOrLessMarking​(byte[] marking1,
                                   Marking marking2)
        Parameters:
        marking1 -
        marking2 -
        Returns:
        whether marking2 has equal or less tokens on each place than marking1
      • executeExecutableTransition

        org.processmining.models.semantics.ExecutionInformation executeExecutableTransition​(Transition toExecute)
                                                                                     throws org.processmining.models.semantics.IllegalTransitionException
        For better performance, use method directExecuteExecutableTransition(Transition) instead.
        Specified by:
        executeExecutableTransition in interface org.processmining.models.semantics.Semantics<Marking,​Transition>
        Parameters:
        toExecute -
        Returns:
        Throws:
        org.processmining.models.semantics.IllegalTransitionException
      • getExecutableTransitions

        java.util.Collection<Transition> getExecutableTransitions()
        For better performance, use method isEnabled(Transition) instead.
        Specified by:
        getExecutableTransitions in interface org.processmining.models.semantics.Semantics<Marking,​Transition>
        Returns:
        a collection of all enabled transitions
      • getIndex

        int getIndex​(Place place)
        Parameters:
        place -
        Returns:
        the index used for this place, corresponds to an index in getState()
      • getIndex

        int getIndex​(Transition transition)
        Parameters:
        transition -
        Returns:
        the index used (internally) for this transition.
      • getMissingTokensToEnable

        byte[] getMissingTokensToEnable​(Transition t)
        figures out whether a certain transition t is missing any tokens to be fired.
        Parameters:
        t - transition to fire
        Returns:
        array of the number of tokens missing for each indexed place to enable t
      • getMissingTokensToEnable

        byte[] getMissingTokensToEnable​(int transitionIndex)
      • getPlace

        Place getPlace​(int placeIndex)
        Parameters:
        placeIndex - of the place
        Returns:
        the Place object corresponding to the index
      • getState

        byte[] getState()
        Returns:
        a copy of the underlying array of tokens in the current state (marking).
      • getStateAsMarking

        Marking getStateAsMarking()
        Creates a new Marking object with the current marking.
        Returns:
        the current state as a Marking
      • getTransition

        Transition getTransition​(int index)
        Parameters:
        index - of the transition
        Returns:
        the Transition Object corresponding to the index
      • isEnabled

        boolean isEnabled​(Transition transition)
        Parameters:
        transition -
        Returns:
        whether the transition is enabled
      • isEnabled

        boolean isEnabled​(int transitionIndex)
      • isMarked

        boolean isMarked​(byte[] marking,
                         Place place)
        Parameters:
        marking - obtained with getState()
        place - of the net
        Returns:
        where place p is marked
      • setState

        void setState​(byte[] state)
        Sets the state to the supplied state (marking). The state array is copied into the internal data structure.
        Parameters:
        state -
      • setStateAsMarking

        void setStateAsMarking​(Marking marking)
        Sets the state to the supplied marking.
        Parameters:
        marking -
      • convert

        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.
        Parameters:
        marking - of the petri net used wihtin semantics
        Returns:
        corresponding int array
      • convert

        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.
        Parameters:
        marking - to transform (int arr)
        Returns:
        fresh marking object