Пример #1
0
        /// <summary>
        /// Determines if the target or event value maintained in the tracking state is still valid for the given stamp and time
        /// parameters supplied by the caller. If not, the tracking state retrieves the appropriate value from the event list
        /// and caches it for use. Once the internal tracking state is validated and updated as necessary, the
        /// coorect target or evnet value is returned for use.
        /// </summary>
        /// <param name="stamp"></param>
        /// <param name="_Time"></param>
        /// <returns></returns>
        public T DetermineTrackingStateValue(int stamp, DateTime _Time, T defaultValue)
        {
            T result = defaultValue;

            if (Stamp == stamp)
            {
                if (_Time >= EndDate)
                {
                    if (IsNextEventSuitable(Stamp, _Time))
                    {
                        result = ThisEvent;
                    }
                    else
                    {
                        result = EventList.GetValueAtDate(_Time, out int _, defaultValue);
                        RecordEventState(Stamp);
                    }
                }
            }
            else if (IsCurrentEventSuitable(_Time))
            {
                Stamp = stamp;
            }
            else
            {
                result = EventList.GetValueAtDate(_Time, out int _, defaultValue);
                RecordEventState(Stamp);
            }

            return(result);
        }