Beispiel #1
0
        private PetriNetPlace AddPlaceBetweenTransitions(PetriNetDefinition definition, RelationshipMatrix matrix, PetriNetTransition from, PetriNetTransition to)
        {
            PetriNetPlace result = null;

            foreach (var flowFrom in to.From)
            {
                var placeFrom   = flowFrom.From;
                var flowOrigin  = placeFrom.From[0];
                var transOrigin = flowOrigin.From;


                var relTypeFrom = matrix[Tuple.Create(from.Name, transOrigin.Name)];

                if (relTypeFrom == RelationshipType.NotFollow) //(c) XOR-Join pattern: a -> c, b -> c, and a#b
                {
                    result = placeFrom as PetriNetPlace;
                    definition.AddFlow(null, from, result);

                    return(null);
                }
            }

            var relType = matrix[Tuple.Create(from.Name, to.Name)];

            if (relType == RelationshipType.Cause) //(a) Sequence pattern: a -> b
            {
                result = definition.AddPlace(null, PetriNetPlaceType.Middle);
                definition.AddFlow(null, from, result);
                definition.AddFlow(null, result, to);
            }


            return(result);
        }
Beispiel #2
0
        public PetriNetPlace AddPlace(string name, PetriNetPlaceType type)
        {
            var result = new PetriNetPlace(name, type);

            this.Places.Add(result.Name, result);

            return(result);
        }