public void TickPlus() { foreach (var arc in InArcs.Where(arc => arc.IsActive)) { Markers += arc.Multiplicity; } }
public bool CheckConditionsOfTransitions(List <Position> positions) { List <string> names = InArcs.Select(x => x.PrevPosition.Name).ToList(); if (positions.Where(x => names.Contains(x.Name) == true).Sum(x => x.MarkersCount) >= InArcs.Count) { return(true); } else { return(false); } }
public bool CheckConditionsOfTransition(List <Place> places) { bool flag = true; List <string> placesNames = InArcs.Select(x => x.PrevPosition.Name).ToList(); List <Place> placesForCheck = places.Where(x => placesNames.Contains(x.Name)).ToList(); for (int i = 0; i < placesForCheck.Count; i++) { if (placesForCheck[i].MarkersCount < InArcs[i].Multiplicity) { flag = false; break; } } return(flag); }
public void AddInArc(string placeName, string transitionName, bool isInhibitor, int weight) { if (InArcs == null) { InArcs = new Dictionary <int, List <InArc> >(); } int fromIndex = PlaceIndex(placeName); int toIndex = TransitionIndex(transitionName); if (!InArcs.ContainsKey(fromIndex)) { InArcs[fromIndex] = new List <InArc>(); } InArcs[fromIndex].Add(new InArc(toIndex, weight, isInhibitor)); }
public void IncomingFrequency() { TNext += InArcs.FirstOrDefault().PrevPosition.MarkersCount / OutArcs.FirstOrDefault().Multiplicity; }