Esempio n. 1
0
        /// <summary>
        /// Method to check if the subsystem can perform the most recent task that was added to the schedule
        /// </summary>
        /// <param name="subsystem"></param>
        /// <param name="proposedSchedule"></param>
        /// <param name="environment"></param>
        /// <returns></returns>
        private static bool checkSub(Subsystem subsystem, SystemSchedule proposedSchedule, Universe environment)
        {
            if (subsystem.IsEvaluated)
            {
                return(true);
            }
            var events = proposedSchedule.AllStates.Events;

            if (events.Count != 0)
            {
                //if (events.Count > 1)
                //    subsystem._oldState = events.ElementAt(events.Count - 2).State;
                //else
                //    subsystem._oldState = null;

                if (!subsystem.CanPerform(events.Peek(), environment))
                {
                    return(false);
                }
                events.Peek().isEvaluated += 1;
            }
            return(true);
        }