Пример #1
0
        public static ITimeFunction Create(Action eval, Action init = null, TimeSpan?rate = null)
        {
            var ret = new ActionTimeFunction()
            {
                Eval = eval, Init = init
            };

            ret.Governor.Rate = rate.HasValue ? rate.Value : ret.Governor.Rate;
            return(ret);
        }
Пример #2
0
        /// <summary>
        /// Creates a time function given action code to run
        /// </summary>
        /// <param name="eval">The evaluation action to run</param>
        /// <param name="rate">The governor rate for the function</param>
        /// <returns>A time function that can be added into a time model</returns>
        public static ITimeFunction Create(Action eval, TimeSpan?rate = null)
        {
            var ret = new ActionTimeFunction()
            {
                Eval = eval
            };

            ret.Governor = new RateGovernor(rate.HasValue ? rate.Value : ret.Governor.Rate);
            return(ret);
        }