All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.uni.freiburg.iig.telematik.sepia.util.PNRefinement Maven / Gradle / Ivy

Go to download

SEPIA provides implementations for various types of Petri nets. Along Place/Transition-nets, it supports Petri nets with distinguishable token colors and defines coloured workflow nets, where coloured tokens are interpreted as data elements used during process execution. To support information flow analysis of processes, SEPIA defines so-called IF-Nets, tailored for security-oriented workflow modeling which enable users to assign security-levels (HIGH, LOW) to transitions, data elements and persons/agents participating in the process execution.

The newest version!
package de.uni.freiburg.iig.telematik.sepia.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import de.invation.code.toval.validate.ParameterException;
import de.uni.freiburg.iig.telematik.sepia.petrinet.abstr.AbstractFlowRelation;
import de.uni.freiburg.iig.telematik.sepia.petrinet.abstr.AbstractMarking;
import de.uni.freiburg.iig.telematik.sepia.petrinet.abstr.AbstractPetriNet;
import de.uni.freiburg.iig.telematik.sepia.petrinet.abstr.AbstractPlace;
import de.uni.freiburg.iig.telematik.sepia.petrinet.abstr.AbstractTransition;

/**
 * This class provides methods for Petri net refinement.
* Refinement operations aim to reduce Petri nets in shape and structure without changing their behavior. * * @author Thomas Stocker * */ public class PNRefinement { /** * This method removes redundant places from the given Petri net.
* A place is redundant when the net contains another place with exactly the same input and output transitions.
* * @param net * Petri net to refine. */ public static

, T extends AbstractTransition, F extends AbstractFlowRelation, M extends AbstractMarking, S extends Object> void refine(AbstractPetriNet net) { List

placeList = new ArrayList

(net.getPlaces()); // Build equivalence classes of places having the same relations. List> eqClasses = new ArrayList>(); try { for (P place : placeList) { boolean inserted = false; for (List

eqClass : eqClasses) { if (eqClass.get(0).hasEqualRelations(place)) { eqClass.add(place); inserted = true; break; } } if (!inserted) { eqClasses.add(new ArrayList

(Arrays.asList(place))); } } // Find redundant places // -> Each equivalence class that holds more than one element // contains such places placeList.clear(); for (List

eqClass : eqClasses) { if (eqClass.size() > 1) { placeList.addAll(eqClass.subList(1, eqClass.size())); } } // Remove redundant places. for (P place : placeList) { net.removePlace(place.getName()); } } catch (ParameterException e) { // Cannot happen, since only places of the net itself are used in computation e.printStackTrace(); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy