<commit_before>﻿// -------------------------------------------------------------------------------------------------------------------
// <copyright company="Gemotial" file="HLListPage.cs" project="Gmtl.HandyLib" date="2016-06-05 15:27">
// 
// </copyright>
// -------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
namespace Gmtl.HandyLib
{
    /// <summary>
    /// Provides base class for 'pagination'
    /// </summary>
    /// <typeparam name="T">List item type</typeparam>
    public class HLListPage<T>
    {
        private readonly List<T> itemsOnPage;

        public HLListPage(IEnumerable<T> items, int totalCount, int pageNumber, int pageSize)
        {
            if (pageNumber < 1)
                throw new ArgumentOutOfRangeException("pageNumber", pageNumber, "pageNumber cannot be less than 1..");

            if (pageSize < 1)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, "pageSize cannot be less than 1.");

            if (items == null)
                throw new ArgumentNullException("items", "superset cannot be null.");

            TotalCount = totalCount;
            PageSize = pageSize;
            PageNumber = pageNumber;
            itemsOnPage = new List<T>(items);
        }

        public int TotalCount { get; private set; }
        public int PageNumber { get; private set; }
        public int PageSize { get; private set; }

        public int PageCount
        {
            get { return this.itemsOnPage.Count; }
        }

        public T this[int index]
        {
            get { return this.itemsOnPage[index]; }
        }

        public IEnumerator<T> GetEnumerator()
        {
            return this.itemsOnPage.GetEnumerator();
        }
    }
}<commit_msg>Added IsEmpty property on HLListPage<commit_after>﻿// -------------------------------------------------------------------------------------------------------------------
// <copyright company="Gemotial" file="HLListPage.cs" project="Gmtl.HandyLib" date="2016-06-05 15:27">
// 
// </copyright>
// -------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace Gmtl.HandyLib
{
    /// <summary>
    /// Provides base class for 'pagination'
    /// </summary>
    /// <typeparam name="T">List item type</typeparam>
    public class HLListPage<T>
    {
        private readonly List<T> itemsOnPage;

        public HLListPage(IEnumerable<T> items, int totalCount, int pageNumber, int pageSize)
        {
            if (pageNumber < 1)
                throw new ArgumentOutOfRangeException("pageNumber", pageNumber, "pageNumber cannot be less than 1..");

            if (pageSize < 1)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, "pageSize cannot be less than 1.");

            if (items == null)
                throw new ArgumentNullException("items", "superset cannot be null.");

            TotalCount = totalCount;
            PageSize = pageSize;
            PageNumber = pageNumber;
            itemsOnPage = new List<T>(items);
        }

        public int TotalCount { get; private set; }
        public int PageNumber { get; private set; }
        public int PageSize { get; private set; }

        public int PageCount
        {
            get { return this.itemsOnPage.Count; }
        }

        public T this[int index]
        {
            get { return this.itemsOnPage[index]; }
        }

        public IEnumerator<T> GetEnumerator()
        {
            return this.itemsOnPage.GetEnumerator();
        }

        public bool IsEmpty
        {
            get { return itemsOnPage.Count == 0; }
        }
    }
}
{'fraction_non_alphanumeric': 0.2150313152400835, 'fraction_numerical': 0.00861169102296451, 'mean_word_length': 1.4167717528373267, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2485348', 'n_tokens_mistral': 980, 'n_tokens_neox': 940, 'n_words': 261}