Esempio n. 1
0
 public void TickPlus()
 {
     foreach (var arc in InArcs.Where(arc => arc.IsActive))
     {
         Markers += arc.Multiplicity;
     }
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 public void IncomingFrequency()
 {
     TNext += InArcs.FirstOrDefault().PrevPosition.MarkersCount / OutArcs.FirstOrDefault().Multiplicity;
 }