/// <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(); } } }
/// <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(); }