public int CompareTo(CifCalendar other) { if (ReferenceEquals(null, other)) { return(-1); } var compare = RunsFrom.CompareTo(other.RunsFrom); if (compare != 0) { return(compare); } compare = RunsTo.CompareTo(other.RunsTo); if (compare != 0) { return(compare); } compare = DayMask.CompareTo(other.DayMask); if (compare != 0) { return(compare); } return(BankHolidays.CompareTo(other.BankHolidays)); }
public override bool Equals(object o) { AdminFlightDay other = o as AdminFlightDay; if (other == null) { return(false); } return(DayCode.Equals(other.DayCode) && DayMask.Equals(other.DayMask)); }
private bool IsActiveOnDay(DateTime day) { if (!DayMask.IsActiveOnDay(day)) { return(false); } switch (BankHolidays) { case BankHolidayRunning.RunsOnBankHoliday: return(true); case BankHolidayRunning.DoesNotRunOnEnglishBankHolidays: return(!Timetable.BankHolidays.IsEnglishBankHoliday(day)); case BankHolidayRunning.DoesNotRunOnScotishBankHolidays: return(!Timetable.BankHolidays.IsScotishBankHoliday(day)); default: throw new ArgumentOutOfRangeException($"Unhandled BankHolidayRunning enum value: {BankHolidays}"); } }
public override string ToString() { return(BankHolidays == BankHolidayRunning.RunsOnBankHoliday ? $"{RunsFrom.ToYMD()}=>{RunsTo.ToYMD()} {DayMask.ToStringEx()}" : $"{RunsFrom.ToYMD()}=>{RunsTo.ToYMD()} {DayMask.ToStringEx()} ({BankHolidays.ToStringEx()})"); }
public override int GetHashCode() { return(DayCode.GetHashCode() ^ DayMask.GetHashCode()); }