Ejemplo n.º 1
0
 /// <summary>
 /// Fires given transition (attempts to consume a token in all input places and produces a token in all output places).
 /// </summary>
 /// <param name="transition">A transition to be fired.</param>
 private void Fire(ITransition transition)
 {
     if (transition != null)
     {
         foreach (IPlace ip in transition.InputPlaces)
         {
             PlaceTokenDiagnosticsOverlay inputPlace = Diagnostics[ip.Id];
             inputPlace.ConsumeToken();
         }
         foreach (IPlace op in transition.OutputPlaces)
         {
             PlaceTokenDiagnosticsOverlay outputPlace = Diagnostics[op.Id];
             outputPlace.ProduceToken();
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Attempts to consume a token in end place (every compliant trace should have a token only in the end place at its end).
        /// </summary>
        private void CleanUpEndPlace()
        {
            PlaceTokenDiagnosticsOverlay endPlace = Diagnostics[PetriNet.EndPlace.Id];

            endPlace.ConsumeToken();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Finds start place and produces an initial token.
        /// </summary>
        private void SetupStartPlace()
        {
            PlaceTokenDiagnosticsOverlay startPlace = Diagnostics[PetriNet.StartPlace.Id];

            startPlace.ProduceToken();
        }