<commit_before>﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using NodaTime;
using static NodaTime.Period;

namespace DataGen.Types.Date {
    public static class DateFactory {
        private static LocalDate CurrentLocalDate
            => SystemClock.Instance.Now.InZone(DateTimeZoneProviders.Bcl.GetSystemDefault()).Date;


        /// <summary>
        ///     will create a sequence of the values given
        /// </summary>
        /// <param name="length">Length of sequence</param>
        /// <param name="date">date to be sequenced</param>
        /// <returns></returns>
        public static IEnumerable<LocalDate> CreateSequence(int length, LocalDate date) {
            var localDates = new Collection<LocalDate>();
            for (var i = 0; i < length; i++)
                localDates.Add(
                    CurrentLocalDate
                        .Plus(FromYears(date.Year * i))
                        .Plus(FromMonths(date.Month * i))
                        .Plus(FromDays(date.Day * i)));
            return localDates;
        }


        //Can add an bool arg and use ternary operator to make this into one method
        public static LocalDate CreatePastDate(LocalDate date)
            => CurrentLocalDate.Minus(FromYears(date.Year)).Minus(FromMonths(date.Month)).Minus(FromDays(date.Day));

        public static LocalDate CreateFutureDate(LocalDate date)
            => CurrentLocalDate.Plus(FromYears(date.Year)).Plus(FromMonths(date.Month)).Plus(FromDays(date.Day));
    }
}<commit_msg>turned 2 methods into one<commit_after>﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using NodaTime;
using static NodaTime.Period;

namespace DataGen.Types.Date {
    public static class DateFactory {
        private static LocalDate CurrentLocalDate
            => SystemClock.Instance.Now.InZone(DateTimeZoneProviders.Bcl.GetSystemDefault()).Date;


        /// <summary>
        ///     Will create a sequence of the values given
        /// </summary>
        /// <param name="length">Length of sequence</param>
        /// <param name="date">Date to be sequenced</param>
        /// <returns></returns>
        public static IEnumerable<LocalDate> CreateSequence(int length, LocalDate date) {
            var localDates = new Collection<LocalDate>();
            for (var i = 0; i < length; i++)
                localDates.Add(
                    CurrentLocalDate
                        .Plus(FromYears(date.Year * i))
                        .Plus(FromMonths(date.Month * i))
                        .Plus(FromDays(date.Day * i)));
            return localDates;
        }


        ///<summary>
        ///  Will add or subtract the date argument from current date.
        /// </summary>
        public static LocalDate CreateDate(LocalDate date, bool past = true)
            => past == true
                ? CurrentLocalDate.Minus(FromYears(date.Year)).Minus(FromMonths(date.Month)).Minus(FromDays(date.Day))
                : CurrentLocalDate.Plus(FromYears(date.Year)).Plus(FromMonths(date.Month)).Plus(FromDays(date.Day));
    }
}
{'fraction_non_alphanumeric': 0.11392405063291139, 'fraction_numerical': 0.0009493670886075949, 'mean_word_length': 2.225510204081633, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 30, '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': '6064212', 'n_tokens_mistral': 857, 'n_tokens_neox': 821, 'n_words': 195}