<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DateTimeExtensions.Strategies {
	public class FI_FIHolidayStrategy : IHolidayStrategy {
		private readonly IList<Holiday> holidays;

		public FI_FIHolidayStrategy() {
			this.holidays = new List<Holiday>();
			holidays.Add(ChristianHolidays.NewYear);
			holidays.Add(ChristianHolidays.Epiphany);
			holidays.Add(ChristianHolidays.GoodFriday);
			holidays.Add(ChristianHolidays.Easter);
			holidays.Add(ChristianHolidays.EasterMonday);
			holidays.Add(GlobalHolidays.MayDay);
			holidays.Add(ChristianHolidays.Ascension);
			holidays.Add(ChristianHolidays.Pentecost);
			holidays.Add(GlobalHolidays.MidsummerEve);
			holidays.Add(GlobalHolidays.MidsummerDay);
			holidays.Add(AllSaintsDay);
			holidays.Add(IndependanceDay);
			holidays.Add(ChristianHolidays.ChristmasEve);
			holidays.Add(ChristianHolidays.Christmas);
			holidays.Add(ChristianHolidays.StStephansDay);
		}

		public bool IsHoliDay(DateTime day) {
			var isHoliday = this.holidays.SingleOrDefault(h => h.IsInstanceOf(day));
			return isHoliday != null;
		}

		public IEnumerable<Holiday> Holidays {
			get {
				var currentYear = DateTime.Now.Year;
				return this.GetHolidaysOfYear(currentYear);
			}
		}

		public IEnumerable<Holiday> GetHolidaysOfYear(int year) {
			return holidays.Where(h => h.GetInstance(year).HasValue);
		}

		private static Holiday independanceDay;
		public static Holiday IndependanceDay {
			get {
				if (independanceDay == null) {
					independanceDay = new FixedHoliday("Independance Day", 12, 6);
				}
				return independanceDay;
			}
		}

		//All Saints' Day - Saturday between 31 October and 6 November
		// - Same as ChristianHolidays.AllSaints but has diferent ocurrence
		private static Holiday allSaintsDay;
		public static Holiday AllSaintsDay {
			get {
				if (allSaintsDay == null) {
					allSaintsDay = new NthDayOfWeekAfterDayHoliday("All Saint's Day", 1, DayOfWeek.Saturday, 11, 31);
				}
				return allSaintsDay;
			}
		}
	}
}
<commit_msg>fixed issue #10 - fi-FI Holidays enumeration is throwing a Argument Out Of Range Exception<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DateTimeExtensions.Strategies {
	public class FI_FIHolidayStrategy : IHolidayStrategy {
		private readonly IList<Holiday> holidays;

		public FI_FIHolidayStrategy() {
			this.holidays = new List<Holiday>();
			holidays.Add(ChristianHolidays.NewYear);
			holidays.Add(ChristianHolidays.Epiphany);
			holidays.Add(ChristianHolidays.GoodFriday);
			holidays.Add(ChristianHolidays.Easter);
			holidays.Add(ChristianHolidays.EasterMonday);
			holidays.Add(GlobalHolidays.MayDay);
			holidays.Add(ChristianHolidays.Ascension);
			holidays.Add(ChristianHolidays.Pentecost);
			holidays.Add(GlobalHolidays.MidsummerEve);
			holidays.Add(GlobalHolidays.MidsummerDay);
			holidays.Add(AllSaintsDay);
			holidays.Add(IndependanceDay);
			holidays.Add(ChristianHolidays.ChristmasEve);
			holidays.Add(ChristianHolidays.Christmas);
			holidays.Add(ChristianHolidays.StStephansDay);
		}

		public bool IsHoliDay(DateTime day) {
			var isHoliday = this.holidays.SingleOrDefault(h => h.IsInstanceOf(day));
			return isHoliday != null;
		}

		public IEnumerable<Holiday> Holidays {
			get {
				var currentYear = DateTime.Now.Year;
				return this.GetHolidaysOfYear(currentYear);
			}
		}

		public IEnumerable<Holiday> GetHolidaysOfYear(int year) {
			return holidays.Where(h => h.GetInstance(year).HasValue);
		}

		private static Holiday independanceDay;
		public static Holiday IndependanceDay {
			get {
				if (independanceDay == null) {
					independanceDay = new FixedHoliday("Independance Day", 12, 6);
				}
				return independanceDay;
			}
		}

		//All Saints' Day - Saturday between 31 October and 6 November
		// - Same as ChristianHolidays.AllSaints but has diferent ocurrence
		private static Holiday allSaintsDay;
		public static Holiday AllSaintsDay {
			get {
				if (allSaintsDay == null) {
					allSaintsDay = new NthDayOfWeekAfterDayHoliday("All Saint's Day", 1, DayOfWeek.Saturday, 10, 31);
				}
				return allSaintsDay;
			}
		}
	}
}

{'fraction_non_alphanumeric': 0.09812306961273462, 'fraction_numerical': 0.005702066999287242, 'mean_word_length': 4.474642392717815, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '5623890', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1398, 'n_words': 263}