Class PlaceUtils


  • public class PlaceUtils
    extends java.lang.Object
    Utility functions that can be used over places
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PlaceUtils.Mapper  
    • Constructor Summary

      Constructors 
      Constructor Description
      PlaceUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double computePlaceMatchingCost​(Place p1, Place p2)
      Computes the place matching cost such that the overlap between the input transition labels and output transition labels between the two places is measured and then combined with an equal weight.
      static org.processmining.models.graphbased.directed.petrinet.Petrinet extractPetriNet​(java.lang.String petriNetFileName)  
      static java.util.Set<Place> extractPlaceNets​(java.lang.String placeNetsInputFilePath)  
      static java.util.Set<Transition> getAllTransitions​(java.util.Set<Place> places)  
      static Transition getCommonSilentTransition​(Place first, Place second)  
      static <T> java.util.Map<org.apache.commons.math3.util.Pair<T,​T>,​java.util.Set<Place>> getInoutTransitionPlaceSetMapping​(java.util.Set<Place> places, java.util.Map<java.lang.String,​T> labelMap)
      Returns a map where every pair of input output transitions in the places is mapped to all places that have the same input output transition pair
      static java.util.Map<org.apache.commons.math3.util.Pair<java.lang.Integer,​java.lang.Integer>,​java.util.Set<java.util.List<Place>>> getInoutTransitionPlaceSetMappingViaSilent​(java.util.Set<Place> places, java.util.Map<java.lang.String,​java.lang.Integer> labelMap)  
      static java.util.Set<Passage> getPassages​(Place place)  
      static PlaceSet getPlaceSetFromInputStream​(java.io.InputStream input)  
      static java.util.Set<Place> getPlacesFromPetriNet​(org.processmining.models.graphbased.directed.petrinet.Petrinet petrinet)  
      static <T> java.util.Map<T,​java.util.Set<Place>> getTransitionPlaceSetMapping​(java.util.Set<java.lang.String> transitionLabels, java.util.Set<Place> places, boolean transitionIsInput, java.util.Map<java.lang.String,​T> labelMap, boolean ignoreSelfLoops)
      Returns a map where every transition is mapped to all the places that have it as input transition or all the places that have it as output transition depending on the input
      static java.util.Set<org.apache.commons.math3.util.Pair<java.lang.String,​java.lang.String>> getVisibleInoutPairsInPlace​(Place place)
      Calculates the pairs of all combination of input and output transitions in a place.
      static java.util.Map<Place,​java.lang.Integer> mapPlacesToIndices​(java.util.Set<Place> places)  
      static void postProcessSilentTransitions​(java.util.Set<Place> places)  
      static void print​(java.util.Set<Place> places)  
      static Place revertPlace​(Place place)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlaceUtils

        public PlaceUtils()
    • Method Detail

      • print

        public static void print​(java.util.Set<Place> places)
      • revertPlace

        public static Place revertPlace​(Place place)
      • getTransitionPlaceSetMapping

        public static <T> java.util.Map<T,​java.util.Set<Place>> getTransitionPlaceSetMapping​(java.util.Set<java.lang.String> transitionLabels,
                                                                                                   java.util.Set<Place> places,
                                                                                                   boolean transitionIsInput,
                                                                                                   java.util.Map<java.lang.String,​T> labelMap,
                                                                                                   boolean ignoreSelfLoops)
        Returns a map where every transition is mapped to all the places that have it as input transition or all the places that have it as output transition depending on the input
        Type Parameters:
        T - : the type of the returning transition label
        Parameters:
        transitionLabels - : transition labels for which we want to create the map
        places - : places for which we want to create the map
        transitionIsInput - : whether we want to map the places for input or output transitions
        labelMap - : map between the original transition labels and what we want to return
        Returns:
        map of a transition label to set of places
      • getAllTransitions

        public static java.util.Set<Transition> getAllTransitions​(java.util.Set<Place> places)
      • getPlaceSetFromInputStream

        public static PlaceSet getPlaceSetFromInputStream​(java.io.InputStream input)
                                                   throws java.io.IOException,
                                                          java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • getInoutTransitionPlaceSetMapping

        public static <T> java.util.Map<org.apache.commons.math3.util.Pair<T,​T>,​java.util.Set<Place>> getInoutTransitionPlaceSetMapping​(java.util.Set<Place> places,
                                                                                                                                                    java.util.Map<java.lang.String,​T> labelMap)
        Returns a map where every pair of input output transitions in the places is mapped to all places that have the same input output transition pair
        Type Parameters:
        T - the new type of the transition labels
        Parameters:
        places - the places we want to group
        labelMap - the label mapping between the transitions in the places and the result we want to return
        Returns:
        map from which we can get all places that have a specific input output transitions pair
      • postProcessSilentTransitions

        public static void postProcessSilentTransitions​(java.util.Set<Place> places)
      • getInoutTransitionPlaceSetMappingViaSilent

        public static java.util.Map<org.apache.commons.math3.util.Pair<java.lang.Integer,​java.lang.Integer>,​java.util.Set<java.util.List<Place>>> getInoutTransitionPlaceSetMappingViaSilent​(java.util.Set<Place> places,
                                                                                                                                                                                                         java.util.Map<java.lang.String,​java.lang.Integer> labelMap)
      • getCommonSilentTransition

        public static Transition getCommonSilentTransition​(Place first,
                                                           Place second)
      • getVisibleInoutPairsInPlace

        public static java.util.Set<org.apache.commons.math3.util.Pair<java.lang.String,​java.lang.String>> getVisibleInoutPairsInPlace​(Place place)
        Calculates the pairs of all combination of input and output transitions in a place.
        Parameters:
        place - : the place for which we want to calculate all combinations of input output transitions.
        Returns:
        the pair of labels for all input output transition pairs
      • getPassages

        public static java.util.Set<Passage> getPassages​(Place place)
      • getPlacesFromPetriNet

        public static java.util.Set<Place> getPlacesFromPetriNet​(org.processmining.models.graphbased.directed.petrinet.Petrinet petrinet)
      • extractPlaceNets

        public static java.util.Set<Place> extractPlaceNets​(java.lang.String placeNetsInputFilePath)
                                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • extractPetriNet

        public static org.processmining.models.graphbased.directed.petrinet.Petrinet extractPetriNet​(java.lang.String petriNetFileName)
                                                                                              throws org.xmlpull.v1.XmlPullParserException,
                                                                                                     java.io.IOException
        Throws:
        org.xmlpull.v1.XmlPullParserException
        java.io.IOException
      • computePlaceMatchingCost

        public static double computePlaceMatchingCost​(Place p1,
                                                      Place p2)
        Computes the place matching cost such that the overlap between the input transition labels and output transition labels between the two places is measured and then combined with an equal weight. Since this would denote how similar the two places are, we subtract the result from one to get a cost.
        Parameters:
        p1 - the first place
        p2 - the second place
        Returns:
        the place matching cost
      • mapPlacesToIndices

        public static java.util.Map<Place,​java.lang.Integer> mapPlacesToIndices​(java.util.Set<Place> places)