示例#1
0
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>
 /// A System.Collections.Generic.IEnumerator that can be used to iterate through the collection.
 /// </returns>
 public IEnumerator <T> GetEnumerator()
 {
     if (enumerators == null)
     {
         enumerators = new APMemoryManager <BufferedLinkedListEnumerator <T> >();
     }
     return(enumerators.New().Init(this));
 }
示例#2
0
        /// <summary>
        /// Add new breakpoint to this provider.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="time">Time of new breakpoint.</param>
        /// <param name="context">Context of new breakpoint.</param>
        /// <param name="action">Action which will be called on new breakpoint.</param>
        /// <param name="priority">Priority of new breakpoint(breakpoints with lesser priority with same time called earlier).</param>
        /// <returns>Key of this breakpoint(positive ingeger number) or -1(if we can't add this breakpoint(For example time less than currentTime))</returns>
        public long AddBreakPoint <T>(HdDateTime time, T context, Action <HdDateTime, object> action, int priority = 0)
        {
            if (time < CurrentTime)
            {
                return(-1);
            }
            key++;
            BreakPoint breakPoint = memoryManager.New();

            breakPoint.Time             = time;
            breakPoint.CustomData       = context;
            breakPoint.Priority         = priority;
            breakPoint.BreakPointAction = action;
            breakPoint.NumberOfMessage  = key;
            int _key;

            if (needPop)
            {
                memoryManager.Delete(breakPoints.Peek.Value);
                _key    = breakPoints.ModifyTop(breakPoint).Key;
                needPop = false;
            }
            else
            {
                _key = breakPoints.Add(breakPoint);
            }
            breakPoint.Key = _key;
            return(_key);
        }