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

de.uni.freiburg.iig.telematik.sepia.graphic.AbstractGraphicalPN 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.graphic;

import de.invation.code.toval.misc.NamedComponent;
import de.uni.freiburg.iig.telematik.sepia.event.PNStructureListener;
import de.uni.freiburg.iig.telematik.sepia.event.PlaceChangeEvent;
import de.uni.freiburg.iig.telematik.sepia.event.RelationChangeEvent;
import de.uni.freiburg.iig.telematik.sepia.event.TransitionChangeEvent;
import de.uni.freiburg.iig.telematik.sepia.graphic.netgraphics.AbstractPNGraphics;
import de.uni.freiburg.iig.telematik.sepia.graphic.netgraphics.AnnotationGraphics;
import de.uni.freiburg.iig.telematik.sepia.graphic.netgraphics.ArcGraphics;
import de.uni.freiburg.iig.telematik.sepia.graphic.netgraphics.NodeGraphics;
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;

/**
 * 

* The GraphicalPetriNet is a container class for the {@link AbstractPetriNet} * and adds some graphical information to the net. *

* * @author Adrian Lange * * @param

Type of Petri net places * @param Type of Petri net transitions * @param Type of Petri net relations * @param Type of Petri net markings * @param Type of Petri net place states */ public abstract class AbstractGraphicalPN

, T extends AbstractTransition, F extends AbstractFlowRelation, M extends AbstractMarking, S extends Object, N extends AbstractPetriNet, G extends AbstractPNGraphics> implements PNStructureListener, NamedComponent { private N petriNet = null; private G petriNetGraphics = null; /** * Create new GraphicalPetriNet with the specified {@link AbstractPetriNet}. */ public AbstractGraphicalPN(N petriNet, G petriNetGraphics) { setPetriNet(petriNet); setPetriNetGraphics(petriNetGraphics); } protected AbstractGraphicalPN() { super(); } @Override public void setName(String name) { getPetriNet().setName(name); } @Override public String getName() { return getPetriNet().getName(); } /** * @return the {@link AbstractPetriNet} */ public N getPetriNet() { return petriNet; } /** * @param petriNet the petriNet to set */ public void setPetriNet(N petriNet) { if (this.petriNet != null) { this.petriNet.removeStructureListener(this); } this.petriNet = petriNet; this.petriNet.addStructureListener(this); this.petriNetGraphics = null; } /** * @return the {@link AbstractPNGraphics} */ public G getPetriNetGraphics() { return petriNetGraphics; } /** * @param petriNetGraphics the petriNetGraphics to set */ public void setPetriNetGraphics(G petriNetGraphics) { this.petriNetGraphics = petriNetGraphics; } @Override public void structureChanged() { } @Override public void placeAdded(PlaceChangeEvent

event) { if (petriNetGraphics != null) { petriNetGraphics.getPlaceGraphics().put(event.place.getName(), new NodeGraphics()); petriNetGraphics.getPlaceLabelAnnotationGraphics().put(event.place.getName(), new AnnotationGraphics()); } } @Override public void placeRemoved(PlaceChangeEvent

event) { if (petriNetGraphics != null) { petriNetGraphics.getPlaceGraphics().remove(event.place.getName()); petriNetGraphics.getPlaceLabelAnnotationGraphics().remove(event.place.getName()); } } @Override public void transitionAdded(TransitionChangeEvent event) { if (petriNetGraphics != null) { petriNetGraphics.getTransitionGraphics().put(event.transition.getName(), new NodeGraphics()); petriNetGraphics.getTransitionLabelAnnotationGraphics().put(event.transition.getName(), new AnnotationGraphics()); } } @Override public void transitionRemoved(TransitionChangeEvent event) { if (petriNetGraphics != null) { petriNetGraphics.getTransitionGraphics().remove(event.transition.getName()); petriNetGraphics.getTransitionLabelAnnotationGraphics().remove(event.transition.getName()); } } @Override public void relationAdded(RelationChangeEvent event) { if (petriNetGraphics != null) { petriNetGraphics.getArcGraphics().put(event.relation.getName(), new ArcGraphics()); petriNetGraphics.getArcAnnotationGraphics().put(event.relation.getName(), new AnnotationGraphics()); } } @Override public void relationRemoved(RelationChangeEvent event) { if (petriNetGraphics != null) { petriNetGraphics.getArcGraphics().remove(event.relation.getName()); petriNetGraphics.getArcAnnotationGraphics().remove(event.relation.getName()); } } }