Пример #1
0
        /// <summary>
        /// Move to the next items.
        /// </summary>
        /// <returns><c>true</c> if there is a next item, <c>false</c> otherwise</returns>
        public override bool MoveNext()
        {
            PageFetcher <T> .Page <T> page = GetCurrentPage();
            if (page == null)
            {
                return(false);
            }

            IList <T> items = page.Items;

            if (items == null || items.Count == 0)
            {
                return(false);
            }

            if (SkipOffset == items.Count)
            {
                if (!HasMoreItems)
                {
                    return(false);
                }

                page  = IncrementPage();
                items = page?.Items;
            }

            if (items == null || items.Count == 0 || SkipOffset == items.Count)
            {
                return(false);
            }

            current = items[IncrementSkipOffset()];

            return(true);
        }
Пример #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="skipCount">the skip count</param>
 /// <param name="pageFetcher">the delegate that fetches a page</param>
 protected AbstractEnumerator(BigInteger skipCount, PageFetcher <T> pageFetcher)
 {
     this.SkipCount   = skipCount;
     this.pageFetcher = pageFetcher;
 }
Пример #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="position">the skip count</param>
 /// <param name="pageFetcher">>the delegate that fetches a page</param>
 protected AbstractEnumerable(BigInteger position, PageFetcher <T> pageFetcher)
 {
     this.PageFetcher = pageFetcher;
     this.SkipCount   = position;
 }
Пример #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pageFetcher">>the delegate that fetches a page</param>
 public AbstractEnumerable(PageFetcher <T> pageFetcher) :
     this(0, pageFetcher)
 {
 }
Пример #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="skipCount">the skip count</param>
 /// <param name="pageFetcher">the delegate that fetches a page</param>
 public CollectionPageEnumerator(BigInteger skipCount, PageFetcher <T> pageFetcher) :
     base(skipCount, pageFetcher)
 {
 }
Пример #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="position">the position</param>
 /// <param name="pageFetcher">the delegate that fetches a page</param>
 public CollectionPageEnumerable(BigInteger position, PageFetcher <T> pageFetcher) :
     base(position, pageFetcher)
 {
 }
Пример #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pageFetcher">the delegate that fetches a page</param>
 public CollectionPageEnumerable(PageFetcher <T> pageFetcher) :
     this(0, pageFetcher)
 {
 }