static CalendarSystem()
        {
            IsoCalendarSystem = new CalendarSystem(IsoName, IsoName, new IsoYearMonthDayCalculator(), 4);

            // Variations for the calendar systems which have different objects for different "minimum first day of week"
            // values. We create a new year/month/day calculator for each instance, but there's no actual state - it's
            // unimportant. Later we could save a whole 18 objects by avoiding that...
            GregorianCalendarSystems = new CalendarSystem[7];
            CopticCalendarSystems    = new CalendarSystem[7];
            JulianCalendarSystems    = new CalendarSystem[7];
            for (int i = 1; i <= 7; i++)
            {
                GregorianCalendarSystems[i - 1] = new CalendarSystem(GregorianName, new GregorianYearMonthDayCalculator(), i);
                CopticCalendarSystems[i - 1]    = new CalendarSystem(CopticName, new CopticYearMonthDayCalculator(), i);
                JulianCalendarSystems[i - 1]    = new CalendarSystem(JulianName, new JulianYearMonthDayCalculator(), i);
            }
            IslamicCalendarSystems = new CalendarSystem[4, 2];
            for (int i = 1; i <= 4; i++)
            {
                for (int j = 1; j <= 2; j++)
                {
                    var    leapYearPattern = (IslamicLeapYearPattern)i;
                    var    epoch           = (IslamicEpoch)j;
                    var    calculator      = new IslamicYearMonthDayCalculator((IslamicLeapYearPattern)i, (IslamicEpoch)j);
                    string id = string.Format(CultureInfo.InvariantCulture, "{0} {1}-{2}", IslamicName, epoch, leapYearPattern);
                    IslamicCalendarSystems[i - 1, j - 1] = new CalendarSystem(id, IslamicName, calculator, 4);
                }
            }
        }
Beispiel #2
0
 static IslamicCalendars()
 {
     ByLeapYearPatterAndEpoch = new CalendarSystem[4, 2];
     for (int i = 1; i <= 4; i++)
     {
         for (int j = 1; j <= 2; j++)
         {
             var             leapYearPattern = (IslamicLeapYearPattern)i;
             var             epoch           = (IslamicEpoch)j;
             var             calculator      = new IslamicYearMonthDayCalculator((IslamicLeapYearPattern)i, (IslamicEpoch)j);
             CalendarOrdinal ordinal         = CalendarOrdinal.IslamicAstronomicalBase15 + (i - 1) + (j - 1) * 4;
             ByLeapYearPatterAndEpoch[i - 1, j - 1] = new CalendarSystem(ordinal, GetIslamicId(leapYearPattern, epoch), IslamicName, calculator, Era.AnnoHegirae);
         }
     }
 }