public CreatePetriNet WithTransitions(params string[] transitionNames) { Contract.Requires(transitionNames.Count() != 0); Contract.Requires(transitionNames.All(s1 => !string.IsNullOrWhiteSpace(s1))); Contract.Requires(transitionNames.All(s1 => s1.All(Char.IsLetterOrDigit))); if (Transitions == null) { Transitions = new Dictionary <int, string>(); } var tmp = transitionNames.Select((s, i) => Tuple.Create(i, s)).ToDictionary(tuple => tuple.Item1, tuple1 => tuple1.Item2); int count = (Transitions.Count > 0 ? Transitions.Keys.Max() : -1) + 1; foreach (var item in tmp) { if (!Transitions.ContainsValue(item.Value)) { Transitions[count] = item.Value; count++; } } return(this); }