Пример #1
0
        public TickTimeout GetLastTimeout(long min = 0, long max = long.MaxValue)
        {
            if (_Timeout.IsNullOrEmpty())
            {
                return(null);
            }

            int xParts = _Timeout.Width();
            int yParts = _Timeout.Height();

            decimal     select = max;
            TickTimeout result = null;
            int         x = 0, y;

            for (; x < xParts; x++)
            {
                for (y = 0; y < yParts; y++)
                {
                    TickTimeout tt = _Timeout[x, y];
                    if (!tt.IsEnabled())
                    {
                        continue;
                    }

                    if (tt.Span.InClosedInterval(min, max) && tt.Span <= select)
                    {
                        select = tt.Span;
                        result = tt.Copy();
                    }
                }
            }

            return(result);
        }
Пример #2
0
        public TickTimeout GetFirstTimeout(long min = 0, long max = long.MaxValue)
        {
            if (_Timeout.IsNullOrEmpty())
            {
                return(null);
            }

            int xParts = _Timeout.Width();
            int yParts = _Timeout.Height();

            decimal select = min;
            int     sx = -1, sy = -1;

            int x = 0, y;

            for (; x < xParts; x++)
            {
                for (y = 0; y < yParts; y++)
                {
                    TickTimeout tt = _Timeout[x, y];

                    if (!tt.IsEnabled())
                    {
                        continue;
                    }

                    if (tt.Span.InClosedInterval(min, max) && tt.Span >= select)
                    {
                        select = tt.Span;
                        sx     = x;
                        sy     = y;
                    }
                }
            }

            if (sx >= 0 && sy >= 0)
            {
                return(_Timeout[sx, sy].Copy());
            }


            return(null);
        }