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