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

org.jbpt.petri.PetriNet Maven / Gradle / Ivy

Go to download

The jBPT code library is a compendium of technologies that support research on design, execution, and evaluation of business processes.

The newest version!
package org.jbpt.petri;

import java.util.ArrayList;
import java.util.Collection;

import org.jbpt.algo.graph.DirectedGraphAlgorithms;
import org.jbpt.petri.structure.PetriNetStructuralChecks;
import org.jbpt.petri.structure.PetriNetTransformations;


/**
 * An implementation of IPetriNet interface.
 * 
 * TODO create and extend a bipartite graph.
 * 
 * @author Artem Polyvyanyy
 * @author Matthias Weidlich
 * @author Andreas Meyer
 */
public class PetriNet extends AbstractPetriNet {
	
	public static DirectedGraphAlgorithms					DIRECTED_GRAPH_ALGORITHMS = new DirectedGraphAlgorithms();
	public static PetriNetStructuralChecks	STRUCTURAL_CHECKS = new PetriNetStructuralChecks();
	public static PetriNetTransformations	TRANSFORMATIONS = new PetriNetTransformations();
	
	@Override
	public Flow addFlow(Node from, Node to) {
		if (from == null || to == null) return null;
		
		if ((from instanceof Place && to instanceof Transition) ||
				from instanceof Transition && to instanceof Place) {
			
			Collection ss = new ArrayList(); ss.add(from);
			Collection ts = new ArrayList(); ts.add(to);
			
			if (!this.checkEdge(ss,ts)) return null;
			
			return new Flow(this, from, to);
		}
		
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy