/// <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> /// Finds start place and produces an initial token. /// </summary> private void SetupStartPlace() { PlaceTokenDiagnosticsOverlay startPlace = Diagnostics[PetriNet.StartPlace.Id]; startPlace.ProduceToken(); }