예제 #1
0
        public PetriNetTransition AddTransition(string name)
        {
            var result = new PetriNetTransition(name);

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

            return(result);
        }
예제 #2
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);
        }