Ejemplo n.º 1
0
 private static bool IsSimilarKavuah(Kavuah a, Kavuah b)
 {
     return(a != b &&
            a.KavuahType == b.KavuahType &&
            a.DayNight == b.DayNight &&
            a.Number == b.Number);
 }
Ejemplo n.º 2
0
        private void SetOnahBeinenisProblemOnahs(Entry entry, IEnumerable <Entry> otherEntries)
        {
            Kavuah cancelKavuah =
                this.KavuahList.LastOrDefault(k => k.Active && k.CancelsOnahBeinanis);

            //Yom Hachodesh
            this.AddOnahBeinunisProblem(entry.AddMonths(1), "יום החודש", cancelKavuah);

            //Day Thirty
            Onah dayThirty = entry.AddDays(29);

            if (!otherEntries.Any(e => e > entry && e < dayThirty))
            {
                this.AddOnahBeinunisProblem(dayThirty, "יום שלושים", cancelKavuah);
            }

            //Day Thirty One
            Onah dayThirtyOne = entry.AddDays(30);

            if (!otherEntries.Any(e => e > entry && e < dayThirtyOne))
            {
                this.AddOnahBeinunisProblem(dayThirtyOne, "יום ל\"א", cancelKavuah);
            }

            //Haflagah
            if (entry.Interval > 1)
            {
                Onah onasHaflagah = entry.AddDays(entry.Interval - 1);
                if (!otherEntries.Any(e => e > entry && e < onasHaflagah))
                {
                    //Note the Haflaga is always just the Onah it occurred on - not 24 hours  -
                    //even according to those that require it for 30, 31 and Yom Hachodesh.
                    this.AddProblemOnah(onasHaflagah,
                                        "יום הפלגה (" + entry.Interval + ")", cancelKavuah);
                }

                //The Ta"z
                if (this.KeepLongerHaflaga)
                {
                    //Go through all earlier entries in the list that have a longer haflaga than this one  -
                    //and they are not kept anyways due to onah Beinonis
                    //and their haflaga was never surpassed by an Entry after them
                    foreach (Entry e in otherEntries.Where(en =>
                                                           en <entry &&
                                                               en.Interval> entry.Interval &&
                                                           en.Interval != 30 &&
                                                           en.Interval != 31 &&
                                                           !otherEntries.Any(oe => oe > en && oe.Interval > en.Interval)))
                    {
                        Onah nextOne = entry.AddDays(e.Interval - 1);
                        if (!otherEntries.Any(en => en > entry && en < nextOne))
                        {
                            this.AddProblemOnah(nextOne,
                                                "יום הפלגה (" + e.Interval + ") שלא נתבטלה", cancelKavuah);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void AddProblemOnah(Onah onah, string name, Kavuah cancelKavuah = null, bool noOhrZarua = false)
        {
            onah.Name      = name;
            onah.IsIgnored = cancelKavuah != null && cancelKavuah.SettingOnah < onah;
            this.ProblemOnahList.Add(onah);

            if (!noOhrZarua && this.ShowOhrZeruah)
            {
                this.AddProblemOnah(Onah.GetPreviousOnah(onah), "או\"ז של " + name,
                                    cancelKavuah,
                                    noOhrZarua: true);
            }
        }
Ejemplo n.º 4
0
        private void AddOnahBeinunisProblem(Onah probOnah, string name, Kavuah cancelKavuah)
        {
            //We don't flag the Ohr Zarua if it's included in Onah Beinonis of 24 hours as Onah Beinonis is stricter.
            this.AddProblemOnah(probOnah, name, cancelKavuah,
                                noOhrZarua: this.OnahBenIs24Hours && probOnah.DayNight == DayNight.Day);

            //If the user wants to keep 24 for the Onah Beinenis
            if (this.OnahBenIs24Hours)
            {
                Onah otherOnah = probOnah.Clone();
                otherOnah.DayNight = otherOnah.DayNight == DayNight.Day ? DayNight.Night : DayNight.Day;
                this.AddProblemOnah(otherOnah, name, cancelKavuah, noOhrZarua: true);
            }
        }
Ejemplo n.º 5
0
 public static bool IsSameKavuah(Kavuah a, Kavuah b)
 {
     return(a.Active == b.Active && IsSimilarKavuah(a, b));
 }
Ejemplo n.º 6
0
 private static bool InActiveKavuahList(Kavuah kavuah, List <Kavuah> kavuahList)
 {
     return(kavuahList.Exists(k => IsSimilarKavuah(k, kavuah) && k.Active));
 }
Ejemplo n.º 7
0
 private static bool HasSameSettingEntry(Kavuah a, Kavuah b)
 {
     return(a != b &&
            Onah.IsSameOnahPeriod(a.SettingOnah, b.SettingOnah));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Is this Kavuah a "stronger" Kavua type than the given one
 /// </summary>
 /// <param name="kavuah"></param>
 /// <returns></returns>
 private bool IsBetterKavuah(Kavuah kavuah)
 {
     return(KavuahTypeRatings[this.KavuahType] < KavuahTypeRatings[kavuah.KavuahType]);
 }