Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System.Globalization')
-rw-r--r--mcs/class/corlib/System.Globalization/Calendar.cs917
-rw-r--r--mcs/class/corlib/System.Globalization/CalendarWeekRule.cs28
-rw-r--r--mcs/class/corlib/System.Globalization/CalendricalCalculations.cs2120
-rw-r--r--mcs/class/corlib/System.Globalization/ChangeLog109
-rw-r--r--mcs/class/corlib/System.Globalization/CompareInfo.cs23
-rwxr-xr-xmcs/class/corlib/System.Globalization/CompareOptions.cs54
-rw-r--r--mcs/class/corlib/System.Globalization/CultureInfo.cs850
-rwxr-xr-xmcs/class/corlib/System.Globalization/CultureTypes.cs39
-rw-r--r--mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs609
-rw-r--r--mcs/class/corlib/System.Globalization/DateTimeStyles.cs50
-rwxr-xr-xmcs/class/corlib/System.Globalization/DaylightTime.cs51
-rw-r--r--mcs/class/corlib/System.Globalization/GregorianCalendar.cs448
-rwxr-xr-xmcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs45
-rw-r--r--mcs/class/corlib/System.Globalization/HebrewCalendar.cs861
-rw-r--r--mcs/class/corlib/System.Globalization/HijriCalendar.cs870
-rw-r--r--mcs/class/corlib/System.Globalization/JapaneseCalendar.cs783
-rw-r--r--mcs/class/corlib/System.Globalization/JulianCalendar.cs443
-rw-r--r--mcs/class/corlib/System.Globalization/KoreanCalendar.cs444
-rwxr-xr-xmcs/class/corlib/System.Globalization/Locale.cs22
-rw-r--r--mcs/class/corlib/System.Globalization/NumberFormatInfo.cs676
-rw-r--r--mcs/class/corlib/System.Globalization/NumberStyles.cs46
-rw-r--r--mcs/class/corlib/System.Globalization/RegionInfo.cs1689
-rw-r--r--mcs/class/corlib/System.Globalization/TaiwanCalendar.cs745
-rw-r--r--mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs445
-rw-r--r--mcs/class/corlib/System.Globalization/UnicodeCategory.cs44
25 files changed, 0 insertions, 12411 deletions
diff --git a/mcs/class/corlib/System.Globalization/Calendar.cs b/mcs/class/corlib/System.Globalization/Calendar.cs
deleted file mode 100644
index 8b36614dd27..00000000000
--- a/mcs/class/corlib/System.Globalization/Calendar.cs
+++ /dev/null
@@ -1,917 +0,0 @@
-// Calendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-using System.IO;
-
-/// <remarks>
-/// The class serves as a base class for calendar classes.
-/// </remarks>
-[Serializable]
-public abstract class Calendar {
- /// <value>An protected integer property that gives the number of
- /// days in a week. It might be overridden.</value>
- internal virtual int M_DaysInWeek
- {
- get { return 7; }
- }
-
- /// <summary>
- /// The protected method creates the string used in the
- /// <see cref="T:System.ArgumentOutOfRangeException"/>
- /// </summary>
- /// <param name="a">An object that represents the smallest
- /// allowable value.</param>
- /// <param name="b">An object that represents the greatest allowable
- /// value.</param>
- /// <returns>The string used in the
- /// <see cref="T:System.ArgumentOutOfRangeException"/>
- /// </returns>
- internal string M_ValidValues(object a, object b)
- {
- StringWriter sw = new StringWriter();
- sw.Write("Valid values are between {0} and {1}, inclusive.",
- a, b);
- return sw.ToString();
- }
-
- /// <summary>
- /// The protected method checks wether the parameter
- /// <paramref name="arg"/> is in the allowed range.
- /// </summary>
- /// <param name="param">A string that gives the name of the
- /// parameter to check.</param>
- /// <param name="arg">An integer that gives the value to check.
- /// </param>
- /// <param name="a">An integer that represents the smallest allowed
- /// value.</param>
- /// <param name="b">An integer that represents the greatest allowed
- /// value.</param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the <paramref name="arg"/> is outside
- /// the allowed range.
- /// </exception>
- internal void M_ArgumentInRange(string param, int arg, int a, int b)
- {
- if (a <= arg && arg <= b)
- return;
- throw new ArgumentOutOfRangeException(param, M_ValidValues(a, b));
- }
-
- /// <summary>
- /// The protected method, that checks whether
- /// <paramref name="hour"/>, <paramref name="minute"/>,
- /// <paramref name="second"/>, and <parameref name="millisecond"/>
- /// are in their valid ranges
- /// </summary>
- /// <param name="hour">An integer that represents a hour,
- /// should be between 0 and 23.</param>
- /// <param name="minute">An integer that represents a minute,
- /// should be between 0 and 59.</param>
- /// <param name="second">An integer that represents a second,
- /// should be between 0 and 59.</param>
- /// <param name="milliseconds">An integer that represents a number
- /// of milliseconds, should be between 0 and 999999.</param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The Exception is thrown, if one of the parameter is outside the
- /// allowed the range.
- /// </exception>
- internal void M_CheckHMSM(int hour, int minute, int second,
- int milliseconds)
- {
- M_ArgumentInRange("hour", hour, 0, 23);
- M_ArgumentInRange("minute", minute, 0, 59);
- M_ArgumentInRange("second", second, 0, 59);
- M_ArgumentInRange("milliseconds", milliseconds, 0, 999999);
- }
-
- /// <value>
- /// A represantation of the CurrentEra.
- /// </value>
- public const int CurrentEra = 0;
-
- /// <value>When overridden gives the eras supported by the
- /// calendar as an array of integers.
- /// </value>
- public abstract int[] Eras { get; }
-
- /// <summary>
- /// The protected member stores the value for the
- /// <see cref="P:TwoDigitYearMax"/>
- /// property.
- /// </summary>
- internal int M_TwoDigitYearMax;
-
-
- /// <summary>
- /// Private field containing the maximum year for the calendar.
- /// </summary>
- private int M_MaxYearValue = 0;
-
- /// <value>
- /// Get-only property returing the maximum allowed year for this
- /// class.
- /// </value>
- internal virtual int M_MaxYear {
- get {
- if (M_MaxYearValue == 0) {
- M_MaxYearValue = GetYear(DateTime.MaxValue);
- }
- return M_MaxYearValue;
- }
- }
-
- /// <summary>
- /// Checks whether the year is the era is valid, if era = CurrentEra
- /// the right value is set.
- /// </summary>
- /// <param name="year">The year to check.</param>
- /// <param name="era">The era to check.</Param>
- /// <exception cref="T:ArgumentOutOfRangeException">
- /// The exception will be thrown, if the year is not valid.
- /// </exception>
- internal abstract void M_CheckYE(int year, ref int era);
-
- /// <value>
- /// <para>The property gives the maximum value for years with two
- /// digits. If the property has the value 2029, than the two-digit
- /// integer 29 results in the year 2029 and 30 in the
- /// year 1930.</para>
- /// <para>It might be overridden.</para>
- /// </value>
- public virtual int TwoDigitYearMax {
- get { return M_TwoDigitYearMax; }
- set {
- M_ArgumentInRange("year", value, 100, M_MaxYear);
- int era = CurrentEra;
- M_CheckYE(value, ref era);
- M_TwoDigitYearMax = value;
- }
- }
-
- /// <summary>
- /// The virtual method adds days to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// days.
- /// </param>
- /// <param name="days">The number of days to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="days"/> to the specified
- /// DateTime.</returns>
- public virtual DateTime AddDays(DateTime time, int days) {
- return time.Add(TimeSpan.FromDays(days));
- }
-
- /// <summary>
- /// The virtual method adds hours to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// hours.
- /// </param>
- /// <param name="hours">The number of hours to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="hours"/> to the specified
- /// DateTime.</returns>
- public virtual DateTime AddHours(DateTime time, int hours) {
- return time.Add(TimeSpan.FromHours(hours));
- }
-
- /// <summary>
- /// The virtual method adds milliseconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// milliseconds.
- /// </param>
- /// <param name="milliseconds">The number of milliseconds given as
- /// double to add. Keep in mind the 100 nanosecond resolution of
- /// <see cref="T:System.DateTime"/>.
- /// </param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="milliseconds"/> to the specified
- /// DateTime.</returns>
- public virtual DateTime AddMilliseconds(DateTime time,
- double milliseconds)
- {
- return time.Add(TimeSpan.FromMilliseconds(milliseconds));
- }
-
- /// <summary>
- /// The virtual method adds minutes to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// minutes.
- /// </param>
- /// <param name="minutes">The number of minutes to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="minutes"/> to the specified
- /// DateTime.</returns>
- public virtual DateTime AddMinutes(DateTime time, int minutes) {
- return time.Add(TimeSpan.FromMinutes(minutes));
- }
-
- /// <summary>
- /// When overrideden adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- public abstract DateTime AddMonths(DateTime time, int months);
-
- /// <summary>
- /// The virtual method adds seconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// seconds.
- /// </param>
- /// <param name="seconds">The number of seconds to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="seconds"/> to the specified
- /// DateTime.</returns>
- public virtual DateTime AddSeconds(DateTime time, int seconds) {
- return time.Add(TimeSpan.FromSeconds(seconds));
- }
-
- /// <summary>
- /// A wirtual method that adds weeks to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// weeks.
- /// </param>
- /// <param name="weeks">The number of weeks to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="weeks"/> to the specified
- /// DateTime.</returns>
- public virtual DateTime AddWeeks(DateTime time, int weeks) {
- return time.AddDays(weeks * M_DaysInWeek);
- }
-
- /// <summary>
- /// When overrideden adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- public abstract DateTime AddYears(DateTime time, int years);
-
- /// <summary>
- /// When overriden gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public abstract int GetDayOfMonth(DateTime time);
-
- /// <summary>
- /// When overriden gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public abstract DayOfWeek GetDayOfWeek(DateTime time);
-
- /// <summary>
- /// When overridden gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- public abstract int GetDayOfYear(DateTime time);
-
- /// <summary>
- /// A virtual method that gives the number of days of the specified
- /// month of the <paramref name="year"/> and the
- /// <see cref="P:CurrentEra"/>.
- /// </summary>
- /// <param name="year">An integer that gives the year in the current
- /// era.</param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/> or
- /// <paramref name="year"/> is outside the allowed range.
- /// </exception>
- public virtual int GetDaysInMonth(int year, int month) {
- return GetDaysInMonth(year, month, CurrentEra);
- }
-
- /// <summary>
- /// When overridden gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An intger that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public abstract int GetDaysInMonth(int year, int month, int era);
-
- /// <summary>
- /// A virtual method that gives the number of days of the specified
- /// year of the <see cref="P:CurrentEra"/>.
- /// </summary>
- /// <param name="year">An integer that gives the year in the current
- /// era.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if
- /// <paramref name="year"/> is outside the allowed range.
- /// </exception>
- public virtual int GetDaysInYear(int year) {
- return GetDaysInYear(year, CurrentEra);
- }
-
- /// <summary>
- /// When overridden gives the number of days of the specified
- /// year of the given era..
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> is outside the allowed range.
- /// </exception>
- public abstract int GetDaysInYear(int year, int era);
-
- /// <summary>
- /// When overridden gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- public abstract int GetEra(DateTime time);
-
- /// <summary>
- /// Virtual method that gives the hour of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the hour of the specified time,
- /// starting with 0.</returns>
- public virtual int GetHour(DateTime time) {
- return time.TimeOfDay.Hours;
- }
-
- /// <summary>
- /// Virtual method that gives the milliseconds in the current second
- /// of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the milliseconds in the seconds
- /// of the specified time, starting with 0.</returns>
- public virtual double GetMilliseconds(DateTime time) {
- return time.TimeOfDay.Milliseconds;
- }
-
- /// <summary>
- /// Virtual method that gives the minute of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the minute of the specified time,
- /// starting with 0.</returns>
- public virtual int GetMinute(DateTime time) {
- return time.TimeOfDay.Minutes;
- }
-
- /// <summary>
- /// When overridden gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- public abstract int GetMonth(DateTime time);
-
- /// <summary>
- /// Virtual method that gives the number of months of the specified
- /// year of the <see cref="M:CurrentEra"/>.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// current era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year is not allowed in the
- /// current era.
- /// </exception>
- public virtual int GetMonthsInYear(int year) {
- return GetMonthsInYear(year, CurrentEra);
- }
-
- /// <summary>
- /// When overridden gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public abstract int GetMonthsInYear(int year, int era);
-
- /// <summary>
- /// Virtual method that gives the second of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the second of the specified time,
- /// starting with 0.</returns>
- public virtual int GetSecond(DateTime time) {
- return time.TimeOfDay.Seconds;
- }
-
- /// <summary>
- /// A protected method to calculate the number of days between two
- /// dates.
- /// </summary>
- /// <param name="timeA">A <see cref="T:System.DateTime"/>
- /// representing the first date.
- /// </param>
- /// <param name="timeB">A <see cref="T:System.DateTime"/>
- /// representing the second date.
- /// </param>
- /// <returns>An integer that represents the difference of days
- /// between <paramref name="timeA"/> and <paramref name="timeB"/>.
- /// </returns>
- internal int M_DiffDays(DateTime timeA, DateTime timeB) {
- long diff = timeA.Ticks - timeB.Ticks;
-
- if (diff >= 0) {
- return (int)(diff/TimeSpan.TicksPerDay);
- }
-
- diff += 1;
- return -1 + (int)(diff/TimeSpan.TicksPerDay);
- }
-
- /// <summary>
- /// A protected method that gives the first day of the second week of
- /// the year.
- /// </summary>
- /// <param name="year">An integer that represents the year.</param>
- /// <param name="rule">The
- /// <see cref="T:System.Globalization.CalendarWeekRule"/>
- /// to be used for the calculation.
- /// </param>
- /// <param name="firstDayOfWeek">
- /// The <see cref="T:System.Globalization.DayOfWeek"/>
- /// specifying the first day in a week.
- /// </param>
- /// <returns>The <see cref="T:System.DateTime"/> representing
- /// the first day of the second week of the year.
- /// </returns>
- internal DateTime M_GetFirstDayOfSecondWeekOfYear(
- int year, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- DateTime d1 = ToDateTime(year, 1, 1, 0, 0, 0, 0);
- int dow1 = (int)GetDayOfWeek(d1);
- int fdow = (int)firstDayOfWeek;
- int d = 0;
-
- switch (rule) {
- case CalendarWeekRule.FirstDay:
- if (fdow > dow1) {
- d += fdow - dow1;
- }
- else {
- d += fdow + M_DaysInWeek - dow1;
- }
- break;
- case CalendarWeekRule.FirstFullWeek:
- d = M_DaysInWeek;
- if (fdow >= dow1) {
- d += fdow - dow1;
- }
- else {
- d += fdow + M_DaysInWeek - dow1;
- }
- break;
- case CalendarWeekRule.FirstFourDayWeek:
- int dow4 = (dow1 + 3)%M_DaysInWeek;
-
- d = 3;
- if (fdow > dow4) {
- d += fdow - dow4;
- }
- else {
- d += fdow + M_DaysInWeek - dow4;
- }
- break;
- }
-
- return AddDays(d1, d);
- }
-
- /// <summary>
- /// A virtual method that gives the number of the week in the year.
- /// </summary>
- /// <param name="time">A
- /// <see cref="T:System.DateTime"/> representing the date.
- /// </param>
- /// <param name="rule">The
- /// <see cref="T:System.Globalization.CalendarWeekRule"/>
- /// to be used for the calculation.
- /// </param>
- /// <param name="firstDayOfWeek">
- /// The <see cref="T:System.Globalization.DayOfWeek"/>
- /// specifying the first day in a week.
- /// </param>
- /// <returns>An integer representing the number of the week in the
- /// year, starting with 1.
- /// </returns>
- public virtual int GetWeekOfYear(DateTime time,
- CalendarWeekRule rule,
- DayOfWeek firstDayOfWeek)
- {
- if (firstDayOfWeek < DayOfWeek.Sunday ||
- DayOfWeek.Saturday < firstDayOfWeek)
- {
- throw new ArgumentOutOfRangeException("firstDayOfWeek",
- "Value is not a valid day of week.");
- }
- int year = GetYear(time);
-
- int days;
-
- while (true) {
- DateTime secondWeek = M_GetFirstDayOfSecondWeekOfYear(
- year, rule, firstDayOfWeek);
- days = M_DiffDays(time, secondWeek) + M_DaysInWeek;
- if (days >= 0)
- break;
- year -= 1;
- }
-
- return 1 + days/M_DaysInWeek;
- }
-
- /// <summary>
- /// When overridden gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- public abstract int GetYear(DateTime time);
-
- /// <summary>
- /// A virtual method that tells whether the given day in the
- /// <see cref="M:CurrentEra"/> is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// current era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month or day is not valid
- /// the current era.
- /// </exception>
- public virtual bool IsLeapDay(int year, int month, int day) {
- return IsLeapDay(year, month, day, CurrentEra);
- }
-
- /// <summary>
- /// Tells when overridden whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public abstract bool IsLeapDay(int year, int month, int day, int era);
-
- /// <summary>
- /// A virtual method that tells whether the given month of the
- /// specified year in the
- /// <see cref="M:CurrentEra"/> is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// current era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or month is not valid
- /// the current era.
- /// </exception>
- public virtual bool IsLeapMonth(int year, int month) {
- return IsLeapMonth(year, month, CurrentEra);
- }
-
- /// <summary>
- /// Tells when overridden whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public abstract bool IsLeapMonth(int year, int month, int era);
-
- /// <summary>
- /// A virtual method that tells whether the given year
- /// in the
- /// <see cref="M:CurrentEra"/> is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// current era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year is not valid
- /// the current era.
- /// </exception>
- public virtual bool IsLeapYear(int year) {
- return IsLeapYear(year, CurrentEra);
- }
-
- /// <summary>
- /// Tells when overridden whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public abstract bool IsLeapYear(int year, int era);
-
- /// <summary>
- /// A virtual method that creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <see cref="M:CurrentEra"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public virtual DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds)
- {
- return ToDateTime(year, month, day, hour, minute, second,
- milliseconds, CurrentEra);
- }
-
-
- /// <summary>
- /// When overridden creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public abstract DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era);
-
- /// <summary>
- /// A virtual method that converts a two-digit year to a four-digit
- /// year. It uses the <see cref="M:TwoDigitYearMax"/> property.
- /// </summary>
- /// <param name="year">An integer that gives the two-digit year.
- /// </param>
- /// <returns>An integer giving the four digit year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the year is negative or the resulting
- /// year is invalid.
- /// </exception>
- public virtual int ToFourDigitYear(int year) {
- if (year < 0)
- throw new ArgumentOutOfRangeException(
- "year", "Non-negative number required.");
- /* seems not to be the right thing to do, but .NET is
- * doing it this way.
- */
- if (year <= 99) {
- int year2 = TwoDigitYearMax%100;
- int d = year - year2;
- year = TwoDigitYearMax + d + (d <= 0 ? 0 : -100);
- }
- int era = CurrentEra;
- M_CheckYE(year, ref era);
- return year;
- }
-
- // TwoDigitYearMax: Windows reads it from the Registry, we
- // should have an XML file with the defaults
- /// <summary>
- /// The default constructor, is sets the TwoDigitYearMax to 2029.
- /// </summary>
- /// <remarks>
- /// The .NET framework reads the value from the registry.
- /// We should implement it here. Currently I set the default values
- /// in the ctors of the derived classes, if it is 99.
- /// </remarks>
- protected Calendar() {
- M_TwoDigitYearMax = 99;
- }
-
- /// <summary>Protected field storing the abbreviated era names.
- /// </summary>
- internal string[] M_AbbrEraNames;
- /// <summary>Protected field storing the era names.
- /// </summary>
- internal string[] M_EraNames;
-
- /// <value>
- /// The property stores the era names. It might be overwritten by
- /// CultureInfo.
- /// </value>
- internal string[] AbbreviatedEraNames {
- get {
- if (M_AbbrEraNames == null ||
- M_AbbrEraNames.Length != Eras.Length)
- throw new Exception(
- "Internal: M_AbbrEraNames " +
- "wrong initialized!");
- return (string[])M_AbbrEraNames.Clone();
- }
- set {
- if (value.Length != Eras.Length) {
- StringWriter sw = new StringWriter();
- sw.Write("Array length must be equal Eras " +
- "length {0}.", Eras.Length);
- throw new ArgumentException(
- sw.ToString());
- }
- M_AbbrEraNames = (string[])value.Clone();
- }
- }
-
- /// <value>
- /// The property stores the era names. It might be overwritten by
- /// CultureInfo.
- /// </value>
- internal string[] EraNames {
- get {
- if (M_EraNames == null ||
- M_EraNames.Length != Eras.Length)
- throw new Exception(
- "Internal: M_EraNames " +
- "not initialized!");
- return (string[])M_EraNames.Clone();
- }
- set {
- if (value.Length != Eras.Length) {
- StringWriter sw = new StringWriter();
- sw.Write("Array length must be equal Eras " +
- "length {0}.", Eras.Length);
- throw new ArgumentException(
- sw.ToString());
- }
- M_EraNames = (string[])value.Clone();
- }
- }
-} // class Calendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs b/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs
deleted file mode 100644
index 936a56e8469..00000000000
--- a/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// ::MONO
-//
-// System.Globalization.CalendarWeekRule.cs
-//
-// Copyright (C) Wictor Wilén 2001 (wictor@iBizkit.se)
-//
-// Contributors: Wictor Wilén
-//
-// Revisions
-// 2001-09-14: First draft
-// 2001-09-15: First release
-
-using System;
-
-namespace System.Globalization
-{
- /// <summary>
- /// The System.Globalization.CalendarWeekRule enumeration
- /// </summary>
- public enum CalendarWeekRule
- {
- FirstDay = 0,
- FirstFullWeek = 1,
- FirstFourDayWeek = 2
-
- }
-
-}
diff --git a/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs b/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs
deleted file mode 100644
index 3f493f2cc2e..00000000000
--- a/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs
+++ /dev/null
@@ -1,2120 +0,0 @@
-// CalendricalCalculations.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System.Collections;
-
-/// <summary>A class that provides mathematical functions.</summary>
-/// <remarks>
-/// <para>
-/// We are breaking the .Net
-/// naming conventions to be compatible to the "Calendrical Calculations"
-/// bool.
-/// </para>
-/// </remarks>
-internal class CCMath {
- /// <summary>
- /// A static method which rounds a double value.
- /// </summary>
- /// <param name="x">The double value to round.</param>
- /// <returns>The rounded double.</returns>
- public static double round(double x) {
- return System.Math.Floor(x+0.5);
- }
-
- /// <summary>
- /// A static method that computes the remainder of the division
- /// of two doubles.
- /// </summary>
- /// <param name="x">The double value which is divided.</param>
- /// <param name="y">The divisor.</param>
- /// <returns>The remainder as double value.</returns>
- public static double mod(double x, double y) {
- return x - y * System.Math.Floor(x/y);
- }
-
- /// <summary>
- /// The static method divides two integers.
- /// </summary>
- /// <param name="x">The integer x value.</param>
- /// <param name="y">The integer y value.</param>
- /// <returns>The qotient of x and y defined by floor(x/y).
- /// </returns>
- /// <remarks>
- /// Please notify that the function is not compatible to the standard
- /// integer divide operation /.
- /// </remarks>
- public static int div(int x, int y) {
- return (int)System.Math.Floor((double)x/(double)y);
- }
-
- /// <summary>
- /// The static method computes the remainder of two integers.
- /// </summary>
- /// <param name="x">The integer value which will be divided.</param>
- /// <param name="y">The divisor integer value.</param>
- /// <returns> The remainder as integer value.</returns>
- /// <remarks>
- /// Please notify that the method is not compatible to the C#
- /// remainder operation %.
- /// </remarks>
- public static int mod(int x, int y) {
- return x - y * div(x, y);
- }
-
- /// <summary>
- /// A static method that combines integer division and remainder
- /// computation.
- /// </summary>
- /// <param name="remainder">Remainder integer output value.
- /// </param>
- /// <param name="x">Integer to be divided.</param>
- /// <param name="y">Divisor integer value.</param>
- /// <returns>The quotient as integer.</returns>
- /// <seealso cref="M:div"/>
- /// <seealso cref="M:mod"/>
- public static int div_mod(out int remainder, int x, int y) {
- int d = div(x, y);
- remainder = x - y * d;
- return d;
- }
-
- /// <summary>
- /// A static method returning the sign of the argument.
- /// </summary>
- /// <param name="x">The double argument.</param>
- /// <returns>An integer value: -1 for a negative argument;
- /// 0 for a zero argument, and 1 for a positive argument.
- /// </returns>
- public static int signum(double x) {
- if (x < 0.0)
- return -1;
- if (x == 0.0)
- return 0;
- return 1;
- }
-
- /// <summary>
- /// A static method returning the sign of the integer
- /// argument.
- /// </summary>
- /// <param name="x">The integer argument.</param>
- /// <returns>An integer value: -1 for a negative argument;
- /// 0 for a zero argument, and 1 for a positive argument.
- /// </returns>
- public static int signum(int x) {
- if (x < 0)
- return -1;
- if (x == 0)
- return 0;
- return 1;
- }
-
- /// <summary>
- /// An adjusted remainder function as defined in "Calendrical
- /// Calculations".
- /// </summary>
- /// <param name="x">The double x argument.</param>
- /// <param name="y">The double y argument, the divisor.</param>
- /// <returns>A double value representing remainder; but instead 0.0
- /// the divisor y is returned.
- /// </returns>
- public static double amod(double x, double y) {
- double d = mod(x, y);
- return (d == 0.0) ? y : d;
- }
-
- /// <summary>
- /// The adjusted remainder functions for integers as defined in
- /// "Calendrical Calculations".
- /// </summary>
- /// <param name="x">The integer argument to be divided.</param>
- /// <param name="y">The integer divisor argument.</param>
- /// <returns>The remainder as an integer; however instead 0
- /// is the divisor y returned.
- /// </returns>
- public static int amod(int x, int y) {
- int i = mod(x, y);
- return (i == 0) ? y : i;
- }
-}
-
-/// <summary>The class implements methods to handle the fixed date value from
-/// the "Calendrical Calculations" books.
-/// </summary>
-/// <remarks>
-/// <para>
-/// For implementing the Calendar classes I used the algorithms from the
-/// book "Calendrical Calculations" by Nachum Dershowitz and Edward M.
-/// Rheingold, second reprint 1998. Trying to prevent the introduction of new
-/// bugs, I implemented their algorithms in the
-/// <see cref="N:CalendricalCalculations"/>
-/// namespace and wrapped it in the calendar classes.
-/// </para>
-/// <para>
-/// The fixed day number is also known as R.D. - rata die.
-/// Midnight at the onset of Monday,
-/// January 1, year 1 (Gregorian) is R.D. 1.
-/// </para>
-/// <para>Here are all my references:</para>
-/// <list type="table">
-/// <item><description>
-/// [1] Nachum Dershowitz and Edward M. Rheingold: "Calendrical Calculations";
-/// Cambridge University Press; second reprint 1998.
-/// </description></item>
-/// <item><description>
-/// [2] P. Kenneth Seidelmann (ed.): "Explanatory Supplement to the Astronomical
-/// Almanac"; University Science Books, Sausalito; 1992
-/// </description></item>
-/// <item><description>
-/// [3] F. Richard Stephenson: "Historical Eclipses and Earth Rotation";
-/// Cambridge University Press; 1997
-/// </description></item>
-/// </list>
-/// </remarks>
-internal class CCFixed {
- /// <summary>The method computes the
- /// <see cref="T:System.DateTime"/>
- /// from a fixed day number.
- /// </summary>
- /// <param name="date">A integer representing the fixed day number.
- /// </param>
- /// <returns>The <see cref="T:System.DateTime"/> representing
- /// the date.
- /// </returns>
- public static System.DateTime ToDateTime(int date) {
- long ticks = (date - 1) * System.TimeSpan.TicksPerDay;
- return new System.DateTime(ticks);
- }
-
- /// <summary>The method computes the
- /// <see cref="T:System.DateTime"/>
- /// from a fixed day number and time arguments.
- /// </summary>
- /// <param name="date">An integer representing the fixed day number.
- /// </param>
- /// <param name="hour">An integer argument specifying the hour.
- /// </param>
- /// <param name="minute">An integer argument specifying the minute.
- /// </param>
- /// <param name="second">An integer argument giving the second.
- /// </param>
- /// <param name="milliseconds">An double argument specifying
- /// the milliseconds. Notice that
- /// <see cref="T:System.DateTime"/> has 100 nanosecond resolution.
- /// </param>
- /// <returns>The <see cref="T:System.DateTime"/> representing
- /// the date.
- /// </returns>
- public static System.DateTime ToDateTime(int date,
- int hour, int minute, int second, double milliseconds)
- {
- System.DateTime time = ToDateTime(date);
- time = time.AddHours(hour);
- time = time.AddMinutes(minute);
- time = time.AddSeconds(second);
- return time.AddMilliseconds(milliseconds);
- }
-
- /// <summary>
- /// A static method computing the fixed day number from a
- /// <see cref="T:System.DateTime"/> value.
- /// </summary>
- /// <param name="time">A
- /// <see cref="T:System.DateTime"/> value representing the date.
- /// </param>
- /// <returns>The fixed day number as integer representing the date.
- /// </returns>
- public static int FromDateTime(System.DateTime time) {
- return 1 + (int)(time.Ticks / System.TimeSpan.TicksPerDay);
- }
-
- /// <summary>
- /// The static method computes the <see cref="T:DayOfWeek"/>.
- /// </summary>
- /// <param name="date">An integer representing the fixed day number.
- /// </param>
- /// <returns>The day of week.</returns>
- public static DayOfWeek day_of_week(int date) {
- return (DayOfWeek)CCMath.mod(date, 7);
- }
-
- /// <summary>
- /// The static method computes the date of a day of week on or before
- /// a particular date.
- /// </summary>
- /// <param name="date">An integer representing the date as
- /// fixed day number.
- /// </param>
- /// <param name="k">An integer representing the day of the week,
- /// starting with 0 for sunday.
- /// </param>
- /// <returns>The fixed day number of the day of week specified by k
- /// on or before the given date.
- /// </returns>
- public static int kday_on_or_before(int date, int k) {
- return date - (int)day_of_week(date-k);
- }
-
- /// <summary>
- /// The static method computes the date of a day of week on or after
- /// a particular date.
- /// </summary>
- /// <param name="date">An integer representing the date as
- /// fixed day number.
- /// </param>
- /// <param name="k">An integer representing the day of the week,
- /// starting with 0 for sunday.
- /// </param>
- /// <returns>The fixed day number of the day of week specified by k
- /// on or after the given date.
- /// </returns>
- public static int kday_on_or_after(int date, int k) {
- return kday_on_or_before(date+6, k);
- }
-
- /// <summary>
- /// The static method computes the date of a day of week that is
- /// nearest to a particular date.
- /// </summary>
- /// <param name="date">An integer representing the date as
- /// fixed day number.
- /// </param>
- /// <param name="k">An integer representing the day of the week,
- /// starting with 0 for sunday.
- /// </param>
- /// <returns>The fixed day number of the day of week neares to the
- /// given date.
- /// </returns>
- public static int kd_nearest(int date, int k) {
- return kday_on_or_before(date+3, k);
- }
-
- /// <summary>
- /// The static method computes the date of a day of week after
- /// a particular date.
- /// </summary>
- /// <param name="date">An integer representing the date as
- /// fixed day number.
- /// </param>
- /// <param name="k">An integer representing the day of the week,
- /// starting with 0 for sunday.
- /// </param>
- /// <returns>The fixed day number of the day of week specified by k
- /// after the given date.
- /// </returns>
- public static int kday_after(int date, int k) {
- return kday_on_or_before(date+7, k);
- }
-
- /// <summary>
- /// The static method computes the date of a day of week before
- /// a particular date.
- /// </summary>
- /// <param name="date">An integer representing the date as
- /// fixed day number.
- /// </param>
- /// <param name="k">An integer representing the day of the week,
- /// starting with 0 for sunday.
- /// </param>
- /// <returns>The fixed day number of the day of week specified by k
- /// before the given date.
- /// </returns>
- public static int kday_before(int date, int k) {
- return kday_on_or_before(date-1, k);
- }
-} // class CCFixed
-
-/// <summary>
-/// A class encapsulating the functions of the Gregorian calendar as static
-/// methods.
-/// </summary>
-/// <remarks>
-/// <para>
-/// This class is not compatible to
-/// <see cref="T:System.Globalization.GregorianCalendar"/>.
-/// </para>
-/// <para>
-/// The fixed day number is also known as R.D. - rata die.
-/// Midnight at the onset of Monday,
-/// January 1, year 1 (Gregorian) is R.D. 1.
-/// </para>
-/// <seealso cref="T:CCFixed"/>
-/// </remarks>
-internal class CCGregorianCalendar {
- /// <summary>An integer defining the epoch of the Gregorian calendar
- /// as fixed day number.</summary>
- /// <remarks>The epoch is January 3, 1 C.E. (Julian).</remarks>
- const int epoch = 1;
-
- /// <summary>The enumeration defines the months of the Gregorian
- /// calendar.
- /// </summary>
- public enum Month {
- /// <summary>
- /// January.
- /// </summary>
- january = 1,
- /// <summary>
- /// February.
- /// </summary>
- february,
- /// <summary>
- /// March.
- /// </summary>
- march,
- /// <summary>
- /// April.
- /// </summary>
- april,
- /// <summary>
- /// May.
- /// </summary>
- may,
- /// <summary>
- /// June.
- /// </summary>
- june,
- /// <summary>
- /// July.
- /// </summary>
- july,
- /// <summary>
- /// August.
- /// </summary>
- august,
- /// <summary>
- /// September.
- /// </summary>
- september,
- /// <summary>
- /// October.
- /// </summary>
- october,
- /// <summary>
- /// November.
- /// </summary>
- november,
- /// <summary>
- /// December.
- /// </summary>
- december
- };
-
-
- /// <summary>
- /// The method tells whether the year is a leap year.
- /// </summary>
- /// <param name="year">An integer representing the Gregorian year.
- /// </param>
- /// <returns>A boolean which is true if <paramref name="year"/> is
- /// a leap year.
- /// </returns>
- public static bool is_leap_year(int year) {
- if (CCMath.mod(year, 4) != 0)
- return false;
- switch (CCMath.mod(year, 400)) {
- case 100:
- return false;
- case 200:
- return false;
- case 300:
- return false;
- }
- return true;
- }
-
- /// <summary>
- /// The method returns the fixed day number of the given Gregorian
- /// date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Gregorian year.
- /// </param>
- /// <param name="year">An integer representing the Gregorian year.
- /// Non-positive values are allowed also.
- /// </param>
- /// <returns>An integer value representing the fixed day number.
- /// </returns>
- public static int fixed_from_dmy(int day, int month, int year) {
- int k = epoch - 1;
- k += 365 * (year-1);
- k += CCMath.div(year-1, 4);
- k -= CCMath.div(year-1, 100);
- k += CCMath.div(year-1, 400);
- k += CCMath.div(367*month-362, 12);
- if (month > 2) {
- k += is_leap_year(year) ? -1 : -2;
- }
-
- k += day;
-
- return k;
- }
-
- /// <summary>
- /// The method computes the Gregorian year from a fixed day number.
- /// </summary>
- /// <param name="date">The fixed day number.
- /// </param>
- /// <returns>An integer value giving the Gregorian year of the date.
- /// </returns>
- public static int year_from_fixed(int date) {
- int d = date - epoch;
- int n_400 = CCMath.div_mod(out d, d, 146097);
- int n_100 = CCMath.div_mod(out d, d, 36524);
- int n_4 = CCMath.div_mod(out d, d, 1461);
- int n_1 = CCMath.div(d, 365);
-
- int year = 400*n_400 + 100*n_100 + 4*n_4 + n_1;
- return (n_100 == 4 || n_1 == 4) ? year : year + 1;
- }
-
- /// <summary>
- /// The method computes the Gregorian year and month from a fixed day
- /// number.
- /// </summary>
- /// <param name="month">The output value giving the Gregorian month.
- /// </param>
- /// <param name="year">The output value giving the Gregorian year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void my_from_fixed(out int month, out int year,
- int date)
- {
- year = year_from_fixed(date);
-
- int prior_days = date - fixed_from_dmy(1, (int)Month.january,
- year);
-
- int correction;
- if (date < fixed_from_dmy(1, (int)Month.march, year)) {
- correction = 0;
- } else if (is_leap_year(year)) {
- correction = 1;
- } else {
- correction = 2;
- }
-
- month = CCMath.div(12 * (prior_days + correction) + 373, 367);
-
- }
-
- /// <summary>
- /// The method computes the Gregorian year, month, and day from a
- /// fixed day number.
- /// </summary>
- /// <param name="day">The output value returning the day of the
- /// month.
- /// </param>
- /// <param name="month">The output value giving the Gregorian month.
- /// </param>
- /// <param name="year">The output value giving the Gregorian year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void dmy_from_fixed(out int day, out int month,
- out int year,
- int date)
- {
- my_from_fixed(out month, out year, date);
- day = date - fixed_from_dmy(1, month, year) + 1;
- }
-
- /// <summary>A method computing the Gregorian month from a fixed
- /// day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the Gregorian month.
- /// </returns>
- public static int month_from_fixed(int date) {
- int month, year;
-
- my_from_fixed(out month, out year, date);
- return month;
- }
-
- /// <summary>
- /// A method computing the day of the month from a fixed day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the day of the month.
- /// </returns>
- public static int day_from_fixed(int date) {
- int day, month, year;
-
- dmy_from_fixed(out day, out month, out year, date);
- return day;
- }
-
- /// <summary>
- /// The method computes the difference between two Gregorian dates.
- /// </summary>
- /// <param name="dayA">The integer parameter gives the day of month
- /// of the first date.
- /// </param>
- /// <param name="monthA">The integer parameter gives the Gregorian
- /// month of the first date.
- /// </param>
- /// <param name="yearA">The integer parameter gives the Gregorian
- /// year of the first date.
- /// </param>
- /// <param name="dayB">The integer parameter gives the day of month
- /// of the second date.
- /// </param>
- /// <param name="monthB">The integer parameter gives the Gregorian
- /// month of the second date.
- /// </param>
- /// <param name="yearB">The integer parameter gives the Gregorian
- /// year of the second date.
- /// </param>
- /// <returns>An integer giving the difference of days from the first
- /// the second date.
- /// </returns>
- public static int date_difference(int dayA, int monthA, int yearA,
- int dayB, int monthB, int yearB)
- {
- return fixed_from_dmy(dayB, monthB, yearB) -
- fixed_from_dmy(dayA, monthA, yearA);
- }
-
- /// <summary>
- /// The method computes the number of the day in the year from
- /// a Gregorian date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Gregorian year.
- /// </param>
- /// <param name="year">An integer representing the Gregorian year.
- /// Non-positive values are allowed also.
- /// </param>
- /// <returns>An integer value giving the number of the day in the
- /// Gregorian year, counting from 1.
- /// </returns>
- public static int day_number(int day, int month, int year) {
- return date_difference(31, (int)Month.december, year-1,
- day, month, year);
- }
-
- /// <summary>
- /// The method computes the days remaining in the given Gregorian
- /// year from a Gregorian date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Gregorian year.
- /// </param>
- /// <param name="year">An integer representing the Gregorian year.
- /// Non-positive values are allowed also.
- /// </param>
- /// <returns>An integer value giving the number of days remaining in
- /// the Gregorian year.
- /// </returns>
- public static int days_remaining(int day, int month, int year) {
- return date_difference(day, month, year,
- 31, (int)Month.december, year);
- }
-
- // Helper functions for the Gregorian calendars.
-
- /// <summary>
- /// Adds months to the given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- public static System.DateTime AddMonths(System.DateTime time,
- int months)
- {
- int rd = CCFixed.FromDateTime(time);
- int day, month, year;
- dmy_from_fixed(out day, out month, out year, rd);
- month += months;
- rd = fixed_from_dmy(day, month, year);
- System.DateTime t = CCFixed.ToDateTime(rd);
- return t.Add(time.TimeOfDay);
- }
-
- /// <summary>
- /// Adds years to the given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- public static System.DateTime AddYears(System.DateTime time,
- int years)
- {
- int rd = CCFixed.FromDateTime(time);
- int day, month, year;
- dmy_from_fixed(out day, out month, out year, rd);
- year += years;
- rd = fixed_from_dmy(day, month, year);
- System.DateTime t = CCFixed.ToDateTime(rd);
- return t.Add(time.TimeOfDay);
- }
-
- /// <summary>
- /// Gets the of the month from <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public static int GetDayOfMonth(System.DateTime time) {
- return day_from_fixed(CCFixed.FromDateTime(time));
- }
-
- /// <summary>
- /// The method gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- public static int GetDayOfYear(System.DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- int year = year_from_fixed(rd);
- int rd1_1 = fixed_from_dmy(1, 1, year);
- return rd - rd1_1 + 1;
- }
-
- /// <summary>
- /// A method that gives the number of days of the specified
- /// month of the <paramref name="year"/>.
- /// </summary>
- /// <param name="year">An integer that gives the year in the current
- /// era.</param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- public static int GetDaysInMonth(int year, int month) {
- int rd1 = fixed_from_dmy(1, month, year);
- int rd2 = fixed_from_dmy(1, month+1, year);
- return rd2 - rd1;
- }
-
- /// <summary>
- /// The method gives the number of days in the specified year.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- public static int GetDaysInYear(int year) {
- int rd1 = fixed_from_dmy(1, 1, year);
- int rd2 = fixed_from_dmy(1, 1, year+1);
- return rd2 - rd1;
- }
-
- /// <summary>
- /// The method gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- public static int GetMonth(System.DateTime time) {
- return month_from_fixed(CCFixed.FromDateTime(time));
- }
-
- /// <summary>
- /// The method gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year.
- /// </returns>
- public static int GetYear(System.DateTime time) {
- return year_from_fixed(CCFixed.FromDateTime(time));
- }
-
- /// <summary>
- /// A virtual method that tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- public static bool IsLeapDay(int year, int month, int day) {
- return is_leap_year(year) && month == 2 && day == 29;
- }
-
- /// <summary>
- /// A method that creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- public static System.DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds)
- {
- return CCFixed.ToDateTime(fixed_from_dmy(day, month, year),
- hour, minute, second, milliseconds);
- }
-} // class CCGregorianCalendar
-
-/// <summary>
-/// A class encapsulating the functions of the Julian calendar as static
-/// methods.
-/// </summary>
-/// <remarks>
-/// <para>The algorithms don't support a year 0. Years before Common Era
-/// (B.C.E. or B.C.) are negative and years of Common Era (C.E. or A.D.)
-/// are positive.
-/// </para>
-/// <para>
-/// This class is not compatible to
-/// <see cref="T:System.Globalization.JulianCalendar"/>.
-/// </para>
-/// <seealso cref="T:CCFixed"/>
-/// </remarks>
-internal class CCJulianCalendar {
- /// <summary>An integer defining the epoch of the Julian calendar
- /// as fixed day number.</summary>
- /// <remarks>The epoch is December 30, 0 (Gregorian).</remarks>
- const int epoch = -1; // 30. 12. 0 Gregorian
-
- /// <summary>The enumeration defines the months of the Julian
- /// calendar.
- /// </summary>
- public enum Month {
- /// <summary>
- /// January.
- /// </summary>
- january = 1,
- /// <summary>
- /// February.
- /// </summary>
- february,
- /// <summary>
- /// March.
- /// </summary>
- march,
- /// <summary>
- /// April.
- /// </summary>
- april,
- /// <summary>
- /// May.
- /// </summary>
- may,
- /// <summary>
- /// June.
- /// </summary>
- june,
- /// <summary>
- /// July.
- /// </summary>
- july,
- /// <summary>
- /// August.
- /// </summary>
- august,
- /// <summary>
- /// September.
- /// </summary>
- september,
- /// <summary>
- /// October.
- /// </summary>
- october,
- /// <summary>
- /// November.
- /// </summary>
- november,
- /// <summary>
- /// December.
- /// </summary>
- december
- };
-
- /// <summary>
- /// The method tells whether the year is a leap year.
- /// </summary>
- /// <param name="year">An integer representing the Julian year.
- /// </param>
- /// <returns>A boolean which is true if <paramref name="year"/> is
- /// a leap year.
- /// </returns>
- public static bool is_leap_year(int year) {
- return CCMath.mod(year, 4) == (year > 0 ? 0 : 3);
- }
-
- /// <summary>
- /// The method returns the fixed day number of the given Julian
- /// date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Julian year.
- /// </param>
- /// <param name="year">An integer representing the Julian year.
- /// Positive and Negative values are allowed.
- /// </param>
- /// <returns>An integer value representing the fixed day number.
- /// </returns>
- public static int fixed_from_dmy(int day, int month, int year) {
- int y = year < 0 ? year+1 : year;
- int k = epoch - 1;
- k += 365 * (y-1);
- k += CCMath.div(y-1, 4);
- k += CCMath.div(367*month-362, 12);
- if (month > 2) {
- k += is_leap_year(year) ? -1 : -2;
- }
- k += day;
-
- return k;
- }
-
- /// <summary>
- /// The method computes the Julian year from a fixed day number.
- /// </summary>
- /// <param name="date">The fixed day number.
- /// </param>
- /// <returns>An integer value giving the Julian year of the date.
- /// </returns>
- public static int year_from_fixed(int date) {
- int approx = CCMath.div(4*(date-epoch)+1464, 1461);
- return approx <= 0 ? approx - 1 : approx;
- }
-
- /// <summary>
- /// The method computes the Julian year and month from a fixed day
- /// number.
- /// </summary>
- /// <param name="month">The output value giving the Julian month.
- /// </param>
- /// <param name="year">The output value giving the Julian year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void my_from_fixed(out int month, out int year, int date)
- {
- year = year_from_fixed(date);
-
- int prior_days = date - fixed_from_dmy(1, (int)Month.january,
- year);
-
- int correction;
- if (date < fixed_from_dmy(1, (int)Month.march, year)) {
- correction = 0;
- } else if (is_leap_year(year)) {
- correction = 1;
- } else {
- correction = 2;
- }
-
- month = CCMath.div(12 * (prior_days + correction) + 373, 367);
- }
-
-
- /// <summary>
- /// The method computes the Julian year, month, and day from a
- /// fixed day number.
- /// </summary>
- /// <param name="day">The output value returning the day of the
- /// month.
- /// </param>
- /// <param name="month">The output value giving the Julian month.
- /// </param>
- /// <param name="year">The output value giving the Julian year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void dmy_from_fixed(out int day, out int month,
- out int year, int date)
- {
- my_from_fixed(out month, out year, date);
- day = date - fixed_from_dmy(1, month, year) + 1;
- }
-
- /// <summary>A method computing the Julian month from a fixed
- /// day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the Julian month.
- /// </returns>
- public static int month_from_fixed(int date) {
- int month, year;
-
- my_from_fixed(out month, out year, date);
- return month;
- }
-
- /// <summary>
- /// A method computing the day of the month from a fixed day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the day of the month.
- /// </returns>
- public static int day_from_fixed(int date) {
- int day;
- int month;
- int year;
-
- dmy_from_fixed(out day, out month, out year, date);
- return day;
- }
-
- /// <summary>
- /// The method computes the difference between two Julian dates.
- /// </summary>
- /// <param name="dayA">The integer parameter gives the day of month
- /// of the first date.
- /// </param>
- /// <param name="monthA">The integer parameter gives the Julian
- /// month of the first date.
- /// </param>
- /// <param name="yearA">The integer parameter gives the Julian
- /// year of the first date.
- /// </param>
- /// <param name="dayB">The integer parameter gives the day of month
- /// of the second date.
- /// </param>
- /// <param name="monthB">The integer parameter gives the Julian
- /// month of the second date.
- /// </param>
- /// <param name="yearB">The integer parameter gives the Julian
- /// year of the second date.
- /// </param>
- /// <returns>An integer giving the difference of days from the first
- /// the second date.
- /// </returns>
- public static int date_difference(int dayA, int monthA, int yearA,
- int dayB, int monthB, int yearB)
- {
- return fixed_from_dmy(dayB, monthB, yearB) -
- fixed_from_dmy(dayA, monthA, yearA);
- }
-
- /// <summary>
- /// The method computes the number of the day in the year from
- /// a Julian date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Julian year.
- /// </param>
- /// <param name="year">An integer representing the Julian year.
- /// Negative values are allowed also.
- /// </param>
- /// <returns>An integer value giving the number of the day in the
- /// Julian year, counting from 1.
- /// </returns>
- public static int day_number(int day, int month, int year) {
- return date_difference(31, (int)Month.december, year-1,
- day, month, year);
- }
-
- /// <summary>
- /// The method computes the days remaining in the given Julian
- /// year from a Julian date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Julian year.
- /// </param>
- /// <param name="year">An integer representing the Julian year.
- /// Negative values are allowed also.
- /// </param>
- /// <returns>An integer value giving the number of days remaining in
- /// the Julian year.
- /// </returns>
- public static int days_remaining(int day, int month, int year) {
- return date_difference(day, month, year,
- 31, (int)Month.december, year);
- }
-} // class CCJulianCalendar
-
-/// <summary>
-/// A class encapsulating the functions of the Hebrew calendar as static
-/// methods.
-/// </summary>
-/// <remarks>
-/// <para>
-/// This class is not compatible to
-/// <see cref="T:System.Globalization.HebrewCalendar"/>.
-/// </para>
-/// <seealso cref="T:CCFixed"/>
-/// </remarks>
-internal class CCHebrewCalendar {
- /// <summary>An integer defining the epoch of the Hebrew calendar
- /// as fixed day number.</summary>
- /// <remarks>The epoch is October 10, 3761 B.C.E. (Julian).</remarks>
- const int epoch = -1373427;
-
- /// <summary>The enumeration defines the months of the Gregorian
- /// calendar.
- /// </summary>
- /// <remarks>
- /// The enumaration differs from .NET which defines Tishri as month 1.
- /// </remarks>
- public enum Month {
- /// <summary>
- /// Nisan.
- /// </summary>
- nisan = 1,
- /// <summary>
- /// Iyyar.
- /// </summary>
- iyyar,
- /// <summary>
- /// Sivan.
- /// </summary>
- sivan,
- /// <summary>
- /// Tammuz.
- /// </summary>
- tammuz,
- /// <summary>
- /// Av.
- /// </summary>
- av,
- /// <summary>
- /// Elul.
- /// </summary>
- elul,
- /// <summary>
- /// Tishri.
- /// </summary>
- tishri,
- /// <summary>
- /// Heshvan.
- /// </summary>
- heshvan,
- /// <summary>
- /// Kislev.
- /// </summary>
- kislev,
- /// <summary>
- /// Teveth.
- /// </summary>
- teveth,
- /// <summary>
- /// Shevat.
- /// </summary>
- shevat,
- /// <summary>
- /// Adar.
- /// </summary>
- adar,
- /// <summary>
- /// Adar I. Only in years with Adar II.
- /// </summary>
- adar_I = 12,
- /// <summary>
- /// Adar II. Only in years wirh Adar I.
- /// </summary>
- adar_II = 13,
- };
-
- /// <summary>
- /// The method tells whether the year is a leap year.
- /// </summary>
- /// <param name="year">An integer representing the Hebrew year.
- /// </param>
- /// <returns>A boolean which is true if <paramref name="year"/> is
- /// a leap year.
- /// </returns>
- public static bool is_leap_year(int year) {
- return CCMath.mod(7*year+1, 19) < 7;
- }
-
- /// <summary>
- /// The Method gives the number of the last month in a year, which
- /// is equal with the number of month in a Hebrew year.
- /// </summary>
- /// <param name="year">An integer representing the Hebrew year.
- /// </param>
- /// <returns>An integer giving the number of the last month of the
- /// Hebrew year, which is the same as the numbers of month in the
- /// year.
- /// </returns>
- public static int last_month_of_year(int year) {
- return is_leap_year(year) ? 13 : 12;
- }
-
-
- /// <summary>The method is a helper function.</summary>
- /// <param name="year">An integer specifying the Hebrew year.
- /// </param>
- /// <returns>An integer representing the number of elapsed days
- /// until the Hebrew year.</returns>
- public static int elapsed_days(int year) {
- int months_elapsed = CCMath.div(235*year-234, 19);
- int r;
- int d = CCMath.div_mod(out r, months_elapsed, 1080);
- int parts_elapsed = 204 + 793 * r;
- int hours_elapsed = 11 + 12 * months_elapsed +
- 793 * d + CCMath.div(parts_elapsed, 1080);
-
- int day = 29*months_elapsed + CCMath.div(hours_elapsed, 24);
-
- if (CCMath.mod(3*(day+1), 7) < 3) {
- day += 1;
- }
-
- return day;
- }
-
- /// <summary>A method computing the delay of new year for the given
- /// Hebrew year.
- /// </summary>
- /// <param name="year">An integer that gives the Hebrew year.
- /// </param>
- /// <returns>The new year delay in days of the given Hebrew year.
- /// </returns>
- public static int new_year_delay(int year) {
- int ny1 = elapsed_days(year);
- int ny2 = elapsed_days(year+1);
-
- if (ny2 - ny1 == 356) {
- return 2;
- }
- int ny0 = elapsed_days(year-1);
- if (ny1 - ny0 == 382) {
- return 1;
- }
- return 0;
- }
-
- /// <summary>
- /// The method computes the last day of month (nummer of days in a
- /// month) of the given Hebrew year.
- /// </summary>
- /// <param name="month">The Hebrew month, allowed value between
- /// One and Thirteen.
- /// </param>
- /// <param name="year">An integer that gives the Hebrew year.
- /// </param>
- /// <returns>The number of the last day of the month of the given
- /// Hebrew year, which gives automatically the number of days in the
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRange.Exception">
- /// The exception is thrown if month not between One and Thirteen.
- /// </exception>
- public static int last_day_of_month(int month, int year) {
- if (month < 1 || month > 13)
- throw new System.ArgumentOutOfRangeException("month",
- "Month should be between One and Thirteen.");
- switch (month) {
- case 2: return 29;
- case 4: return 29;
- case 6: return 29;
- case 8:
- if (!long_heshvan(year))
- return 29;
- break;
- case 9:
- if (short_kislev(year))
- return 29;
- break;
- case 10: return 29;
- case 12:
- if (!is_leap_year(year))
- return 29;
- break;
- case 13: return 29;
- }
- return 30;
- }
-
- /// <summary>
- /// The functions checks whether the month Heshvan is a long one
- /// in the given Hebrew year.
- /// </summary>
- /// <param name="year">An integer that gives the Hebrew year.
- /// </param>
- /// <returns>A boolean value: true if there is a long Heshvan
- /// in the given Hebrew year; false otherwise.
- /// </returns>
- public static bool long_heshvan(int year) {
- return CCMath.mod(days_in_year(year), 10) == 5;
- }
-
- /// <summary>
- /// The functions checks whether the month Kislev is a short one
- /// in the given Hebrew year.
- /// </summary>
- /// <param name="year">An integer that gives the Hebrew year.
- /// </param>
- /// <returns>A boolean value: true if there is a short Kislev
- /// in the given Hebrew year; false otherwise.
- /// </returns>
- public static bool short_kislev(int year) {
- return CCMath.mod(days_in_year(year), 10) == 3;
- }
-
- /// <summary>
- /// The functions gives the number of days in the specified Hebrew
- /// year.
- /// </summary>
- /// <param name="year">An integer that gives the Hebrew year.
- /// </param>
- /// <returns>The days of the Hebrew year as integer.
- /// </returns>
- public static int days_in_year(int year) {
- return fixed_from_dmy(1, 7, year+1) -
- fixed_from_dmy(1, 7, year);
- }
-
- /// <summary>
- /// The method returns the fixed day number of the given Hebrew
- /// date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Hebrew year.
- /// </param>
- /// <param name="year">An integer representing the Hebrew year.
- /// Non-positive values are allowed also.
- /// </param>
- /// <returns>An integer value representing the fixed day number.
- /// </returns>
- public static int fixed_from_dmy(int day, int month, int year) {
- int m;
- int k = epoch-1;
- k += elapsed_days(year);
- k += new_year_delay(year);
-
- if (month < 7) {
- int l = last_month_of_year(year);
- for (m = 7; m <= l; m++) {
- k += last_day_of_month(m, year);
- }
- for (m = 1; m < month; m++) {
- k += last_day_of_month(m, year);
- }
- }
- else {
- for (m = 7; m < month; m++) {
- k += last_day_of_month(m, year);
- }
- }
-
- k += day;
-
- return k;
- }
-
- /// <summary>
- /// The method computes the Hebrew year from a fixed day number.
- /// </summary>
- /// <param name="date">The fixed day number.
- /// </param>
- /// <returns>An integer value giving the Hebrew year of the date.
- /// </returns>
- public static int year_from_fixed(int date) {
- int approx = (int)System.Math.Floor(
- ((double)(date - epoch))/(35975351.0/98496.0));
- int y;
- for (y = approx; date >= fixed_from_dmy(1, 7, y); y++) {}
- return y-1;
- }
-
- /// <summary>
- /// The method computes the Hebrew year and month from a fixed day
- /// number.
- /// </summary>
- /// <param name="month">The output value giving the Hebrew month.
- /// </param>
- /// <param name="year">The output value giving the Hebrew year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void my_from_fixed(out int month, out int year,
- int date)
- {
- year = year_from_fixed(date);
-
- int start = date < fixed_from_dmy(1, 1, year) ? 7 : 1;
-
- for (month = start;
- date > fixed_from_dmy(last_day_of_month(month, year),
- month, year);
- month++)
- {}
- }
-
- /// <summary>
- /// The method computes the Hebrew year, month, and day from a
- /// fixed day number.
- /// </summary>
- /// <param name="day">The output value returning the day of the
- /// month.
- /// </param>
- /// <param name="month">The output value giving the Hebrew month.
- /// </param>
- /// <param name="year">The output value giving the Hebrew year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void dmy_from_fixed(out int day, out int month,
- out int year, int date)
- {
- my_from_fixed(out month, out year, date);
- day = date - fixed_from_dmy(1, month, year) + 1;
- }
-
- /// <summary>A method computing the Hebrew month from a fixed
- /// day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the Hebrew month.
- /// </returns>
- public static int month_from_fixed(int date) {
- int month, year;
-
- my_from_fixed(out month, out year, date);
- return month;
- }
-
- /// <summary>
- /// A method computing the day of the month from a fixed day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the day of the month.
- /// </returns>
- public static int day_from_fixed(int date) {
- int day, month, year;
-
- dmy_from_fixed(out day, out month, out year, date);
- return day;
- }
-
- /// <summary>
- /// The method computes the difference between two Hebrew dates.
- /// </summary>
- /// <param name="dayA">The integer parameter gives the day of month
- /// of the first date.
- /// </param>
- /// <param name="monthA">The integer parameter gives the Hebrew
- /// month of the first date.
- /// </param>
- /// <param name="yearA">The integer parameter gives the Hebrew
- /// year of the first date.
- /// </param>
- /// <param name="dayB">The integer parameter gives the day of month
- /// of the second date.
- /// </param>
- /// <param name="monthB">The integer parameter gives the Hebrew
- /// month of the second date.
- /// </param>
- /// <param name="yearB">The integer parameter gives the Hebrew
- /// year of the second date.
- /// </param>
- /// <returns>An integer giving the difference of days from the first
- /// the second date.
- /// </returns>
- public static int date_difference(int dayA, int monthA, int yearA,
- int dayB, int monthB, int yearB)
- {
- return fixed_from_dmy(dayB, monthB, yearB) -
- fixed_from_dmy(dayA, monthA, yearA);
- }
-
- /// <summary>
- /// The method computes the number of the day in the year from
- /// a Hebrew date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Hebrew year.
- /// </param>
- /// <param name="year">An integer representing the Hebrew year.
- /// </param>
- /// <returns>An integer value giving the number of the day in the
- /// Hebrew year, counting from 1.
- /// </returns>
- public static int day_number(int day, int month, int year) {
- return date_difference(1, 7, year,
- day, month, year) + 1;
- }
-
- /// <summary>
- /// The method computes the days remaining in the given Hebrew
- /// year from a Hebrew date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Hebrew year.
- /// </param>
- /// <param name="year">An integer representing the Hebrew year.
- /// </param>
- /// <returns>An integer value giving the number of days remaining in
- /// the Hebrew year.
- /// </returns>
- public static int days_remaining(int day, int month, int year) {
- return date_difference(day, month, year,
- 1, 7, year+1)-1;
- }
-} // class HebrewCalendar
-
-
-/// <summary>
-/// A class encapsulating the functions of the Islamic calendar as static
-/// methods.
-/// </summary>
-/// <remarks>
-/// <para>There is no difference here in using Hijri or Islamic calendar.
-/// </para>
-/// <para>The epoch of the Islamic calendar isn't fixed, because we cannot
-/// surely say today, when the crescent of the new moon has been observed
-/// around the July 16, 622 C.E. Julian. Even today the start and end of
-/// the month Ramadan is defined by religous authorities. So the calendar
-/// can be offset by two days.
-/// </para>
-/// <para>
-/// We don't support the offset here, however we changed the epoch from
-/// "Calendrical Calculations" to value, that .Net seems to be using.
-/// </para>
-/// <para>
-/// This class is not compatible to
-/// <see cref="T:System.Globalization.HijriCalendar"/>.
-/// </para>
-/// <seealso cref="T:CCFixed"/>
-/// </remarks>
-public class CCHijriCalendar {
- /// <summary>An integer defining the epoch of the Gregorian calendar
- /// as fixed day number.</summary>
- /// <remarks>
- /// <para>
- /// The epoch is given as 16 July 622 C.E. Julian (R.D. 227015)
- /// in Calendrical Calculations, the approximate date of
- /// the emigration of
- /// Muhammed to Medina. However there is no way to determine today
- /// the observation of the crescent of the new moon in July 622 C.E.
- /// (Julian). So there is some variability in the epoch.
- /// Religous authorities determine the epoch by observing the
- /// crescent of the new moon for the month Ramadan, so there might
- /// be an offsets by two days of the epoch.
- /// </para>
- /// <para>Windows
- /// supports an AddHijriDate parameter in the registry to adapt
- /// for it. It seems that the .NET implementation of
- /// HijriCalendar uses an epoch of 227014, so we use it here. The
- /// ArgumentOutOfRangeException gives July, 18 622 as epoch,
- /// which is 227014 supporting our theory.
- /// </para>
- /// </remarks>
- const int epoch = 227014;
-
- /// <summary>The enumeration defines the months of the Islamic
- /// calendar.
- /// </summary>
- public enum Month {
- /// <summary>
- /// Muharram.
- /// </summary>
- muharram = 1,
- /// <summary>
- /// Safar.
- /// </summary>
- safar,
- /// <summary>
- /// Rabi I.
- /// </summary>
- rabi_I,
- /// <summary>
- /// Rabi II.
- /// </summary>
- rabi_II,
- /// <summary>
- /// Jumada I.
- /// </summary>
- jumada_I,
- /// <summary>
- /// Jumada II.
- /// </summary>
- jumada_II,
- /// <summary>
- /// Rajab.
- /// </summary>
- rajab,
- /// <summary>
- /// Shaban.
- /// </summary>
- shaban,
- /// <summary>
- /// Ramadan.
- /// </summary>
- ramadan,
- /// <summary>
- /// Shawwal.
- /// </summary>
- shawwal,
- /// <summary>
- /// Dhu Al-Quada.
- /// </summary>
- dhu_al_quada,
- /// <summary>
- /// Dhu Al-Hijja.
- /// </summary>
- dhu_al_hijja,
- };
-
- /// <summary>
- /// The method tells whether the year is a leap year.
- /// </summary>
- /// <param name="year">An integer representing the Islamic year.
- /// </param>
- /// <returns>A boolean which is true if <paramref name="year"/> is
- /// a leap year.
- /// </returns>
- public static bool is_leap_year(int year) {
- return CCMath.mod(14+11*year, 30) < 11;
- }
-
- /// <summary>
- /// The method returns the fixed day number of the given Islamic
- /// date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Islamic year.
- /// </param>
- /// <param name="year">An integer representing the Islamic year.
- /// Non-positive values are allowed also.
- /// </param>
- /// <returns>An integer value representing the fixed day number.
- /// </returns>
- public static int fixed_from_dmy(int day, int month, int year) {
- int k = epoch - 1;
- k += 354 * (year-1);
- k += CCMath.div(3+11*year, 30);
- k += (int)System.Math.Ceiling(29.5 * (double)(month-1));
- k += day;
-
- return k;
- }
-
- /// <summary>
- /// The method computes the Islamic year from a fixed day number.
- /// </summary>
- /// <param name="date">The fixed day number.
- /// </param>
- /// <returns>An integer value giving the Islamic year of the date.
- /// </returns>
- public static int year_from_fixed(int date) {
- return CCMath.div(30*(date-epoch)+10646, 10631);
- }
-
- /// <summary>
- /// The method computes the Islamic year and month from a fixed day
- /// number.
- /// </summary>
- /// <param name="month">The output value giving the Islamic month.
- /// </param>
- /// <param name="year">The output value giving the Islamic year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void my_from_fixed(out int month, out int year, int date)
- {
- year = year_from_fixed(date);
-
- int m = 1+(int)System.Math.Ceiling(
- ((double)(date-29-fixed_from_dmy(1,1,year)))/29.5);
-
- month = m < 12 ? m : 12;
- }
-
- /// <summary>
- /// The method computes the Islamic year, month, and day from a
- /// fixed day number.
- /// </summary>
- /// <param name="day">The output value returning the day of the
- /// month.
- /// </param>
- /// <param name="month">The output value giving the Islamic month.
- /// </param>
- /// <param name="year">The output value giving the Islamic year.
- /// </param>
- /// <param name="date">An integer value specifying the fixed day
- /// number.</param>
- public static void dmy_from_fixed(out int day, out int month,
- out int year, int date)
- {
- my_from_fixed(out month, out year, date);
- day = date - fixed_from_dmy(1, month, year) + 1;
- }
-
- /// <summary>A method computing the Islamic month from a fixed
- /// day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the Islamic month.
- /// </returns>
- public static int month_from_fixed(int date) {
- int month, year;
-
- my_from_fixed(out month, out year, date);
- return month;
- }
-
- /// <summary>
- /// A method computing the day of the month from a fixed day number.
- /// </summary>
- /// <param name="date">An integer specifying the fixed day number.
- /// </param>
- /// <returns>An integer value representing the day of the month.
- /// </returns>
- public static int day_from_fixed(int date) {
- int day;
- int month;
- int year;
-
- dmy_from_fixed(out day, out month, out year, date);
- return day;
- }
-
- /// <summary>
- /// The method computes the difference between two Islamic dates.
- /// </summary>
- /// <param name="dayA">The integer parameter gives the day of month
- /// of the first date.
- /// </param>
- /// <param name="monthA">The integer parameter gives the Islamic
- /// month of the first date.
- /// </param>
- /// <param name="yearA">The integer parameter gives the Islamic
- /// year of the first date.
- /// </param>
- /// <param name="dayB">The integer parameter gives the day of month
- /// of the second date.
- /// </param>
- /// <param name="monthB">The integer parameter gives the Islamic
- /// month of the second date.
- /// </param>
- /// <param name="yearB">The integer parameter gives the Islamic
- /// year of the second date.
- /// </param>
- /// <returns>An integer giving the difference of days from the first
- /// the second date.
- /// </returns>
- public static int date_difference(int dayA, int monthA, int yearA,
- int dayB, int monthB, int yearB)
- {
- return fixed_from_dmy(dayB, monthB, yearB) -
- fixed_from_dmy(dayA, monthA, yearA);
- }
-
- /// <summary>
- /// The method computes the number of the day in the year from
- /// a Islamic date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Islamic year.
- /// </param>
- /// <param name="year">An integer representing the Islamic year.
- /// </param>
- /// <returns>An integer value giving the number of the day in the
- /// Islamic year, counting from 1.
- /// </returns>
- public static int day_number(int day, int month, int year) {
- return date_difference(31, 12, year-1, day, month, year);
- }
-
- /// <summary>
- /// The method computes the days remaining in the given Islamic
- /// year from a Islamic date.
- /// </summary>
- /// <param name="day">An integer representing the day of the month,
- /// counting from 1.
- /// </param>
- /// <param name="month">An integer representing the month in the
- /// Islamic year.
- /// </param>
- /// <param name="year">An integer representing the Islamic year.
- /// Non-positive values are allowed also.
- /// </param>
- /// <returns>An integer value giving the number of days remaining in
- /// the Islamic year.
- /// </returns>
- public static int days_remaining(int day, int month, int year) {
- return date_difference(day, month, year,31, 12, year);
- }
-} // class CCHijriCalendar
-
-/// <summary>
-/// A class that supports the Gregorian based calendars with other eras
-/// (e.g. <see cref="T:System.Gloablization.JapaneseCalendar"/>).
-/// </summary>
-[System.Serializable]
-public class CCGregorianEraHandler {
- /// <summary>
- /// A struct that represents a single era.
- /// </summary>
- [System.Serializable]
- struct Era {
- /// <summary>
- /// The integer number identifying the era.
- /// </summary>
- private int _nr;
-
- /// <value>
- /// A get-only property that gives the era integer number.
- /// </value>
- public int Nr { get { return _nr; } }
-
- /// <summary>This integer gives the first day of the era as
- /// fixed day number.
- /// </summary>
- private int _start; // inclusive
- /// <summary>
- /// This integer gives the gregorian year of the
- /// <see cref="M:_start"/> value.
- /// </summary>
- private int _gregorianYearStart;
- /// <summary>
- /// This integer gives the last day of the era as fixed day
- /// number.
- /// </summary>
- private int _end; // inclusive
- /// <summary>
- /// This integer gives the largest year number of this era.
- /// </summary>
- private int _maxYear;
-
- /// <summary>
- /// This constructor creates the era structure.
- /// </summary>
- /// <param name="nr">The integer number of the era.
- /// </param>
- /// <param name="start">The fixed day number defining the
- /// first day of the era.
- /// </param>
- /// <param name="end">The fixed day number that defines the
- /// last day of the era.
- /// </param>
- public Era(int nr, int start, int end) {
- if (nr == 0)
- throw new System.ArgumentException(
- "Era number shouldn't be zero.");
- _nr = nr;
- if (start > end) {
- throw new System.ArgumentException(
- "Era should start before end.");
- }
- _start = start;
- _end = end;
-
- _gregorianYearStart =
- CCGregorianCalendar.year_from_fixed(_start);
- int gregorianYearEnd =
- CCGregorianCalendar.year_from_fixed(_end);
- _maxYear = gregorianYearEnd - _gregorianYearStart + 1;
- }
-
- /// <summary>
- /// This method computes the Gregorian year from the year
- /// of this era.
- /// </summary>
- /// <param name="year">An integer giving the year in the
- /// era.
- /// </param>
- /// <returns>
- /// The Gregorian year as integer.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the year isn't valid in this
- /// era.
- /// </exception>
- public int GregorianYear(int year) {
- if (year < 1 || year > _maxYear) {
- System.IO.StringWriter sw =
- new System.IO.StringWriter();
- sw.Write(
- "Valid Values are between " +
- "{0} and {1}, inclusive.",
- 1, _maxYear);
- throw new System.ArgumentOutOfRangeException(
- "year", sw.ToString());
- }
- return year + _gregorianYearStart - 1;
- }
-
- /// <summary>
- /// This function checks wether the given fixed day number is
- /// ion the time span of the era.
- /// </summary>
- /// <param name="date">An integer giving the fixed day
- /// number.
- /// </param>
- /// <returns>A boolean: true if the argument is in the time
- /// span of the era.
- /// </returns>
- public bool Covers(int date) {
- return _start <= date && date <= _end;
- }
-
- /// <summary>
- /// This function returns the year of the era and sets
- /// the era in an output parameter.
- /// </summary>
- /// <param name="era">An output parameter returning the
- /// era number.
- /// </param>
- /// <param name="date">An integer giving the fixed day
- /// number.
- /// </param>
- /// <returns>An integer giving the year of the era.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if date is outside of the time
- /// span of the era.
- /// </exception>
- public int EraYear(out int era, int date) {
- if (!Covers(date))
- throw new System.ArgumentOutOfRangeException(
- "date",
- "Time was out of Era range.");
- int gregorianYear =
- CCGregorianCalendar.year_from_fixed(date);
- era = _nr;
- return gregorianYear - _gregorianYearStart + 1;
- }
- } // struct Era
-
- /// <summary>
- /// A private member storing the eras in a
- /// <see cref="T:System.Collections.SortedList"/>.
- /// </summary>
- private SortedList _Eras;
-
- /// <value>
- /// The property returns the era numbers as an array of integers.
- /// </value>
- public int[] Eras {
- get {
- int[] a = new int[_Eras.Count];
-
- for (int i = 0; i < _Eras.Count; i++) {
- Era e = (Era)_Eras.GetByIndex(i);
- a[i] = e.Nr;
- }
-
- return a;
- }
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public CCGregorianEraHandler() {
- _Eras = new SortedList();
- }
-
- /// <summary>
- /// Method adds an era to the GregorianEraHandler instance.
- /// </summary>
- /// <param name="nr">The integer number of the era.
- /// </param>
- /// <param name="rd_start">The fixed day number defining the
- /// first day of the era.
- /// </param>
- /// <param name="rd_end">The fixed day number that defines the
- /// last day of the era.
- /// </param>
- public void appendEra(int nr, int rd_start, int rd_end) {
- Era era = new Era(nr, rd_start, rd_end);
- _Eras[(System.Object)nr] = era;
- }
- /// <summary>
- /// Method adds a yet not-ended era to the GregorianEraHandler
- /// instance.
- /// </summary>
- /// <param name="nr">The integer number of the era.
- /// </param>
- /// <param name="rd_start">The fixed day number defining the
- /// first day of the era.
- /// </param>
- public void appendEra(int nr, int rd_start) {
- appendEra(nr, rd_start,
- CCFixed.FromDateTime(DateTime.MaxValue));
- }
-
- /// <summary>
- /// This method computes the Gregorian year from the year
- /// of the given era.
- /// </summary>
- /// <param name="year">An integer giving the year in the
- /// era.
- /// </param>
- /// <param name="era">An integer giving the era number.
- /// </param>
- /// <returns>
- /// The Gregorian year as integer.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the year isn't valid in this
- /// era.
- /// </exception>
- public int GregorianYear(int year, int era) {
- Era e = (Era)_Eras[(System.Object)era];
- return e.GregorianYear(year);
- }
-
- /// <summary>
- /// This function returns the year of the era and sets
- /// the era in an output parameter.
- /// </summary>
- /// <param name="era">An output parameter returning the
- /// era number.
- /// </param>
- /// <param name="date">An integer giving the fixed day
- /// number.
- /// </param>
- /// <returns>An integer giving the year of the era.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the fixed day number is outside of the
- /// time spans of all eras.
- /// </exception>
- public int EraYear(out int era, int date)
- {
- IList list = _Eras.GetValueList();
-
- foreach (Era e in list) {
- if (e.Covers(date))
- return e.EraYear(out era, date);
- }
-
- throw new System.ArgumentOutOfRangeException("date",
- "Time value was out of era range.");
- }
-
- /// <summary>
- /// The method checks whether a given
- /// <see cref="T:System.DateTime"/> is covered by any era.
- /// </summary>
- /// <param name="time">A
- /// <see cref="T:System.DateTime"/> giving the date and time.
- /// </param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the argument isn't inside the time
- /// span of any era.
- /// </exception>
- public void CheckDateTime(System.DateTime time) {
- int date = CCFixed.FromDateTime(time);
-
- if (!ValidDate(date))
- throw new System.ArgumentOutOfRangeException("time",
- "Time value was out of era range.");
- }
-
- /// <summary>
- /// The method tests whether a given
- /// fixed day number is covered by any era.
- /// </summary>
- /// <param name="date">An integer representing the fixed day number.
- /// </param>
- /// <returns> A boolean is returned: true if the argument is inside
- /// the time span of one era; false otherwise.
- /// </returns>
- public bool ValidDate(int date) {
- IList list = _Eras.GetValueList();
-
- foreach (Era e in list) {
- if (e.Covers(date))
- return true;
- }
-
- return false;
- }
-
- /// <summary>
- /// The method tests, whether the era number does exist.
- /// </summary>
- /// <param name="era">An integer giving the era number.
- /// </param>
- /// <returns>A boole value: True if the era number does exist;
- /// false otherwise.
- /// </returns>
- public bool ValidEra(int era) {
- return _Eras.Contains((System.Object)era);
- }
-} // class CCGregorianEraHandler
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog
deleted file mode 100644
index 3c46c318a52..00000000000
--- a/mcs/class/corlib/System.Globalization/ChangeLog
+++ /dev/null
@@ -1,109 +0,0 @@
-2002-06-12 Nick Drochak <ndrochak@gol.com>
-
- * DateTimeFormatInfo.cs: Reformat.
-
-2002-06-11 Nick Drochak <ndrochak@gol.com>
-
- * NumberFormatInfo.cs: Make NumberNegativePattern = 1 for the ctor
-
-2002-06-07 Nick Drochak <ndrochak@gol.com>
-
- * NumberFormatInfo.cs: Make InvariantInfo.NumberNegativePattern = 1
-
-2002-05-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * CompareInfo.cs: new basic stub (compiles on Linux, so I assume
- it does not break the build on windows. Sorry if it does).
-
-2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * NumberFormatInfo.cs: always set the values for the invariant culture
- until there are more cultures supported.
-
-2002-04-22 Nick Drochak <ndrochak@gol.com>
-
- * NumberStyles.cs: Add [Serializable].
-
-2002-04-08 Nick Drochak <ndrochak@gol.com>
-
- * UnicodeCategory.cs: Fix typos in enum names.
-
-2002-03-04 Nick Drochak <ndrochak@gol.com>
-
- * JulianCalendar.cs: JulianEra should be field, not a property.
- Thanks CorCompare (and Piers).
-
-2002-02-12 Duncan Mak <duncan@ximian.com>
-
- * CultureInfo.cs: Added the Calendar property to make the TimeZone
- class build. It's marked as MonoTODO.
-
-2002-02-12 Nick Drochak <ndrochak@gol.com>
-
- * UnicodeCategory.cs: Fix typo.
-
-2002-02-01 Radek Doulik <rodo@ximian.com>
-
- * RegionInfo.cs: started work on RegionInfo
- implemented RegionInfo (string) constructor
-
- * CultureInfo.cs: added internal static function,
- which could be used from RegionInfo.cs
-
-2002-01-16 Miguel de Icaza <miguel@ximian.com>
-
- * CultureInfo.cs: Completed the tables. Now we need to actually
- fill it in.
-
-2002-01-15 Duncan Mak <duncan@ximian.com>
-
- * CultureInfo.cs: Convert it to unix text.
-
-2002-01-04 Ravi Pratap <ravi@ximian.com>
-
- * GreogrianCalendar.cs : The same old MonoTODO attribute.
-
-2001-11-21 Miguel de Icaza <miguel@ximian.com>
-
- * Locale.cs: New file, a place holder for Locale.GetText.
-
-Wed Nov 14 16:47:07 CET 2001 Paolo Molaro <lupus@ximian.com>
-
- * Calendar.cs: CLSCompliant updates.
-
-2001-11-04 Martin Weindel <martin.weindel@t-online.de>
- * NumberFormatInfo.cs: fixed minor bug in Clone with readonly flag
-
- * DateTimeFormatInfo.cs: added
-
- * CultureInfo.cs: some changed needed for compiling DateTimeFormatInfo.cs
-
-2001-10-26 Miguel de Icaza <miguel@ximian.com>
-
- * NumberFormatInfo.cs: Provide an internal constructor that takes
- as an argument a CultureInfo ID (LCID) so that we can construct
- different ones here.
-
- * CultureInfo.cs: Begun implementation.
-
-2001-10-09 Derek Holden <dholden@draper.com>
-
- * NumberFormatInfo.cs: Small typo in PercentPositivePattern
- and CurrencyPositivePattern
-
-2001-09-02 Miguel de Icaza <miguel@ximian.com>
-
- * Calendar.cs: Implement a bunch of missing features.
-
-2001-07-24 Derek Holden <dholden@draper.com>
-
- * NumberStyles.cs: Added ECMA values for Allow types and default
- styles.
-
-2001-07-18 Michael Lambert <michaellambert@email.com>
-
- * DateTimeStyles.cs, NumberStyles.cs: Add.
-
-2001-07-06 Joe Shaw <joe@ximian.com>
-
- * UnicodeCategory.cs: Added.
diff --git a/mcs/class/corlib/System.Globalization/CompareInfo.cs b/mcs/class/corlib/System.Globalization/CompareInfo.cs
deleted file mode 100644
index 5e6fdee6e08..00000000000
--- a/mcs/class/corlib/System.Globalization/CompareInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// System.Globalization.CompareInfo
-//
-// Authors:
-// Rodrigo Moya (rodrigo@ximian.com)
-//
-// (C) Ximian, Inc. 2002
-//
-
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- public class CompareInfo : IDeserializationCallback
- {
- [MonoTODO]
- void IDeserializationCallback.OnDeserialization(object sender)
- {
- throw new NotImplementedException ();
- }
-
- }
-}
diff --git a/mcs/class/corlib/System.Globalization/CompareOptions.cs b/mcs/class/corlib/System.Globalization/CompareOptions.cs
deleted file mode 100755
index 81be8d94504..00000000000
--- a/mcs/class/corlib/System.Globalization/CompareOptions.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// CompareOptions.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:34:52 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-
-namespace System.Globalization {
-
-
- /// <summary>
- /// </summary>
- [Flags]
- public enum CompareOptions {
-
- /// <summary>
- /// </summary>
- None = 0,
-
- /// <summary>
- /// </summary>
- IgnoreCase = 1,
-
- /// <summary>
- /// </summary>
- IgnoreNonSpace = 2,
-
- /// <summary>
- /// </summary>
- IgnoreSymbols = 4,
-
- /// <summary>
- /// </summary>
- IgnoreKanaType = 8,
-
- /// <summary>
- /// </summary>
- IgnoreWidth = 16,
-
- /// <summary>
- /// </summary>
- StringSort = 536870912,
-
- /// <summary>
- /// </summary>
- Ordinal = 1073741824,
- } // CompareOptions
-
-} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/CultureInfo.cs b/mcs/class/corlib/System.Globalization/CultureInfo.cs
deleted file mode 100644
index 36ed5d91c65..00000000000
--- a/mcs/class/corlib/System.Globalization/CultureInfo.cs
+++ /dev/null
@@ -1,850 +0,0 @@
-//
-// System.Globalization.CultureInfo
-//
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. 2001 (http://www.ximian.com)
-//
-
-using System.Threading;
-
-namespace System.Globalization
-{
- [Serializable]
- public class CultureInfo : IFormatProvider
- {
- static CultureInfo invariant_culture_info;
- bool is_read_only;
- int lcid;
- bool use_user_override;
- NumberFormatInfo number_format;
- DateTimeFormatInfo datetime_format;
-
- private static readonly string MSG_READONLY = "This instance is read only";
-
- // <summary>
- // Returns the Invariant Culture Information ("iv")
- // </summary>
- static public CultureInfo InvariantCulture {
- get {
- if (invariant_culture_info != null)
- return invariant_culture_info;
-
- invariant_culture_info = new CultureInfo (0x07f, false);
- invariant_culture_info.is_read_only = true;
-
- return invariant_culture_info;
- }
- }
-
- //
- // Initializes the CultureInfo object for the specific culture_id
- //
- void InitializeByID (int culture_id, bool use_user_override)
- {
- switch (culture_id){
- case 0x0001: // ar Arabic
- case 0x0401: // ar-SA Arabic (Saudi Arabia)
- case 0x0801: // ar-IQ Arabic (Iraq)
- case 0x0C01: // ar-EG Arabic (Egypt)
- case 0x1001: // ar-LY Arabic (Libya)
- case 0x1401: // ar-DZ Arabic (Algeria)
- case 0x1801: // ar-MA Arabic (Morocco)
- case 0x1C01: // ar-TN Arabic (Tunisia)
- case 0x2001: // ar-OM Arabic (Oman)
- case 0x2401: // ar-YE Arabic (Yemen)
- case 0x2801: // ar-SY Arabic (Syria)
- case 0x2C01: // ar-JO Arabic (Jordan)
- case 0x3001: // ar-LB Arabic (Lebanon)
- case 0x3401: // ar-KW Arabic (Kuwait)
- case 0x3801: // ar-AE Arabic (U.A.E.)
- case 0x3C01: // ar-BH Arabic (Bahrain)
- case 0x4001: // ar-QA Arabic (Qatar)
- case 0x0002: // bg Bulgarian
- case 0x0402: // bg-BG Bulgarian (Bulgaria)
- case 0x0003: // ca Catalan
- case 0x0403: // ca-ES Catalan (Spain)
- case 0x0004: // zh-CHS Chinese (Simplified)
- case 0x0404: // zh-TW Chinese (Taiwan)
- case 0x0804: // zh-CN Chinese (People's Republic of China)
- case 0x0C04: // zh-HK Chinese (Hong Kong S.A.R.)
- case 0x1004: // zh-SG Chinese (Singapore)
- case 0x1404: // zh-MO Chinese (Macau S.A.R.)
- case 0x7C04: // zh-CHT Chinese (Traditional)
- case 0x0005: // cs Czech
- case 0x0405: // cs-CZ Czech (Czech Republic)
- case 0x0006: // da Danish
- case 0x0406: // da-DK Danish (Denmark)
- case 0x0007: // de German
- case 0x0407: // de-DE German (Germany)
- case 0x0807: // de-CH German (Switzerland)
- case 0x0C07: // de-AT German (Austria)
- case 0x1007: // de-LU German (Luxembourg)
- case 0x1407: // de-LI German (Liechtenstein)
- case 0x0008: // el Greek
- case 0x0408: // el-GR Greek (Greece)
- case 0x0009: // en English
- case 0x0409: // en-US English (United States)
- case 0x0809: // en-GB English (United Kingdom)
- case 0x0C09: // en-AU English (Australia)
- case 0x1009: // en-CA English (Canada)
- case 0x1409: // en-NZ English (New Zealand)
- case 0x1809: // en-IE English (Ireland)
- case 0x1C09: // en-ZA English (South Africa)
- case 0x2009: // en-JM English (Jamaica)
- case 0x2409: // en-CB English (Caribbean)
- case 0x2809: // en-BZ English (Belize)
- case 0x2C09: // en-TT English (Trinidad and Tobago)
- case 0x3009: // en-ZW English (Zimbabwe)
- case 0x3409: // en-PH English (Republic of the Philippines)
- case 0x000A: // es Spanish
- case 0x080A: // es-MX Spanish (Mexico)
- case 0x0C0A: // es-ES Spanish (Spain)
- case 0x100A: // es-GT Spanish (Guatemala)
- case 0x140A: // es-CR Spanish (Costa Rica)
- case 0x180A: // es-PA Spanish (Panama)
- case 0x1C0A: // es-DO Spanish (Dominican Republic)
- case 0x200A: // es-VE Spanish (Venezuela)
- case 0x240A: // es-CO Spanish (Colombia)
- case 0x280A: // es-PE Spanish (Peru)
- case 0x2C0A: // es-AR Spanish (Argentina)
- case 0x300A: // es-EC Spanish (Ecuador)
- case 0x340A: // es-CL Spanish (Chile)
- case 0x380A: // es-UY Spanish (Uruguay)
- case 0x3C0A: // es-PY Spanish (Paraguay)
- case 0x400A: // es-BO Spanish (Bolivia)
- case 0x440A: // es-SV Spanish (El Salvador)
- case 0x480A: // es-HN Spanish (Honduras)
- case 0x4C0A: // es-NI Spanish (Nicaragua)
- case 0x500A: // es-PR Spanish (Puerto Rico)
- case 0x000B: // fi Finnish
- case 0x040B: // fi-FI Finnish (Finland)
- case 0x000C: // fr French
- case 0x040C: // fr-FR French (France)
- case 0x080C: // fr-BE French (Belgium)
- case 0x0C0C: // fr-CA French (Canada)
- case 0x100C: // fr-CH French (Switzerland)
- case 0x140C: // fr-LU French (Luxembourg)
- case 0x180C: // fr-MC French (Principality of Monaco)
- case 0x000D: // he Hebrew
- case 0x040D: // he-IL Hebrew (Israel)
- case 0x000E: // hu Hungarian
- case 0x040E: // hu-HU Hungarian (Hungary)
- case 0x000F: // is Icelandic
- case 0x040F: // is-IS Icelandic (Iceland)
- case 0x0010: // it Italian
- case 0x0410: // it-IT Italian (Italy)
- case 0x0810: // it-CH Italian (Switzerland)
- case 0x0011: // ja Japanese
- case 0x0411: // ja-JP Japanese (Japan)
- case 0x0012: // ko Korean
- case 0x0412: // ko-KR Korean (Korea)
- case 0x0013: // nl Dutch
- case 0x0413: // nl-NL Dutch (Netherlands)
- case 0x0813: // nl-BE Dutch (Belgium)
- case 0x0014: // no Norwegian
- case 0x0414: // nb-NO Norwegian (Bokmål) (Norway)
- case 0x0814: // nn-NO Norwegian (Nynorsk) (Norway)
- case 0x0015: // pl Polish
- case 0x0415: // pl-PL Polish (Poland)
- case 0x0016: // pt Portuguese
- case 0x0416: // pt-BR Portuguese (Brazil)
- case 0x0816: // pt-PT Portuguese (Portugal)
- case 0x0018: // ro Romanian
- case 0x0418: // ro-RO Romanian (Romania)
- case 0x0019: // ru Russian
- case 0x0419: // ru-RU Russian (Russia)
- case 0x001A: // hr Croatian
- case 0x041A: // hr-HR Croatian (Croatia)
- case 0x081A: // Lt-sr-SP Serbian (Latin) (Serbia)
- case 0x0C1A: // Cy-sr-SP Serbian (Cyrillic) (Serbia)
- case 0x001B: // sk Slovak
- case 0x041B: // sk-SK Slovak (Slovakia)
- case 0x001C: // sq Albanian
- case 0x041C: // sq-AL Albanian (Albania)
- case 0x001D: // sv Swedish
- case 0x041D: // sv-SE Swedish (Sweden)
- case 0x081D: // sv-FI Swedish (Finland)
- case 0x001E: // th Thai
- case 0x041E: // th-TH Thai (Thailand)
- case 0x001F: // tr Turkish
- case 0x041F: // tr-TR Turkish (Turkey)
- case 0x0020: // ur Urdu
- case 0x0420: // ur-PK Urdu (Islamic Republic of Pakistan)
- case 0x0021: // id Indonesian
- case 0x0421: // id-ID Indonesian (Indonesia)
- case 0x0022: // uk Ukrainian
- case 0x0422: // uk-UA Ukrainian (Ukraine)
- case 0x0023: // be Belarusian
- case 0x0423: // be-BY Belarusian (Belarus)
- case 0x0024: // sl Slovenian
- case 0x0424: // sl-SI Slovenian (Slovenia)
- case 0x0025: // et Estonian
- case 0x0425: // et-EE Estonian (Estonia)
- case 0x0026: // lv Latvian
- case 0x0426: // lv-LV Latvian (Latvia)
- case 0x0027: // lt Lithuanian
- case 0x0427: // lt-LT Lithuanian (Lithuania)
- case 0x0029: // fa Farsi
- case 0x0429: // fa-IR Farsi (Iran)
- case 0x002A: // vi Vietnamese
- case 0x042A: // vi-VN Vietnamese (Viet Nam)
- case 0x002B: // hy Armenian
- case 0x042B: // hy-AM Armenian (Armenia)
- case 0x002C: // az Azeri
- case 0x042C: // Lt-az-AZ Azeri (Latin) (Azerbaijan)
- case 0x082C: // Cy-az-AZ Azeri (Cyrillic) (Azerbaijan)
- case 0x002D: // eu Basque
- case 0x042D: // eu-ES Basque (Spain)
- case 0x002F: // mk FYRO Macedonian
- case 0x042F: // mk-MK FYRO Macedonian (Former Yugoslav Republic of Macedonia)
- case 0x0036: // af Afrikaans
- case 0x0436: // af-ZA Afrikaans (South Africa)
- case 0x0037: // ka Georgian
- case 0x0437: // ka-GE Georgian (Georgia)
- case 0x0038: // fo Faeroese
- case 0x0438: // fo-FO Faeroese (Faeroe Islands)
- case 0x0039: // hi Hindi
- case 0x0439: // hi-IN Hindi (India)
- case 0x003E: // ms Malay
- case 0x043E: // ms-MY Malay (Malaysia)
- case 0x083E: // ms-BN Malay (Brunei Darussalam)
- case 0x003F: // kk Kazakh
- case 0x043F: // kk-KZ Kazakh (Kazakhstan)
- case 0x0040: // ky Kyrgyz
- case 0x0440: // ky-KZ Kyrgyz (Kyrgyzstan)
- case 0x0041: // sw Swahili
- case 0x0441: // sw-KE Swahili (Kenya)
- case 0x0043: // uz Uzbek
- case 0x0443: // Lt-uz-UZ Uzbek (Latin) (Uzbekistan)
- case 0x0843: // Cy-uz-UZ Uzbek (Cyrillic) (Uzbekistan)
- case 0x0044: // tt Tatar
- case 0x0444: // tt-TA Tatar (Tatarstan)
- case 0x0046: // pa Punjabi
- case 0x0446: // pa-IN Punjabi (India)
- case 0x0047: // gu Gujarati
- case 0x0447: // gu-IN Gujarati (India)
- case 0x0049: // ta Tamil
- case 0x0449: // ta-IN Tamil (India)
- case 0x004A: // te Telugu
- case 0x044A: // te-IN Telugu (India)
- case 0x004B: // kn Kannada
- case 0x044B: // kn-IN Kannada (India)
- case 0x004E: // mr Marathi
- case 0x044E: // mr-IN Marathi (India)
- case 0x004F: // sa Sanskrit
- case 0x044F: // sa-IN Sanskrit (India)
- case 0x0050: // mn Mongolian
- case 0x0450: // mn-MN Mongolian (Mongolia)
- case 0x0056: // gl Galician
- case 0x0456: // gl-ES Galician (Spain)
- case 0x0057: // kok Konkani
- case 0x0457: // kok-IN Konkani (India)
- case 0x005A: // syr Syriac
- case 0x045A: // syr-SY Syriac (Syria)
- case 0x0065: // div Divehi
- case 0x0465: // div-MV Divehi (Maldives)
- case 0x007F: // Invariant Language (Invariant Country)
- break;
-
- default:
- throw new ArgumentException ("CultureInfoCode");
- }
- lcid = culture_id;
- this.use_user_override = use_user_override;
- }
-
- //
- // Maps a name to a culture id
- //
- static int NameToID (string name)
- {
- switch (name){
- case "ar":
- return 0x0001;
- case "ar-SA":
- return 0x0401;
- case "ar-IQ":
- return 0x0801;
- case "ar-EG":
- return 0x0C01;
- case "ar-LY":
- return 0x1001;
- case "ar-DZ":
- return 0x1401;
- case "ar-MA":
- return 0x1801;
- case "ar-TN":
- return 0x1C01;
- case "ar-OM":
- return 0x2001;
- case "ar-YE":
- return 0x2401;
- case "ar-SY":
- return 0x2801;
- case "ar-JO":
- return 0x2C01;
- case "ar-LB":
- return 0x3001;
- case "ar-KW":
- return 0x3401;
- case "ar-AE":
- return 0x3801;
- case "ar-BH":
- return 0x3C01;
- case "ar-QA":
- return 0x4001;
- case "bg":
- return 0x0002;
- case "bg-BG":
- return 0x0402;
- case "ca":
- return 0x0003;
- case "ca-ES":
- return 0x0403;
- case "zh-CHS":
- return 0x0004;
- case "zh-TW":
- return 0x0404;
- case "zh-CN":
- return 0x0804;
- case "zh-HK":
- return 0x0C04;
- case "zh-SG":
- return 0x1004;
- case "zh-MO":
- return 0x1404;
- case "zh-CHT":
- return 0x7C04;
- case "cs":
- return 0x0005;
- case "cs-CZ":
- return 0x0405;
- case "da":
- return 0x0006;
- case "da-DK":
- return 0x0406;
- case "de":
- return 0x0007;
- case "de-DE":
- return 0x0407;
- case "de-CH":
- return 0x0807;
- case "de-AT":
- return 0x0C07;
- case "de-LU":
- return 0x1007;
- case "de-LI":
- return 0x1407;
- case "el":
- return 0x0008;
- case "el-GR":
- return 0x0408;
- case "en":
- return 0x0009;
- case "en-US":
- return 0x0409;
- case "en-GB":
- return 0x0809;
- case "en-AU":
- return 0x0C09;
- case "en-CA":
- return 0x1009;
- case "en-NZ":
- return 0x1409;
- case "en-IE":
- return 0x1809;
- case "en-ZA":
- return 0x1C09;
- case "en-JM":
- return 0x2009;
- case "en-CB":
- return 0x2409;
- case "en-BZ":
- return 0x2809;
- case "en-TT":
- return 0x2C09;
- case "en-ZW":
- return 0x3009;
- case "en-PH":
- return 0x3409;
- case "es":
- return 0x000A;
- case "es-MX":
- return 0x080A;
- case "es-ES":
- return 0x0C0A;
- case "es-GT":
- return 0x100A;
- case "es-CR":
- return 0x140A;
- case "es-PA":
- return 0x180A;
- case "es-DO":
- return 0x1C0A;
- case "es-VE":
- return 0x200A;
- case "es-CO":
- return 0x240A;
- case "es-PE":
- return 0x280A;
- case "es-AR":
- return 0x2C0A;
- case "es-EC":
- return 0x300A;
- case "es-CL":
- return 0x340A;
- case "es-UY":
- return 0x380A;
- case "es-PY":
- return 0x3C0A;
- case "es-BO":
- return 0x400A;
- case "es-SV":
- return 0x440A;
- case "es-HN":
- return 0x480A;
- case "es-NI":
- return 0x4C0A;
- case "es-PR":
- return 0x500A;
- case "fi":
- return 0x000B;
- case "fi-FI":
- return 0x040B;
- case "fr":
- return 0x000C;
- case "fr-FR":
- return 0x040C;
- case "fr-BE":
- return 0x080C;
- case "fr-CA":
- return 0x0C0C;
- case "fr-CH":
- return 0x100C;
- case "fr-LU":
- return 0x140C;
- case "fr-MC":
- return 0x180C;
- case "he":
- return 0x000D;
- case "he-IL":
- return 0x040D;
- case "hu":
- return 0x000E;
- case "hu-HU":
- return 0x040E;
- case "is":
- return 0x000F;
- case "is-IS":
- return 0x040F;
- case "it":
- return 0x0010;
- case "it-IT":
- return 0x0410;
- case "it-CH":
- return 0x0810;
- case "ja":
- return 0x0011;
- case "ja-JP":
- return 0x0411;
- case "ko":
- return 0x0012;
- case "ko-KR":
- return 0x0412;
- case "nl":
- return 0x0013;
- case "nl-NL":
- return 0x0413;
- case "nl-BE":
- return 0x0813;
- case "no":
- return 0x0014;
- case "nb-NO":
- return 0x0414;
- case "nn-NO":
- return 0x0814;
- case "pl":
- return 0x0015;
- case "pl-PL":
- return 0x0415;
- case "pt":
- return 0x0016;
- case "pt-BR":
- return 0x0416;
- case "pt-PT":
- return 0x0816;
- case "ro":
- return 0x0018;
- case "ro-RO":
- return 0x0418;
- case "ru":
- return 0x0019;
- case "ru-RU":
- return 0x0419;
- case "hr":
- return 0x001A;
- case "hr-HR":
- return 0x041A;
- case "Lt-sr-SP":
- return 0x081A;
- case "Cy-sr-SP":
- return 0x0C1A;
- case "sk":
- return 0x001B;
- case "sk-SK":
- return 0x041B;
- case "sq":
- return 0x001C;
- case "sq-AL":
- return 0x041C;
- case "sv":
- return 0x001D;
- case "sv-SE":
- return 0x041D;
- case "sv-FI":
- return 0x081D;
- case "th":
- return 0x001E;
- case "th-TH":
- return 0x041E;
- case "tr":
- return 0x001F;
- case "tr-TR":
- return 0x041F;
- case "ur":
- return 0x0020;
- case "ur-PK":
- return 0x0420;
- case "id":
- return 0x0021;
- case "id-ID":
- return 0x0421;
- case "uk":
- return 0x0022;
- case "uk-UA":
- return 0x0422;
- case "be":
- return 0x0023;
- case "be-BY":
- return 0x0423;
- case "sl":
- return 0x0024;
- case "sl-SI":
- return 0x0424;
- case "et":
- return 0x0025;
- case "et-EE":
- return 0x0425;
- case "lv":
- return 0x0026;
- case "lv-LV":
- return 0x0426;
- case "lt":
- return 0x0027;
- case "lt-LT":
- return 0x0427;
- case "fa":
- return 0x0029;
- case "fa-IR":
- return 0x0429;
- case "vi":
- return 0x002A;
- case "vi-VN":
- return 0x042A;
- case "hy":
- return 0x002B;
- case "hy-AM":
- return 0x042B;
- case "az":
- return 0x002C;
- case "Lt-az-AZ":
- return 0x042C;
- case "Cy-az-AZ":
- return 0x082C;
- case "eu":
- return 0x002D;
- case "eu-ES":
- return 0x042D;
- case "mk":
- return 0x002F;
- case "mk-MK":
- return 0x042F;
- case "af":
- return 0x0036;
- case "af-ZA":
- return 0x0436;
- case "ka":
- return 0x0037;
- case "ka-GE":
- return 0x0437;
- case "fo":
- return 0x0038;
- case "fo-FO":
- return 0x0438;
- case "hi":
- return 0x0039;
- case "hi-IN":
- return 0x0439;
- case "ms":
- return 0x003E;
- case "ms-MY":
- return 0x043E;
- case "ms-BN":
- return 0x083E;
- case "kk":
- return 0x003F;
- case "kk-KZ":
- return 0x043F;
- case "ky":
- return 0x0040;
- case "ky-KZ":
- return 0x0440;
- case "sw":
- return 0x0041;
- case "sw-KE":
- return 0x0441;
- case "uz":
- return 0x0043;
- case "Lt-uz-UZ":
- return 0x0443;
- case "Cy-uz-UZ":
- return 0x0843;
- case "tt":
- return 0x0044;
- case "tt-TA":
- return 0x0444;
- case "pa":
- return 0x0046;
- case "pa-IN":
- return 0x0446;
- case "gu":
- return 0x0047;
- case "gu-IN":
- return 0x0447;
- case "ta":
- return 0x0049;
- case "ta-IN":
- return 0x0449;
- case "te":
- return 0x004A;
- case "te-IN":
- return 0x044A;
- case "kn":
- return 0x004B;
- case "kn-IN":
- return 0x044B;
- case "mr":
- return 0x004E;
- case "mr-IN":
- return 0x044E;
- case "sa":
- return 0x004F;
- case "sa-IN":
- return 0x044F;
- case "mn":
- return 0x0050;
- case "mn-MN":
- return 0x0450;
- case "gl":
- return 0x0056;
- case "gl-ES":
- return 0x0456;
- case "kok":
- return 0x0057;
- case "kok-IN":
- return 0x0457;
- case "syr":
- return 0x005A;
- case "syr-SY":
- return 0x045A;
- case "div":
- return 0x0065;
- case "div-MV":
- return 0x0465;
- case "":
- return 0x007F;
- }
- return -1;
- }
-
- // <summary>
- // Creates a CultureInfo for a specific ID
- // </summary>
- public static CultureInfo CreateSpecificCulture (string name)
- {
- if (name == null)
- throw new ArgumentNullException ();
-
- int id = NameToID (name);
-
- if (id == -1)
- throw new ArgumentException ("name");
-
- return new CultureInfo (id, false);
- }
-
- /// <summary>
- /// CultureInfo instance that represents the culture used by the current thread
- /// </summary>
- public static CultureInfo CurrentCulture
- {
- get
- {
- return Thread.CurrentThread.CurrentCulture;
- }
-
- set
- {
- Thread.CurrentThread.CurrentCulture = value;
- }
- }
-
- /// <summary>
- /// CultureInfo instance that represents the current culture used by the ResourceManager to look up culture-specific resources at run time
- /// </summary>
- public static CultureInfo CurrentUICulture
- {
- get
- {
- return Thread.CurrentThread.CurrentUICulture;
- }
-
- set
- {
- Thread.CurrentThread.CurrentUICulture = value;
- }
- }
-
-
- public virtual int LCID {
- get {
- return lcid;
- }
- }
-
- // <summary>
- // Gets the string-encoded name of the culture
- // </summary>
- public virtual string Name {
- get {
- switch (lcid){
- case 0x007f:
- return "iv";
- }
- throw new Exception ("Miss constructed object for LCID: " + lcid);
- }
- }
-
- [MonoTODO]
- public virtual Calendar Calendar
- {
- get { return null; }
- }
-
- internal static bool IsIDNeutralCulture (int lcid) {
- return (lcid & 0xff00) == 0;
- }
-
- // <summary>
- // Returns whether the current culture is neutral (neutral cultures
- // only specify a language, not a country.
- // </summary>
- public virtual bool IsNeutralCulture {
- get {
- return IsIDNeutralCulture (lcid);
- }
- }
- // <summary>
- // Returns the NumberFormat for the current lcid
- // </summary>
- public virtual NumberFormatInfo NumberFormat {
- get {
- if (number_format == null){
- lock (this){
- if (number_format == null)
- number_format = new NumberFormatInfo (lcid);
- }
- }
-
- return number_format;
- }
-
- set {
- if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
-
- if (value == null)
- throw new ArgumentNullException ("NumberFormat");
-
- number_format = value;
- }
- }
-
- public virtual DateTimeFormatInfo DateTimeFormat
- {
- get
- {
- if (datetime_format == null)
- {
- lock (this)
- {
- if (datetime_format == null)
- datetime_format = new DateTimeFormatInfo();
- }
- }
-
- return datetime_format;
- }
-
- set
- {
- if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
-
- if (value == null)
- throw new ArgumentNullException ("DateTimeFormat");
-
- datetime_format = value;
- }
- }
-
- //
- // IFormatProvider implementation
- //
- public virtual object GetFormat( Type formatType )
- {
- object format = null;
-
- if ( formatType == typeof(NumberFormatInfo) )
- format = NumberFormat;
- else if ( formatType == typeof(DateTimeFormatInfo) )
- format = DateTimeFormat;
-
- return format;
- }
-
- //
- // Constructors
- //
- public CultureInfo (int culture, bool use_user_override)
- {
- if (culture < 0)
- throw new ArgumentOutOfRangeException ();
-
- InitializeByID (culture, use_user_override);
- }
-
- public CultureInfo (int culture) : this (culture, false)
- {
- }
-
- public CultureInfo (string name, bool use_user_override)
- {
- if (name == null)
- throw new ArgumentNullException ();
-
- InitializeByID (NameToID (name), use_user_override);
- }
-
- public CultureInfo (string name) : this (name, false) {}
- }
-}
diff --git a/mcs/class/corlib/System.Globalization/CultureTypes.cs b/mcs/class/corlib/System.Globalization/CultureTypes.cs
deleted file mode 100755
index 7218b10150e..00000000000
--- a/mcs/class/corlib/System.Globalization/CultureTypes.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// CultureTypes.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:35:02 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-
-namespace System.Globalization {
-
-
- /// <summary>
- /// </summary>
- [Flags]
- public enum CultureTypes {
-
- /// <summary>
- /// </summary>
- NeutralCultures = 1,
-
- /// <summary>
- /// </summary>
- SpecificCultures = 2,
-
- /// <summary>
- /// </summary>
- InstalledWin32Cultures = 4,
-
- /// <summary>
- /// </summary>
- AllCultures = 7,
-
- } // CultureTypes
-
-} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs b/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
deleted file mode 100644
index 82ecd5ec3fe..00000000000
--- a/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
+++ /dev/null
@@ -1,609 +0,0 @@
-// System.Globalization.DateTimeFormatInfo
-//
-// Some useful functions are missing in the ECMA specs.
-// They have been added following MS SDK Beta2
-//
-// Martin Weindel (martin.weindel@t-online.de)
-//
-// (C) Martin Weindel (martin.weindel@t-online.de)
-
-using System;
-
-using System.Threading;
-
-
-namespace System.Globalization
-{
-
- [Serializable]
-
- public sealed class DateTimeFormatInfo : ICloneable, IFormatProvider {
-
- private static readonly string MSG_READONLY = "This instance is read only";
- private static readonly string MSG_ARRAYSIZE_MONTH = "An array with exactly 13 elements is needed";
- private static readonly string MSG_ARRAYSIZE_DAY = "An array with exactly 7 elements is needed";
- private static readonly string[] INVARIANT_ABBREVIATED_DAY_NAMES
- = new string[7] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
- private static readonly string[] INVARIANT_DAY_NAMES
- = new string[7] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
- private static readonly string[] INVARIANT_ABBREVIATED_MONTH_NAMES
- = new string[13] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""};
- private static readonly string[] INVARIANT_MONTH_NAMES
- = new string[13] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""};
-
- public static DateTimeFormatInfo theInvariantDateTimeFormatInfo;
-
- private bool readOnly;
-
- private string _AMDesignator;
-
- private string _PMDesignator;
-
- private string _DateSeparator;
-
- private string _TimeSeparator;
-
- private string _ShortDatePattern;
-
- private string _LongDatePattern;
-
- private string _ShortTimePattern;
-
- private string _LongTimePattern;
-
- private string _MonthDayPattern;
-
- private string _YearMonthPattern;
-
- private string _FullDateTimePattern;
-
- private string _RFC1123Pattern;
-
- private string _SortableDateTimePattern;
-
- private string _UniversalSortableDateTimePattern;
-
- private DayOfWeek _FirstDayOfWeek;
-
- private Calendar _Calendar;
-
- private CalendarWeekRule _CalendarWeekRule;
-
- private string[] _AbbreviatedDayNames;
-
- private string[] _DayNames;
-
- private string[] _MonthNames;
-
- private string[] _AbbreviatedMonthNames;
-
-
- public DateTimeFormatInfo()
-
- {
-
- readOnly = false;
-
- _AMDesignator = "AM";
-
- _PMDesignator = "PM";
-
- _DateSeparator = "/";
-
- _TimeSeparator = ":";
-
- _ShortDatePattern = "MM/dd/yyyy";
-
- _LongDatePattern = "dddd, dd MMMM yyyy";
-
- _ShortTimePattern = "HH:mm";
-
- _LongTimePattern = "HH:mm:ss";
-
- _MonthDayPattern = "MMMM dd";
-
- _YearMonthPattern = "yyyy MMMM";
-
- _FullDateTimePattern = "dddd, dd MMMM yyyy HH:mm:ss";
-
- // FIXME for the following three pattern: "The default value of this property is
- //derived from the calendar that is set for CultureInfo.CurrentCulture or the default
- //calendar of CultureInfo.CurrentCulture."
-
- _RFC1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
-
- _SortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
-
- _UniversalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
-
-
-
- _FirstDayOfWeek = DayOfWeek.Sunday;
-
- _Calendar = new GregorianCalendar();
-
- _CalendarWeekRule = CalendarWeekRule.FirstDay;
-
-
- _AbbreviatedDayNames = INVARIANT_ABBREVIATED_DAY_NAMES;
-
- _DayNames = INVARIANT_DAY_NAMES;
-
- _AbbreviatedMonthNames = INVARIANT_ABBREVIATED_MONTH_NAMES;
-
- _MonthNames = INVARIANT_MONTH_NAMES;
-
- }
-
-
-
- // LAMESPEC: this is not in ECMA specs
-
- public static DateTimeFormatInfo GetInstance(IFormatProvider provider)
-
- {
-
- if (provider != null) {
-
- DateTimeFormatInfo dtfi;
-
- dtfi = (DateTimeFormatInfo)provider.GetFormat(typeof(DateTimeFormatInfo));
-
- if (dtfi != null)
-
- return dtfi;
-
- }
-
-
- return CurrentInfo;
-
- }
-
-
-
- public bool IsReadOnly {
-
- get {
-
- return readOnly;
-
- }
-
- }
-
-
-
- public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi)
-
- {
-
- DateTimeFormatInfo copy = (DateTimeFormatInfo)dtfi.Clone();
-
- copy.readOnly = true;
-
- return copy;
-
- }
-
-
-
- public object Clone ()
-
- {
-
- DateTimeFormatInfo clone = (DateTimeFormatInfo) MemberwiseClone();
-
- // clone is not read only
-
- clone.readOnly = false;
-
- return clone;
-
- }
-
-
-
- public object GetFormat(Type formatType)
- {
- return (formatType == GetType()) ? this : null;
- }
-
- public string GetAbbreviatedEraName(int era)
- {
- if (era < _Calendar.Eras.Length || era >= _Calendar.Eras.Length)
- throw new ArgumentOutOfRangeException();
- notImplemented();
- //FIXME: implement me
- return null;
- }
-
- public string GetAbbreviatedMonthName(int month)
- {
- if (month < 1 || month > 13) throw new ArgumentOutOfRangeException();
- return _AbbreviatedMonthNames[month-1];
- }
-
- public int GetEra(string eraName)
- {
- if (eraName == null) throw new ArgumentNullException();
- eraName = eraName.ToUpper();
- notImplemented();
- //FIXME: implement me
- return -1;
- }
-
- public string GetEraName(int era)
- {
- if (era < _Calendar.Eras.Length || era >= _Calendar.Eras.Length)
- throw new ArgumentOutOfRangeException();
- notImplemented();
- //FIXME: implement me
- return null;
- }
-
- public string GetMonthName(int month)
- {
- if (month < 1 || month > 13) throw new ArgumentOutOfRangeException();
- return _MonthNames[month-1];
- }
-
- public string[] AbbreviatedDayNames
- {
- get
- {
- return (string[]) _AbbreviatedDayNames.Clone();
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- if (value.GetLength(0) != 7) throw new ArgumentException(MSG_ARRAYSIZE_DAY);
- _AbbreviatedDayNames = (string[]) value.Clone();
- }
- }
-
- public string[] AbbreviatedMonthNames
- {
- get
- {
- return (string[]) _AbbreviatedMonthNames.Clone();
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- if (value.GetLength(0) != 13) throw new ArgumentException(MSG_ARRAYSIZE_MONTH);
- _AbbreviatedMonthNames = (string[]) value.Clone();
- }
- }
-
- public string[] DayNames
- {
- get
- {
- return (string[]) _DayNames.Clone();
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- if (value.GetLength(0) != 7) throw new ArgumentException(MSG_ARRAYSIZE_DAY);
- _DayNames = (string[]) value.Clone();
- }
- }
-
- public string[] MonthNames
- {
- get
- {
- return (string[]) _MonthNames.Clone();
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- if (value.GetLength(0) != 13) throw new ArgumentException(MSG_ARRAYSIZE_MONTH);
- _MonthNames = (string[]) value.Clone();
- }
- }
-
- public string AMDesignator
- {
- get
- {
- return _AMDesignator;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _AMDesignator = value;
- }
- }
-
- public string PMDesignator
- {
- get
- {
- return _PMDesignator;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _PMDesignator = value;
- }
- }
-
- public string DateSeparator
- {
- get
- {
- return _DateSeparator;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _DateSeparator = value;
- }
- }
-
- public string TimeSeparator
- {
- get
- {
- return _TimeSeparator;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _TimeSeparator = value;
- }
- }
-
- public string LongDatePattern
- {
- get
- {
- return _LongDatePattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _LongDatePattern = value;
- }
- }
-
- public string ShortDatePattern
- {
- get
- {
- return _ShortDatePattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _ShortDatePattern = value;
- }
- }
-
- public string ShortTimePattern
- {
- get
- {
- return _ShortTimePattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _ShortTimePattern = value;
- }
- }
-
- public string LongTimePattern
- {
- get
- {
- return _LongTimePattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _LongTimePattern = value;
- }
- }
-
- public string MonthDayPattern
- {
- get
- {
- return _MonthDayPattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _MonthDayPattern = value;
- }
- }
-
- public string YearMonthPattern
- {
- get
- {
- return _YearMonthPattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _YearMonthPattern = value;
- }
- }
-
- public string FullDateTimePattern
- {
- get
- {
- return _FullDateTimePattern;
- }
-
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _FullDateTimePattern = value;
- }
- }
-
- public static DateTimeFormatInfo CurrentInfo
- {
- get
- {
- return Thread.CurrentThread.CurrentCulture.DateTimeFormat;
- }
- }
-
- public static DateTimeFormatInfo InvariantInfo
- {
- get
- {
- if (theInvariantDateTimeFormatInfo == null)
- {
- theInvariantDateTimeFormatInfo =
- DateTimeFormatInfo.ReadOnly(new DateTimeFormatInfo());
- }
- return theInvariantDateTimeFormatInfo;
- }
- }
-
- // LAMESPEC: this is not in ECMA specs
- public DayOfWeek FirstDayOfWeek
- {
- get
- {
- return _FirstDayOfWeek;
- }
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if ((int) value < 0 || (int) value > 6) throw new ArgumentOutOfRangeException();
- _FirstDayOfWeek = value;
- }
- }
-
- // LAMESPEC: this is not in ECMA specs
- public Calendar Calendar
- {
- get
- {
- return _Calendar;
- }
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- if (value == null) throw new ArgumentNullException();
- _Calendar = value;
- }
- }
-
- public CalendarWeekRule CalendarWeekRule
- {
- get
- {
- return _CalendarWeekRule;
- }
- set
- {
- if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
- _CalendarWeekRule = value;
- }
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string RFC1123Pattern
- {
- get
- {
- return _RFC1123Pattern;
- }
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string SortableDateTimePattern
- {
- get
- {
- return _SortableDateTimePattern;
- }
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string UniversalSortableDateTimePattern
- {
- get
- {
- return _UniversalSortableDateTimePattern;
- }
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string[] GetAllDateTimePatterns()
- {
- notImplemented();
- //FIXME: implement me
- return null;
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string[] GetAllDateTimePatterns(char format)
- {
- notImplemented();
- //FIXME: implement me
- return null;
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string GetDayName(DayOfWeek dayofweek)
- {
- int index = (int) dayofweek;
- if (index < 0 || index > 6) throw new ArgumentOutOfRangeException();
- return _DayNames[index];
- }
-
- // LAMESPEC: this is not in ECMA specs
- public string GetAbbreviatedDayName(DayOfWeek dayofweek)
- {
- int index = (int) dayofweek;
- if (index < 0 || index > 6) throw new ArgumentOutOfRangeException();
- return _AbbreviatedDayNames[index];
- }
-
- private static void notImplemented()
- {
- throw new Exception("Not implemented");
- }
- }
-
-}
diff --git a/mcs/class/corlib/System.Globalization/DateTimeStyles.cs b/mcs/class/corlib/System.Globalization/DateTimeStyles.cs
deleted file mode 100644
index 0e65c4d966d..00000000000
--- a/mcs/class/corlib/System.Globalization/DateTimeStyles.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// DateTimeStyles.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Fri, 7 Sep 2001 16:32:07 UTC
-// Source file: AllTypes.xml
-// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-
-namespace System.Globalization {
-
-
- /// <summary>
- /// </summary>
- [Flags]
- public enum DateTimeStyles {
-
- /// <summary>
- /// </summary>
- None = 0x00000000,
-
- /// <summary>
- /// </summary>
- AllowLeadingWhite = 0x00000001,
-
- /// <summary>
- /// </summary>
- AllowTrailingWhite = 0x00000002,
-
- /// <summary>
- /// </summary>
- AllowInnerWhite = 0x00000004,
-
- /// <summary>
- /// </summary>
- AllowWhiteSpaces = AllowLeadingWhite | AllowTrailingWhite | AllowInnerWhite,
-
- /// <summary>
- /// </summary>
- NoCurrentDateDefault = 0x00000008,
-
- /// <summary>
- /// </summary>
- AdjustToUniversal = 0x00000010,
- } // DateTimeStyles
-
-} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/DaylightTime.cs b/mcs/class/corlib/System.Globalization/DaylightTime.cs
deleted file mode 100755
index 64fc092f94f..00000000000
--- a/mcs/class/corlib/System.Globalization/DaylightTime.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// System.Globalization.DaylightTime
-//
-// Author:
-// Chris Hynes (chrish@assistedsolutions.com)
-//
-// (C) 2001 Chris Hynes
-//
-
-using System.Globalization;
-
-namespace System.Globalization
-{
- [Serializable]
- public class DaylightTime
- {
- DateTime start, end;
- TimeSpan delta;
-
- public DaylightTime(DateTime start, DateTime end, TimeSpan delta)
- {
- this.start = start;
- this.end = end;
- this.delta = delta;
- }
-
- public DateTime Start
- {
- get
- {
- return start;
- }
- }
-
- public DateTime End
- {
- get
- {
- return end;
- }
- }
-
- public TimeSpan Delta
- {
- get
- {
- return delta;
- }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Globalization/GregorianCalendar.cs b/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
deleted file mode 100644
index 54c9f44de49..00000000000
--- a/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
+++ /dev/null
@@ -1,448 +0,0 @@
-// GregorianCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-
-/// <summary>
-/// This is the Gregorian calendar.
-/// </summary>
-/// <remarks>
-/// <para>The Gregorian calendar supports only the Common Era from
-/// the Gregorian year 1 to the Gregorian year 9999.
-/// </para>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class GregorianCalendar : Calendar {
- /// <summary>
- /// The era number for the Common Era (C.E.) or Anno Domini (A.D.)
- /// respective.
- /// </summary>
- public const int ADEra = 1;
-
- /// <value>Overridden. Gives the eras supported by the Gregorian
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return new int[] { ADEra };
- }
- }
-
- /// <summary>
- /// A protected member storing the
- /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>.
- /// </summary>
- internal GregorianCalendarTypes M_CalendarType;
-
- /// <value>
- /// The property stores the
- /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>.
- /// </value>
- public virtual GregorianCalendarTypes CalendarType {
- get { return M_CalendarType; }
- set {
- // mscorlib 1:0:33000:0 doesn't check anything here
- M_CalendarType = value;
- }
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:ADEra"/>.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = ADEra;
- if (era != ADEra)
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:ADEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the allowed range.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckEra(ref era);
- M_ArgumentInRange("year", year, 1, 9999);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:ADEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYME(int year, int month, ref int era) {
- M_CheckYE(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:ADEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYMDE(int year, int month, int day, ref int era)
- {
- M_CheckYME(year, month, ref era);
- M_ArgumentInRange("day", day, 1,
- GetDaysInMonth(year, month, era));
- }
-
- /// <summary>
- /// Overridden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddMonths(DateTime time, int months) {
- return CCGregorianCalendar.AddMonths(time, months);
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddYears(DateTime time, int years) {
- return CCGregorianCalendar.AddYears(time, years);
- }
-
- /// <summary>
- /// Overridden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override int GetDayOfMonth(DateTime time) {
- return CCGregorianCalendar.GetDayOfMonth(time);
- }
-
- /// <summary>
- /// Overridden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- public override int GetDayOfYear(DateTime time) {
- return CCGregorianCalendar.GetDayOfYear(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An intger that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- // mscorlib doesn't check year, probably a bug; we do
- M_CheckYME(year, month, ref era);
- return CCGregorianCalendar.GetDaysInMonth(year, month);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> is outside the allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return CCGregorianCalendar.GetDaysInYear(year);
- }
-
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- public override int GetEra(DateTime time) {
- return ADEra;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- public override int GetMonth(DateTime time) {
- return CCGregorianCalendar.GetMonth(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- public override int GetYear(DateTime time) {
- return CCGregorianCalendar.GetYear(time);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- return CCGregorianCalendar.IsLeapDay(year, month, day);
- }
-
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- M_CheckYE(year, ref era);
- return CCGregorianCalendar.is_leap_year(year);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- return CCGregorianCalendar.ToDateTime(
- year, month, day,
- hour, minute, second, milliseconds);
- }
-
- /// <summary>
- /// Constructor that sets the
- /// Gregorian calendar type (
- /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>).
- /// </summary>
- /// <param name="type">The parameter specifies the Gregorian
- /// calendar type.
- /// </param>
- public GregorianCalendar(GregorianCalendarTypes type) {
- CalendarType = type;
- M_AbbrEraNames = new string[] {"C.E."};
- M_EraNames = new string[] {"Common Era"};
- if (M_TwoDigitYearMax == 99)
- M_TwoDigitYearMax = 2029;
- }
-
- /// <summary>
- /// Default constructor. Sets the Gregorian calendar type to
- /// <see
- /// cref="F:System.Globalization.GregorianCalendarTypes.Localized"/>.
- /// </summary>
- public GregorianCalendar() : this(GregorianCalendarTypes.Localized) {}
-} // class GregorianCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs b/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs
deleted file mode 100755
index 2d571fdd13b..00000000000
--- a/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// GregorianCalendarTypes.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:35:19 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-
-namespace System.Globalization {
-
-
- /// <summary>
- /// </summary>
- public enum GregorianCalendarTypes {
-
- /// <summary>
- /// </summary>
- Localized = 1,
-
- /// <summary>
- /// </summary>
- USEnglish = 2,
-
- /// <summary>
- /// </summary>
- MiddleEastFrench = 9,
-
- /// <summary>
- /// </summary>
- Arabic = 10,
-
- /// <summary>
- /// </summary>
- TransliteratedEnglish = 11,
-
- /// <summary>
- /// </summary>
- TransliteratedFrench = 12,
- } // GregorianCalendarTypes
-
-} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/HebrewCalendar.cs b/mcs/class/corlib/System.Globalization/HebrewCalendar.cs
deleted file mode 100644
index 0162fd580bf..00000000000
--- a/mcs/class/corlib/System.Globalization/HebrewCalendar.cs
+++ /dev/null
@@ -1,861 +0,0 @@
-// HebrewCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-using System.IO;
-
-/// <summary>
-/// This is the Hebrew calendar.
-/// </summary>
-/// <remarks>
-/// <para>The Hebrew calendar supports only years between 5343 A.M. and
-/// 6000 A.M. This has been done to be compatible with .NET.
-/// </para>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class HebrewCalendar : Calendar {
- /// <summary>
- /// Constructor.
- /// </summary>
- public HebrewCalendar() {
- M_AbbrEraNames = new string[] {"A.M."};
- M_EraNames = new string[] {"Anno Mundi"};
- if (M_TwoDigitYearMax == 99)
- M_TwoDigitYearMax = 5790;
- }
-
- /// <summary>
- /// The era number for the Anno Mundi (A.M.) era, called
- /// plain HebrewEra.
- /// </summary>
- public static readonly int HebrewEra = 1;
-
- /// <summary>
- /// The
- /// <see cref="T:System.DateTime"/> ticks for first day of year
- /// 5343 A.M.
- /// </summary>
- internal const long M_MinTicks = 499147488000000000L;
- /// <summary>
- /// The number of
- /// <see cref="T:System.DateTime"/> ticks for the last day of year
- /// 6000 A.M.
- /// </summary>
- internal const long M_MaxTicks = 706783967999999999L;
- /// <summary>
- /// The minimum year in the A.M. era supported.
- /// </summary>
- internal const int M_MinYear = 5343;
- /// <summary>
- /// The maximum year supported in the A.M. era.
- /// </summary>
- internal override int M_MaxYear {
- get { return 6000; }
- }
-
- /// <value>Overridden. Gives the eras supported by the Gregorian
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return new int[] { HebrewEra };
- }
- }
-
- /// <summary>
- /// A protected member checking a
- /// <see cref="T:System.DateTime"/> value.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/>
- /// to check.
- /// </param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- internal void M_CheckDateTime(DateTime time) {
- if (time.Ticks < M_MinTicks || time.Ticks > M_MaxTicks)
- throw new ArgumentOutOfRangeException(
- "time",
- "Only hebrew years between 5343 and 6000," +
- " inclusive, are supported.");
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HebrewEra"/>.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = HebrewEra;
- if (era != HebrewEra)
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HebrewEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the allowed range.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckEra(ref era);
- if (year < M_MinYear || year > M_MaxYear)
- throw new ArgumentOutOfRangeException(
- "year",
- "Only hebrew years between 5343 and 6000," +
- " inclusive, are supported.");
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HebrewEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYME(int year, int month, ref int era) {
- M_CheckYE(year, ref era);
- int l = CCHebrewCalendar.last_month_of_year(year);
- if (month < 1 || month > l) {
- StringWriter sw = new StringWriter();
- sw.Write("Month must be between 1 and {0}.", l);
- throw new ArgumentOutOfRangeException("month",
- sw.ToString());
- }
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HebrewEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYMDE(int year, int month, int day,
- ref int era)
- {
- M_CheckYME(year, month, ref era);
- M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month,
- era));
- }
-
- /// <summary>
- /// Overridden. Adds days to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// days.
- /// </param>
- /// <param name="days">The number of days to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="days"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddDays(DateTime time, int days) {
- DateTime t = base.AddDays(time, days);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds hours to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// hours.
- /// </param>
- /// <param name="hours">The number of hours to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="hours"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddHours(DateTime time, int hours) {
- DateTime t = base.AddHours(time, hours);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds milliseconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// milliseconds.
- /// </param>
- /// <param name="milliseconds">The number of milliseconds given as
- /// double to add. Keep in mind the 100 nanosecond resolution of
- /// <see cref="T:System.DateTime"/>.
- /// </param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="milliseconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddMilliseconds(DateTime time,
- double milliseconds)
- {
- DateTime t = base.AddMilliseconds(time, milliseconds);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds minutes to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// minutes.
- /// </param>
- /// <param name="minutes">The number of minutes to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="minutes"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddMinutes(DateTime time, int minutes) {
- DateTime t = base.AddMinutes(time, minutes);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds seconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// seconds.
- /// </param>
- /// <param name="seconds">The number of seconds to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="seconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddSeconds(DateTime time, int seconds) {
- DateTime t = base.AddSeconds(time, seconds);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds weeks to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// weeks.
- /// </param>
- /// <param name="weeks">The number of weeks to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="weeks"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddWeeks(DateTime time, int weeks) {
- DateTime t = base.AddWeeks(time, weeks);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Gives the hour of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the hour of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetHour(DateTime time) {
- M_CheckDateTime(time);
- return base.GetHour(time);
- }
-
- /// <summary>
- /// Overridden. Gives the milliseconds in the current second
- /// of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the milliseconds in the seconds
- /// of the specified time, starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override double GetMilliseconds(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMilliseconds(time);
- }
-
- /// <summary>
- /// Overridden. Gives the minute of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the minute of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetMinute(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overridden. Gives the second of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the second of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetSecond(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overrideden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddMonths(DateTime time, int months) {
- int y, m, d;
- DateTime t;
-
- if (months == 0) {
- t = time;
- } else {
- int rd = CCFixed.FromDateTime(time);
- CCHebrewCalendar.dmy_from_fixed(
- out d, out m, out y, rd);
- m = M_Month(m, y);
- if (months < 0) {
- while (months < 0) {
- if (m+months > 0) {
- m += months;
- months = 0;
- } else {
- months += m;
- y -= 1;
- m = GetMonthsInYear(y);
- }
- }
- }
- else {
- while (months > 0) {
- int my = GetMonthsInYear(y);
- if (m+months <= my) {
- m += months;
- months = 0;
- } else {
- months -= my-m+1;
- m = 1;
- y += 1;
- }
- }
- }
- t = ToDateTime(y, m, d, 0, 0, 0, 0);
- t = t.Add(time.TimeOfDay);
- }
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DateTime AddYears(DateTime time, int years) {
- int rd = CCFixed.FromDateTime(time);
- int day, month, year;
- CCHebrewCalendar.dmy_from_fixed(
- out day, out month, out year, rd);
- year += years;
- rd = CCHebrewCalendar.fixed_from_dmy(day, month, year);
- DateTime t = CCFixed.ToDateTime(rd);
- t = t.Add(time.TimeOfDay);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overriden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetDayOfMonth(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- return CCHebrewCalendar.day_from_fixed(rd);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetDayOfYear(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- int year = CCHebrewCalendar.year_from_fixed(rd);
- int rd1_7 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
- return rd - rd1_7 + 1;
- }
-
- /// <summary>
- /// The method maps a .NET Hebrew month to a Calencdrical
- /// Calculations Hebrew month.
- /// </summary>
- /// <param name="month">An integer representing a month in .NET
- /// counting (starting with Tishri).
- /// </param>
- /// <param name="year">An integer representing the Hebrew year.
- /// </param>
- /// <returns>The Hebrew month in Calendrical Calculations counting,
- /// staring with the Hebrew month Nisan.
- /// </returns>
- /// <remarks>
- /// <para>
- /// In .NET the month counting starts with the Hebrew month Tishri.
- /// Calendrical Calculations starts with the month Tisan. So we must
- /// map here.
- /// </para>
- /// </remarks>
- internal int M_CCMonth(int month, int year) {
- if (month <= 6) {
- return 6+month;
- }
- else {
- int l = CCHebrewCalendar.last_month_of_year(year);
- if (l == 12) {
- return month-6;
- }
- else {
- return month <= 7 ? 6+month : month-7;
- }
- }
- }
-
- /// <summary>
- /// The method maps a Calendrical Calculations Hebrew month
- /// to a .NET Hebrew month.
- /// </summary>
- /// <param name="ccmonth">An integer representing a month in
- /// Calendrical Calculations counting, starting with Nisan.
- /// </param>
- /// <param name="year">An integer representing the Hebrew year.
- /// </param>
- /// <returns>The Hebrew month in .NET counting,
- /// staring with the Hebrew month Tishri.
- /// </returns>
- /// <remarks>
- /// <para>
- /// In .NET the month counting starts with the Hebrew month Tishri.
- /// Calendrical Calculations starts with the month Tisan. So we must
- /// map here.
- /// </para>
- /// </remarks>
- internal int M_Month(int ccmonth, int year) {
- if (ccmonth >= 7) {
- return ccmonth - 6;
- } else {
- int l = CCHebrewCalendar.last_month_of_year(year);
- return ccmonth + (l == 12 ? 6 : 7);
- }
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An integer that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- int ccmonth = M_CCMonth(month, year);
- int rd1 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth, year);
- int rd2 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth+1, year);
- return rd2 - rd1;
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> or <paramref name="era"/> are outside the
- /// allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- M_CheckYE(year, ref era);
- int rd1 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
- int rd2 = CCHebrewCalendar.fixed_from_dmy(1, 7, year+1);
- return rd2 - rd1;
- }
-
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetEra(DateTime time) {
- M_CheckDateTime(time);
- return HebrewEra;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetMonth(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- int ccmonth, year;
- CCHebrewCalendar.my_from_fixed(out ccmonth, out year, rd);
- return M_Month(ccmonth, year);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return CCHebrewCalendar.last_month_of_year(year);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the years
- /// between 5343 A.M. and 6000 A.M., inclusive.
- /// </exception>
- public override int GetYear(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- return CCHebrewCalendar.year_from_fixed(rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- /// <remarks>All days in Adar II are viewed as leap days and the
- /// last day of Adar I.
- /// </remarks>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- return IsLeapYear(year) &&
- (month == 7 || (month == 6 && day == 30));
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- /// <remarks>
- /// Adar II is viewed as leap month.
- /// </remarks>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- return IsLeapYear(year) && month == 7;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- M_CheckYE(year, ref era);
- return CCHebrewCalendar.is_leap_year(year);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- int ccm = M_CCMonth(month, year);
- int rd = CCHebrewCalendar.fixed_from_dmy(day, ccm, year);
- return CCFixed.ToDateTime(rd,
- hour, minute, second, milliseconds);
- }
-} // class HebrewCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/HijriCalendar.cs b/mcs/class/corlib/System.Globalization/HijriCalendar.cs
deleted file mode 100644
index 9df3b005a3a..00000000000
--- a/mcs/class/corlib/System.Globalization/HijriCalendar.cs
+++ /dev/null
@@ -1,870 +0,0 @@
-// HijriCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-using System.IO;
-
-/// <summary>
-/// This is the Hijri calendar which might be called Islamic calendar.
-/// </summary>
-/// <remarks>
-/// <para>The calendar supports only dates in the HijriEra starting with the
-/// epoch.
-/// </para>
-/// <para>
-/// The epoch of the Hijri Calendar might be adjusted by the
-/// <see cref="F:System.Globalization.HijriCalendar.AddHijriDate"/>
-/// property. See the discussion of the
-/// <see cref="F:CalendricalCalculations.HijriCalendar.epoch">
-/// epoch
-/// </see>
-/// of the Hijri calendar.
-/// </para>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class HijriCalendar : Calendar {
- /// <summary>
- /// Constructor.
- /// </summary>
- public HijriCalendar() {
- M_AbbrEraNames = new string[] {"A.H."};
- M_EraNames = new string[] {"Anno Hegirae"};
- if (M_TwoDigitYearMax == 99)
- M_TwoDigitYearMax = 1451;
- }
-
- /// <summary>
- /// The era number for the Anno Hegirae (A.H.) era.
- /// </summary>
- public static readonly int HijriEra = 1;
-
- /// <summary>
- /// The minimum fixed day number supported by the Hijri calendar.
- /// </summary>
- internal static readonly int M_MinFixed =
- CCHijriCalendar.fixed_from_dmy(1, 1, 1);
- /// <summary>
- /// The maximum fixed day number supported by the Hijri calendar.
- /// </summary>
- internal static readonly int M_MaxFixed =
- CCGregorianCalendar.fixed_from_dmy(31, 12, 9999);
-
- /// <value>Overridden. Gives the eras supported by the Gregorian
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return new int[] { HijriEra };
- }
- }
-
- /// <summary>
- /// Protected field storing the
- /// <see cref="F:AddHijriDate"/>.
- /// </summary>
- internal int M_AddHijriDate = 0;
-
- // TODO: I don't know currently, which sign to use with the parameter.
- /// <value>An integer property representing the adjustment to the epoch
- /// of the Hijri calendar. Not supported by .NET.
- /// </value>
- public virtual int AddHijriDate {
- get {
- return M_AddHijriDate;
- }
- set {
- if (value < -3 && value > 3)
- throw new ArgumentOutOfRangeException(
- "AddHijriDate",
- "Value should be between -3 and 3.");
- M_AddHijriDate = value;
- }
- }
-
- /// <summary>
- /// A protected method checking an
- /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
- /// </summary>
- /// <param name="param">A string giving the name of the parameter
- /// to check.</param>
- /// <param name="rdHijri">An integer giving the AddHijriDate adjusted
- /// fixed day number.
- /// </param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// Exception is thrown, if the AddHijriDate adjusted fixed day
- /// number is outside the supported range.
- /// </exception>
- internal void M_CheckFixedHijri(string param, int rdHijri) {
- if (rdHijri < M_MinFixed || rdHijri > M_MaxFixed-AddHijriDate) {
- StringWriter sw = new StringWriter();
- int day, month, year;
- CCHijriCalendar.dmy_from_fixed(out day, out month,
- out year, M_MaxFixed-AddHijriDate);
- if (AddHijriDate != 0) {
- sw.Write("This HijriCalendar " +
- "(AddHijriDate {0})" +
- " allows dates from 1. 1. 1 to " +
- "{1}. {2}. {3}.",
- AddHijriDate,
- day, month, year);
- } else {
- sw.Write("HijriCalendar allows dates from " +
- "1.1.1 to {0}.{1}.{2}.",
- day, month, year);
- }
- throw new ArgumentOutOfRangeException(param,
- sw.ToString());
- }
- }
-
- /// <summary>
- /// A protected member checking a
- /// <see cref="T:System.DateTime"/> value.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/>
- /// to check.
- /// </param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the supported
- /// range of the Hijri calendar.
- /// </exception>
- internal void M_CheckDateTime(DateTime time) {
- int rd = CCFixed.FromDateTime(time) - AddHijriDate;
- M_CheckFixedHijri("time", rd);
- }
-
- /// <summary>
- /// Protected member which computes the
- /// <see cref="F:AddHijriDate"/>
- /// adjusted fixed day number from a
- /// <see cref="T:System.DateTime"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/>
- /// to convert.
- /// </param>
- /// <returns>The
- /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
- /// </returns>
- internal int M_FromDateTime(DateTime time) {
- return CCFixed.FromDateTime(time) - AddHijriDate;
- }
-
- /// <summary>
- /// Protected member which converts the
- /// <see cref="F:AddHijriDate"/>
- /// adjusted fixed day number the a
- /// <see cref="T:System.DateTime"/> value.
- /// </summary>
- /// <param name="rd">The
- /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
- /// </param>
- /// <returns>The converted
- /// <see cref="T:System.DateTime"/> value.
- /// </returns>
- internal DateTime M_ToDateTime(int rd) {
- return CCFixed.ToDateTime(rd+AddHijriDate);
- }
-
- /// <summary>
- /// Protected member which converts the
- /// <see cref="F:AddHijriDate"/>
- /// adjusted fixed day number the a
- /// <see cref="T:System.DateTime"/> value using a number
- /// of time parameters.
- /// </summary>
- /// <param name="date">The
- /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <returns>The converted
- /// <see cref="T:System.DateTime"/> value.
- /// </returns>
- internal DateTime M_ToDateTime(int date,
- int hour, int minute, int second, int milliseconds)
- {
- return CCFixed.ToDateTime(date+AddHijriDate,
- hour, minute, second, milliseconds);
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HijriEra"/>.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = HijriEra;
- if (era != HijriEra)
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HijriEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the allowed range.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckEra(ref era);
- M_ArgumentInRange("year", year, 1, 9666);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HijriEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYME(int year, int month, ref int era) {
- M_CheckYE(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- if (year == 9666) {
- int rd = CCHijriCalendar.fixed_from_dmy(1, month, year);
- M_CheckFixedHijri("month", rd);
- }
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="F:HijriEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYMDE(int year, int month, int day, ref int era)
- {
- M_CheckYME(year, month, ref era);
- M_ArgumentInRange("day", day, 1,
- GetDaysInMonth(year, month, HijriEra));
- if (year == 9666) {
- int rd = CCHijriCalendar.fixed_from_dmy(day, month,
- year);
- M_CheckFixedHijri("day", rd);
- }
- }
-
- /// <summary>
- /// Overridden. Adds days to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// days.
- /// </param>
- /// <param name="days">The number of days to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="days"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddDays(DateTime time, int days) {
- DateTime t = base.AddDays(time, days);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds hours to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// hours.
- /// </param>
- /// <param name="hours">The number of hours to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="hours"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddHours(DateTime time, int hours) {
- DateTime t = base.AddHours(time, hours);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds milliseconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// milliseconds.
- /// </param>
- /// <param name="milliseconds">The number of milliseconds given as
- /// double to add. Keep in mind the 100 nanosecond resolution of
- /// <see cref="T:System.DateTime"/>.
- /// </param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="milliseconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddMilliseconds(DateTime time,
- double milliseconds)
- {
- DateTime t = base.AddMilliseconds(time, milliseconds);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds minutes to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// minutes.
- /// </param>
- /// <param name="minutes">The number of minutes to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="minutes"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddMinutes(DateTime time, int minutes) {
- DateTime t = base.AddMinutes(time, minutes);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds seconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// seconds.
- /// </param>
- /// <param name="seconds">The number of seconds to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="seconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddSeconds(DateTime time, int seconds) {
- DateTime t = base.AddSeconds(time, seconds);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds weeks to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// weeks.
- /// </param>
- /// <param name="weeks">The number of weeks to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="weeks"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddWeeks(DateTime time, int weeks) {
- DateTime t = base.AddWeeks(time, weeks);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Gives the hour of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the hour of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetHour(DateTime time) {
- M_CheckDateTime(time);
- return base.GetHour(time);
- }
-
- /// <summary>
- /// Overridden. Gives the milliseconds in the current second
- /// of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the milliseconds in the seconds
- /// of the specified time, starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override double GetMilliseconds(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMilliseconds(time);
- }
-
- /// <summary>
- /// Overridden. Gives the minute of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the minute of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetMinute(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overridden. Gives the second of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the second of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetSecond(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overrideden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddMonths(DateTime time, int months) {
- int rd = M_FromDateTime(time);
- int day, month, year;
- CCHijriCalendar.dmy_from_fixed(
- out day, out month, out year, rd);
- month += months;
- year += CCMath.div_mod(out month, month, 12);
- rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
- M_CheckFixedHijri("time", rd);
- DateTime t = M_ToDateTime(rd);
- return t.Add(time.TimeOfDay);
- }
-
- /// <summary>
- /// Overrideden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DateTime AddYears(DateTime time, int years) {
- int rd = M_FromDateTime(time);
- int day, month, year;
- CCHijriCalendar.dmy_from_fixed(
- out day, out month, out year, rd);
- year += years;
- rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
- M_CheckFixedHijri("time", rd);
- DateTime t = M_ToDateTime(rd);
- return t.Add(time.TimeOfDay);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetDayOfMonth(DateTime time) {
- int rd = M_FromDateTime(time);
- M_CheckFixedHijri("time", rd);
- return CCHijriCalendar.day_from_fixed(rd);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- int rd = M_FromDateTime(time);
- M_CheckFixedHijri("time", rd);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetDayOfYear(DateTime time) {
- int rd = M_FromDateTime(time);
- M_CheckFixedHijri("time", rd);
- int year = CCHijriCalendar.year_from_fixed(rd);
- int rd1_1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);
- return rd - rd1_1 + 1;
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An intger that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- int rd1 = CCHijriCalendar.fixed_from_dmy(1, month, year);
- int rd2 = CCHijriCalendar.fixed_from_dmy(1, month+1, year);
- return rd2 - rd1;
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> is outside the allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- M_CheckYE(year, ref era);
- int rd1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);
- int rd2 = CCHijriCalendar.fixed_from_dmy(1, 1, year+1);
- return rd2 - rd1;
- }
-
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetEra(DateTime time) {
- M_CheckDateTime(time);
- return HijriEra;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetMonth(DateTime time) {
- int rd = M_FromDateTime(time);
- M_CheckFixedHijri("time", rd);
- return CCHijriCalendar.month_from_fixed(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is not in the
- /// supported range of the Hijri calendar.
- /// </exception>
- public override int GetYear(DateTime time) {
- int rd = M_FromDateTime(time);
- M_CheckFixedHijri("time", rd);
- return CCHijriCalendar.year_from_fixed(rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- return IsLeapYear(year) && month == 12 && day == 30;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- M_CheckYE(year, ref era);
- return CCHijriCalendar.is_leap_year(year);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- int rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
- return M_ToDateTime(rd,
- hour, minute, second, milliseconds);
- }
-} // class HijriCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs b/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs
deleted file mode 100644
index 52b994158f1..00000000000
--- a/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs
+++ /dev/null
@@ -1,783 +0,0 @@
-// JapaneseCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-
-/// <summary>
-/// This is the Japanese calendar. It differs from the Gregorian calendar
-/// only in the years.
-/// </summary>
-/// <remarks>
-/// <para>The Japanese calendar support four eras.</para>
-/// <list type="table">
-/// <listheader>
-/// <term>era number</term>
-/// <term>Gregorian start date</term>
-/// <term>Gregorian end date</term>
-/// </listheader>
-/// <item>
-/// <term>1</term>
-/// <term>September 8, 1868</term>
-/// <term>July 29, 1912</term>
-/// </item>
-/// <item>
-/// <term>2</term>
-/// <term>July 30, 1912</term>
-/// <term>December 24, 1926</term>
-/// </item>
-/// <item>
-/// <term>3</term>
-/// <term>December 25, 1926</term>
-/// <term>January 7, 1989</term>
-/// </item>
-/// <item>
-/// <term>4</term>
-/// <term>January 8, 1989</term>
-/// <term>present</term>
-/// </item>
-/// </list>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class JapaneseCalendar : Calendar {
- /// <summary>
- /// Static protected field storing the
- /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
- /// </summary>
- internal static readonly CCGregorianEraHandler M_EraHandler;
-
- /// <summary>
- /// Static constructor, who creates and initializes
- /// <see cref="F:M_EraHandler"/>.
- /// </summary>
- static JapaneseCalendar() {
- M_EraHandler = new CCGregorianEraHandler();
- M_EraHandler.appendEra(1,
- CCGregorianCalendar.fixed_from_dmy(8, 9, 1868),
- CCGregorianCalendar.fixed_from_dmy(29, 7, 1912));
- M_EraHandler.appendEra(2,
- CCGregorianCalendar.fixed_from_dmy(30, 7, 1912),
- CCGregorianCalendar.fixed_from_dmy(24, 12, 1926));
- M_EraHandler.appendEra(3,
- CCGregorianCalendar.fixed_from_dmy(25, 12, 1926),
- CCGregorianCalendar.fixed_from_dmy(7, 1, 1989));
- M_EraHandler.appendEra(4,
- CCGregorianCalendar.fixed_from_dmy(8, 1, 1989));
- }
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public JapaneseCalendar() {
- M_AbbrEraNames = new string[] { "M", "T", "S", "H" };
- M_EraNames = new string[] { "Meiji", "Taisho", "Showa",
- "Heisei" };
- }
-
-
- /// <value>Overridden. Gives the eras supported by the
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return (int[])M_EraHandler.Eras.Clone();
- }
- }
-
- /// <summary>
- /// A protected member checking a
- /// <see cref="T:System.DateTime"/> value.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/>
- /// to check.
- /// </param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- internal void M_CheckDateTime(DateTime time) {
- M_EraHandler.CheckDateTime(time);
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number as reference. It is set
- /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = 4;
- if (!M_EraHandler.ValidEra(era))
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the supported range.
- /// </exception>
- internal int M_CheckYEG(int year, ref int era) {
- M_CheckEra(ref era);
- return M_EraHandler.GregorianYear(year, era);
- }
-
- /// <summary>
- /// Checks whether the year is the era is valid, if era = CurrentEra
- /// the right value is set.
- /// </summary>
- /// <param name="year">The year to check.</param>
- /// <param name="era">The era to check.</Param>
- /// <exception cref="T:ArgumentOutOfRangeException">
- /// The exception will be thrown, if the year is not valid.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckYEG(year, ref era);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMEG(int year, int month, ref int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- return gregorianYear;
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMDEG(int year, int month, int day, ref int era)
- {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month, era));
- return gregorianYear;
- }
-
-
- /// <summary>
- /// Overridden. Adds days to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// days.
- /// </param>
- /// <param name="days">The number of days to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="days"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddDays(DateTime time, int days) {
- DateTime t = base.AddDays(time, days);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds hours to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// hours.
- /// </param>
- /// <param name="hours">The number of hours to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="hours"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddHours(DateTime time, int hours) {
- DateTime t = base.AddHours(time, hours);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds milliseconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// milliseconds.
- /// </param>
- /// <param name="milliseconds">The number of milliseconds given as
- /// double to add. Keep in mind the 100 nanosecond resolution of
- /// <see cref="T:System.DateTime"/>.
- /// </param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="milliseconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddMilliseconds(DateTime time,
- double milliseconds)
- {
- DateTime t = base.AddMilliseconds(time, milliseconds);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds minutes to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// minutes.
- /// </param>
- /// <param name="minutes">The number of minutes to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="minutes"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddMinutes(DateTime time, int minutes) {
- DateTime t = base.AddMinutes(time, minutes);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds seconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// seconds.
- /// </param>
- /// <param name="seconds">The number of seconds to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="seconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddSeconds(DateTime time, int seconds) {
- DateTime t = base.AddSeconds(time, seconds);
- M_CheckDateTime(t);
- return t;
- }
-
-
- /// <summary>
- /// Overridden. Adds weeks to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// weeks.
- /// </param>
- /// <param name="weeks">The number of weeks to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="weeks"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddWeeks(DateTime time, int weeks) {
- DateTime t = base.AddWeeks(time, weeks);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Gives the hour of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the hour of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetHour(DateTime time) {
- M_CheckDateTime(time);
- return base.GetHour(time);
- }
-
- /// <summary>
- /// Overridden. Gives the milliseconds in the current second
- /// of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the milliseconds in the seconds
- /// of the specified time, starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override double GetMilliseconds(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMilliseconds(time);
- }
-
- /// <summary>
- /// Overridden. Gives the minute of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the minute of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetMinute(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overridden. Gives the second of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the second of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetSecond(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overrideden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddMonths(DateTime time, int months) {
- DateTime t = CCGregorianCalendar.AddMonths(time, months);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddYears(DateTime time, int years) {
- DateTime t = CCGregorianCalendar.AddYears(time, years);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overriden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetDayOfMonth(DateTime time) {
- M_CheckDateTime(time);
- return CCGregorianCalendar.GetDayOfMonth(time);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetDayOfYear(DateTime time) {
- M_CheckDateTime(time);
- return CCGregorianCalendar.GetDayOfYear(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An integer that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> or <paramref name="era"/> are outside the
- /// allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.GetDaysInYear(gregorianYear);
- }
-
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetEra(DateTime time) {
- // M_CheckDateTime not needed, because EraYear does the
- // right thing.
- int rd = CCFixed.FromDateTime(time);
- int era;
- M_EraHandler.EraYear(out era, rd);
- return era;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetMonth(DateTime time) {
- M_CheckDateTime(time);
- return CCGregorianCalendar.GetMonth(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetYear(DateTime time) {
- // M_CheckDateTime not needed, because EraYeat does the
- // right thing.
- int rd = CCFixed.FromDateTime(time);
- int era;
- return M_EraHandler.EraYear(out era, rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYMEG(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.is_leap_year(gregorianYear);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- return CCGregorianCalendar.ToDateTime(
- gregorianYear, month, day,
- hour, minute, second, milliseconds);
- }
-
-
- /// <summary>
- /// This functions returns simply the year for the Japanese calendar.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <returns>The same argument as the year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the year is negative or the resulting
- /// year is invalid.
- /// </exception>
- public override int ToFourDigitYear(int year) {
- if (year < 0)
- throw new ArgumentOutOfRangeException(
- "year", "Non-negative number required.");
- int era = CurrentEra;
- M_CheckYE(year, ref era);
- return year;
- }
-} // class JapaneseCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/JulianCalendar.cs b/mcs/class/corlib/System.Globalization/JulianCalendar.cs
deleted file mode 100644
index 8d1c98f21c7..00000000000
--- a/mcs/class/corlib/System.Globalization/JulianCalendar.cs
+++ /dev/null
@@ -1,443 +0,0 @@
-// JulianCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-
-/// <summary>
-/// This is the Julian calendar.
-/// </summary>
-/// <remarks>
-/// <para>The Julian calendar supports only the Common Era from
-/// January 1, 1 (Gregorian) to December 31, 9999 (Gregorian).
-/// </para>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class JulianCalendar : Calendar {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public JulianCalendar() {
- M_AbbrEraNames = new string[] {"C.E."};
- M_EraNames = new string[] {"Common Era"};
- if (M_TwoDigitYearMax == 99)
- M_TwoDigitYearMax = 2029;
- }
-
- /// <summary>
- /// The era number for the Common Era (C.E.) or Anno Domini (A.D.)
- /// respective.
- /// </summary>
- public static readonly int JulianEra = 1;
-
- /// <value>Overridden. Gives the eras supported by the Julian
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return new int[] { JulianEra };
- }
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:JulianEra"/>.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = JulianEra;
- if (era != JulianEra)
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:JulianEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the allowed range.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckEra(ref era);
- M_ArgumentInRange("year", year, 1, 9999);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:JulianEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYME(int year, int month, ref int era) {
- M_CheckYE(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number.</param>
- /// <exception cref="T:System.ArgumentException">
- /// The exception is thrown if the era is not equal
- /// <see cref="M:JulianEra"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the allowed range.
- /// </exception>
- internal void M_CheckYMDE(int year, int month, int day, ref int era)
- {
- M_CheckYME(year, month, ref era);
- M_ArgumentInRange("day", day, 1,
- GetDaysInMonth(year, month, era));
- if (year == 9999 && ((month == 10 && day > 19) || month > 10))
- throw new ArgumentOutOfRangeException(
- "The maximum Julian date is 19. 10. 9999.");
- }
-
- /// <summary>
- /// Overridden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddMonths(DateTime time, int months) {
- int rd = CCFixed.FromDateTime(time);
- int day, month, year;
- CCJulianCalendar.dmy_from_fixed(
- out day, out month, out year, rd);
- month += months;
- rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
- DateTime t = CCFixed.ToDateTime(rd);
- return t.Add(time.TimeOfDay);
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddYears(DateTime time, int years) {
- int rd = CCFixed.FromDateTime(time);
- int day, month, year;
- CCJulianCalendar.dmy_from_fixed(
- out day, out month, out year, rd);
- year += years;
- rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
- DateTime t = CCFixed.ToDateTime(rd);
- return t.Add(time.TimeOfDay);
- }
-
- /// <summary>
- /// Overridden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override int GetDayOfMonth(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return CCJulianCalendar.day_from_fixed(rd);
- }
-
- /// <summary>
- /// Overridden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- public override int GetDayOfYear(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- int year = CCJulianCalendar.year_from_fixed(rd);
- int rd1_1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);
- return rd - rd1_1 + 1;
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An intger that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- int rd1 = CCJulianCalendar.fixed_from_dmy(1, month, year);
- int rd2 = CCJulianCalendar.fixed_from_dmy(1, month+1, year);
- return rd2 - rd1;
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> is outside the allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- M_CheckYE(year, ref era);
- int rd1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);
- int rd2 = CCJulianCalendar.fixed_from_dmy(1, 1, year+1);
- return rd2 - rd1;
- }
-
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- public override int GetEra(DateTime time) {
- // should change, if more than one era is supported
- return JulianEra;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- public override int GetMonth(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return CCJulianCalendar.month_from_fixed(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- public override int GetYear(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return CCJulianCalendar.year_from_fixed(rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- return IsLeapYear(year) && month == 2 && day == 29;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYME(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- M_CheckYE(year, ref era);
- return CCJulianCalendar.is_leap_year(year);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- M_CheckYMDE(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- int rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
- return CCFixed.ToDateTime(rd,
- hour, minute, second, milliseconds);
- }
-} // class JulianCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/KoreanCalendar.cs b/mcs/class/corlib/System.Globalization/KoreanCalendar.cs
deleted file mode 100644
index dd14c2a309a..00000000000
--- a/mcs/class/corlib/System.Globalization/KoreanCalendar.cs
+++ /dev/null
@@ -1,444 +0,0 @@
-// KoreanCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-
-/// <summary>
-/// This is the Korean calendar. It differs from the Gegorian calendar only
-/// in the year counting.
-/// </summary>
-/// <remarks>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class KoreanCalendar : Calendar {
- /// <summary>
- /// Static protected field storing the
- /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
- /// </summary>
- internal static readonly CCGregorianEraHandler M_EraHandler;
-
- /// <variable>
- /// The standard era for the <see cref="T:KoreanCalendar"/>.
- /// </variable>
- public const int KoreanEra = 1;
-
- /// <summary>
- /// Static constructor, who creates and initializes
- /// <see cref="F:M_EraHandler"/>.
- /// </summary>
- static KoreanCalendar() {
- M_EraHandler = new CCGregorianEraHandler();
- M_EraHandler.appendEra(KoreanEra,
- CCGregorianCalendar.fixed_from_dmy(1, 1, -2332));
- }
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public KoreanCalendar() {
- M_AbbrEraNames = new string[] {"K.C.E."};
- M_EraNames = new string[] {"Korean Current Era"};
- if (M_TwoDigitYearMax == 99)
- M_TwoDigitYearMax = 4362;
- }
-
- /// <value>Overridden. Gives the eras supported by the
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return (int[])M_EraHandler.Eras.Clone();
- }
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number as reference. It is set
- /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = KoreanEra;
- if (!M_EraHandler.ValidEra(era))
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the supported range.
- /// </exception>
- internal int M_CheckYEG(int year, ref int era) {
- M_CheckEra(ref era);
- return M_EraHandler.GregorianYear(year, era);
- }
-
- /// <summary>
- /// Checks whether the year is the era is valid, if era = CurrentEra
- /// the right value is set.
- /// </summary>
- /// <param name="year">The year to check.</param>
- /// <param name="era">The era to check.</Param>
- /// <exception cref="T:ArgumentOutOfRangeException">
- /// The exception will be thrown, if the year is not valid.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckYEG(year, ref era);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMEG(int year, int month, ref int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- return gregorianYear;
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMDEG(int year, int month, int day, ref int era)
- {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- M_ArgumentInRange("day", day, 1,
- GetDaysInMonth(year, month, era));
- return gregorianYear;
- }
-
- /// <summary>
- /// Overrideden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddMonths(DateTime time, int months) {
- return CCGregorianCalendar.AddMonths(time, months);
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddYears(DateTime time, int years) {
- return CCGregorianCalendar.AddYears(time, years);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override int GetDayOfMonth(DateTime time) {
- return CCGregorianCalendar.GetDayOfMonth(time);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- public override int GetDayOfYear(DateTime time) {
- return CCGregorianCalendar.GetDayOfYear(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An integer that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> or <paramref name="era"/> are outside the
- /// allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.GetDaysInYear(gregorianYear);
- }
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- public override int GetEra(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- int era;
- M_EraHandler.EraYear(out era, rd);
- return era;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- public override int GetMonth(DateTime time) {
- return CCGregorianCalendar.GetMonth(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYEG(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- public override int GetYear(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- int era;
- return M_EraHandler.EraYear(out era, rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYMEG(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.is_leap_year(gregorianYear);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- return CCGregorianCalendar.ToDateTime(gregorianYear,
- month, day, hour, minute, second, milliseconds);
- }
-} // class KoreanCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/Locale.cs b/mcs/class/corlib/System.Globalization/Locale.cs
deleted file mode 100755
index 539184dbde4..00000000000
--- a/mcs/class/corlib/System.Globalization/Locale.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// System.Globalization.Locale.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
-//
-
-namespace System.Globalization {
-
- internal class Locale {
-
- /// <summary>
- /// Returns the translated message for the current locale
- /// </summary>
- public static string GetText (string msg)
- {
- return msg;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
deleted file mode 100644
index 5e6b21c479d..00000000000
--- a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
+++ /dev/null
@@ -1,676 +0,0 @@
-//
-// System.Globalization.NumberFormatInfo.cs
-//
-// Author:
-// Derek Holden (dholden@draper.com)
-// Bob Smith (bob@thestuff.net)
-//
-// (C) Derek Holden
-// (C) Bob Smith http://www.thestuff.net
-//
-
-//
-// NumberFormatInfo. One can only assume it is the class gotten
-// back from a GetFormat() method from an IFormatProvider /
-// IFormattable implementer. There are some discrepencies with the
-// ECMA spec and the SDK docs, surprisingly. See my conversation
-// with myself on it at:
-// http://lists.ximian.com/archives/public/mono-list/2001-July/000794.html
-//
-// Other than that this is totally ECMA compliant.
-//
-
-namespace System.Globalization {
-
- [Serializable]
- public sealed class NumberFormatInfo : ICloneable, IFormatProvider {
- private bool readOnly;
-
- // Currency Related Format Info
- private int currencyDecimalDigits;
- private string currencyDecimalSeparator;
- private string currencyGroupSeparator;
- private int[] currencyGroupSizes;
- private int currencyNegativePattern;
- private int currencyPositivePattern;
- private string currencySymbol;
-
- private string naNSymbol;
- private string negativeInfinitySymbol;
- private string negativeSign;
-
- // Number Related Format Info
- private int numberDecimalDigits;
- private string numberDecimalSeparator;
- private string numberGroupSeparator;
- private int[] numberGroupSizes;
- private int numberNegativePattern;
-
- // Percent Related Format Info
- private int percentDecimalDigits;
- private string percentDecimalSeparator;
- private string percentGroupSeparator;
- private int[] percentGroupSizes;
- private int percentNegativePattern;
- private int percentPositivePattern;
- private string percentSymbol;
-
- private string perMilleSymbol;
- private string positiveInfinitySymbol;
- private string positiveSign;
-
- internal NumberFormatInfo (int lcid)
- {
- //FIXME: should add more LCID
- // CultureInfo uses this one also.
- if (lcid != 0x007F)
- lcid = 0x007F;
-
- switch (lcid){
-
- // The Invariant Culture Info ID.
- case 0x007f:
- readOnly = false;
-
- // Currency Related Format Info
- currencyDecimalDigits = 2;
- currencyDecimalSeparator = ".";
- currencyGroupSeparator = ",";
- currencyGroupSizes = new int[1] { 3 };
- currencyNegativePattern = 0;
- currencyPositivePattern = 0;
- currencySymbol = "$";
-
- naNSymbol = "NaN";
- negativeInfinitySymbol = "-Infinity";
- negativeSign = "-";
-
- // Number Related Format Info
- numberDecimalDigits = 2;
- numberDecimalSeparator = ".";
- numberGroupSeparator = ",";
- numberGroupSizes = new int[1] { 3 };
- numberNegativePattern = 1;
-
- // Percent Related Format Info
- percentDecimalDigits = 2;
- percentDecimalSeparator = ".";
- percentGroupSeparator = ",";
- percentGroupSizes = new int[1] { 3 };
- percentNegativePattern = 0;
- percentPositivePattern = 0;
- percentSymbol= "%";
-
- perMilleSymbol = "\u2030";
- positiveInfinitySymbol = "Infinity";
- positiveSign = "+";
- break;
- }
- }
-
- public NumberFormatInfo () : this (0x007f)
- {
- }
-
- // =========== Currency Format Properties =========== //
-
- public int CurrencyDecimalDigits {
- get {
- return currencyDecimalDigits;
- }
-
- set {
- if (value < 0 || value > 99)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 99");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- currencyDecimalDigits = value;
- }
- }
-
- public string CurrencyDecimalSeparator {
- get {
- return currencyDecimalSeparator;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- currencyDecimalSeparator = value;
- }
- }
-
-
- public string CurrencyGroupSeparator {
- get {
- return currencyGroupSeparator;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- currencyGroupSeparator = value;
- }
- }
-
- public int[] CurrencyGroupSizes {
- get {
- return currencyGroupSizes;
- }
-
- set {
- if (value == null || value.Length == 0)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- // All elements except last need to be in range 1 - 9, last can be 0.
- int last = value.Length - 1;
-
- for (int i = 0; i < last; i++)
- if (value[i] < 1 || value[i] > 9)
- throw new ArgumentOutOfRangeException
- ("One of the elements in the array specified is not between 1 and 9");
-
- if (value[last] < 0 || value[last] > 9)
- throw new ArgumentOutOfRangeException
- ("Last element in the array specified is not between 0 and 9");
-
- currencyGroupSizes = (int[]) value.Clone();
- }
- }
-
- public int CurrencyNegativePattern {
- get {
- // See ECMA NumberFormatInfo page 8
- return currencyNegativePattern;
- }
-
- set {
- if (value < 0 || value > 15)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 15");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- currencyNegativePattern = value;
- }
- }
-
- public int CurrencyPositivePattern {
- get {
- // See ECMA NumberFormatInfo page 11
- return currencyPositivePattern;
- }
-
- set {
- if (value < 0 || value > 3)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 3");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- currencyPositivePattern = value;
- }
- }
-
- public string CurrencySymbol {
- get {
- return currencySymbol;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- currencySymbol = value;
- }
- }
-
- // =========== Static Read-Only Properties =========== //
-
- public static NumberFormatInfo CurrentInfo {
- get {
- // This should be culture specific
- NumberFormatInfo nfi = new NumberFormatInfo ();
- nfi.readOnly = true;
- return nfi;
- }
- }
-
- public static NumberFormatInfo InvariantInfo {
- get {
- // This uses invariant info, which is same as in the constructor
- NumberFormatInfo nfi = new NumberFormatInfo ();
- nfi.NumberNegativePattern = 1;
- nfi.readOnly = true;
- return nfi;
- }
- }
-
- public bool IsReadOnly {
- get {
- return readOnly;
- }
- }
-
-
-
- public string NaNSymbol {
- get {
- return naNSymbol;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- naNSymbol = value;
- }
- }
-
- public string NegativeInfinitySymbol {
- get {
- return negativeInfinitySymbol;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- negativeInfinitySymbol = value;
- }
- }
-
- public string NegativeSign {
- get {
- return negativeSign;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- negativeSign = value;
- }
- }
-
- // =========== Number Format Properties =========== //
-
- public int NumberDecimalDigits {
- get {
- return numberDecimalDigits;
- }
-
- set {
- if (value < 0 || value > 99)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 99");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- numberDecimalDigits = value;
- }
- }
-
- public string NumberDecimalSeparator {
- get {
- return numberDecimalSeparator;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- numberDecimalSeparator = value;
- }
- }
-
-
- public string NumberGroupSeparator {
- get {
- return numberGroupSeparator;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- numberGroupSeparator = value;
- }
- }
-
- public int[] NumberGroupSizes {
- get {
- return numberGroupSizes;
- }
-
- set {
- if (value == null || value.Length == 0)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- // All elements except last need to be in range 1 - 9, last can be 0.
- int last = value.Length - 1;
-
- for (int i = 0; i < last; i++)
- if (value[i] < 1 || value[i] > 9)
- throw new ArgumentOutOfRangeException
- ("One of the elements in the array specified is not between 1 and 9");
-
- if (value[last] < 0 || value[last] > 9)
- throw new ArgumentOutOfRangeException
- ("Last element in the array specified is not between 0 and 9");
-
- numberGroupSizes = (int[]) value.Clone();
- }
- }
-
- public int NumberNegativePattern {
- get {
- // See ECMA NumberFormatInfo page 27
- return numberNegativePattern;
- }
-
- set {
- if (value < 0 || value > 4)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 15");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- numberNegativePattern = value;
- }
- }
-
- // =========== Percent Format Properties =========== //
-
- public int PercentDecimalDigits {
- get {
- return percentDecimalDigits;
- }
-
- set {
- if (value < 0 || value > 99)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 99");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- percentDecimalDigits = value;
- }
- }
-
- public string PercentDecimalSeparator {
- get {
- return percentDecimalSeparator;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- percentDecimalSeparator = value;
- }
- }
-
-
- public string PercentGroupSeparator {
- get {
- return percentGroupSeparator;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- percentGroupSeparator = value;
- }
- }
-
- public int[] PercentGroupSizes {
- get {
- return percentGroupSizes;
- }
-
- set {
- if (value == null || value.Length == 0)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- // All elements except last need to be in range 1 - 9, last can be 0.
- int last = value.Length - 1;
-
- for (int i = 0; i < last; i++)
- if (value[i] < 1 || value[i] > 9)
- throw new ArgumentOutOfRangeException
- ("One of the elements in the array specified is not between 1 and 9");
-
- if (value[last] < 0 || value[last] > 9)
- throw new ArgumentOutOfRangeException
- ("Last element in the array specified is not between 0 and 9");
-
- percentGroupSizes = (int[]) value.Clone();
- }
- }
-
- public int PercentNegativePattern {
- get {
- // See ECMA NumberFormatInfo page 8
- return percentNegativePattern;
- }
-
- set {
- if (value < 0 || value > 2)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 15");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- percentNegativePattern = value;
- }
- }
-
- public int PercentPositivePattern {
- get {
- // See ECMA NumberFormatInfo page 11
- return percentPositivePattern;
- }
-
- set {
- if (value < 0 || value > 2)
- throw new ArgumentOutOfRangeException
- ("The value specified for the property is less than 0 or greater than 3");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- percentPositivePattern = value;
- }
- }
-
- public string PercentSymbol {
- get {
- return percentSymbol;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- percentSymbol = value;
- }
- }
-
- public string PerMilleSymbol {
- get {
- return perMilleSymbol;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- perMilleSymbol = value;
- }
- }
-
- public string PositiveInfinitySymbol {
- get {
- return positiveInfinitySymbol;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- positiveInfinitySymbol = value;
- }
- }
-
- public string PositiveSign {
- get {
- return positiveSign;
- }
-
- set {
- if (value == null)
- throw new ArgumentNullException
- ("The value specified for the property is a null reference");
-
- if (readOnly)
- throw new InvalidOperationException
- ("The current instance is read-only and a set operation was attempted");
-
- positiveSign = value;
- }
- }
-
- public object GetFormat (Type formatType)
- {
- return (formatType == GetType()) ? this : null;
- }
-
- public object Clone ()
- {
- NumberFormatInfo clone = (NumberFormatInfo) MemberwiseClone();
- // clone is not read only
- clone.readOnly = false;
- return clone;
- }
-
- public static NumberFormatInfo ReadOnly (NumberFormatInfo nfi)
- {
- NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone();
- copy.readOnly = true;
- return copy;
- }
-
- public static NumberFormatInfo GetInstance(IFormatProvider provider)
- {
- if (provider != null) {
- NumberFormatInfo nfi;
- nfi = (NumberFormatInfo)provider.GetFormat(typeof(NumberFormatInfo));
- if (nfi != null)
- return nfi;
- }
-
- return CurrentInfo;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Globalization/NumberStyles.cs b/mcs/class/corlib/System.Globalization/NumberStyles.cs
deleted file mode 100644
index fbbccc86427..00000000000
--- a/mcs/class/corlib/System.Globalization/NumberStyles.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// System.Globalization.NumberStyles.cs
-//
-// Copyright (C) 2001 Michael Lambert, All Rights Reserved
-//
-// Author: Michael Lambert, michaellambert@email.com
-// Created: Thu 07/18/2001
-//
-// Modified: 7/20/01, Derek Holden (dholden@draper.com)
-// Added ECMA values for allows and masks for data types
-//
-//------------------------------------------------------------------------------
-
-namespace System.Globalization {
-
- [Flags]
- [Serializable]
- public enum NumberStyles {
- None = 0x00000000,
- AllowLeadingWhite = 0x00000001,
- AllowTrailingWhite = 0x00000002,
- AllowLeadingSign = 0x00000004,
- AllowTrailingSign = 0x00000008,
- AllowParentheses = 0x00000010,
- AllowDecimalPoint = 0x00000020,
- AllowThousands = 0x00000040,
- AllowExponent = 0x00000080,
- AllowCurrencySymbol = 0x00000100,
- AllowHexSpecifier = 0x00000200,
-
- Integer = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign ),
- HexNumber = ( AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier ),
- Number = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
- AllowTrailingSign | AllowDecimalPoint | AllowThousands ),
- Float = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
- AllowDecimalPoint | AllowExponent ),
- Currency = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
- AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
- AllowThousands | AllowCurrencySymbol ),
- Any = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
- AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
- AllowThousands | AllowExponent | AllowCurrencySymbol ),
- }
-
-} // Namespace
diff --git a/mcs/class/corlib/System.Globalization/RegionInfo.cs b/mcs/class/corlib/System.Globalization/RegionInfo.cs
deleted file mode 100644
index c5b21ab4451..00000000000
--- a/mcs/class/corlib/System.Globalization/RegionInfo.cs
+++ /dev/null
@@ -1,1689 +0,0 @@
-using System.Globalization;
-
-namespace System.Globalization {
-
- [Serializable]
- public class RegionInfo {
- int NLS_id;
-
- public RegionInfo (int culture) {
-
- if (CultureInfo.IsIDNeutralCulture (culture))
- throw new ArgumentException ("Culture ID " + culture
- + " (0x" + culture.ToString ("X4")
- + ") is a neutral culture. A region can not be created from it.");
-
- switch (culture) {
- case 0x0401: // ar-SA Arabic (Saudi Arabia)
- NLS_id = 682;
- break;
- case 0x0801: // ar-IQ Arabic (Iraq)
- NLS_id = 368;
- break;
- case 0x0C01: // ar-EG Arabic (Egypt)
- NLS_id = 818;
- break;
- case 0x1001: // ar-LY Arabic (Libya)
- NLS_id = 434;
- break;
- case 0x1401: // ar-DZ Arabic (Algeria)
- NLS_id = 12;
- break;
- case 0x1801: // ar-MA Arabic (Morocco)
- NLS_id = 504;
- break;
- case 0x1C01: // ar-TN Arabic (Tunisia)
- NLS_id = 788;
- break;
- case 0x2001: // ar-OM Arabic (Oman)
- NLS_id = 512;
- break;
- case 0x2401: // ar-YE Arabic (Yemen)
- NLS_id = 887;
- break;
- case 0x2801: // ar-SY Arabic (Syria)
- NLS_id = 760;
- break;
- case 0x2C01: // ar-JO Arabic (Jordan)
- NLS_id = 400;
- break;
- case 0x3001: // ar-LB Arabic (Lebanon)
- NLS_id = 422;
- break;
- case 0x3401: // ar-KW Arabic (Kuwait)
- NLS_id = 414;
- break;
- case 0x3801: // ar-AE Arabic (U.A.E.)
- NLS_id = 784;
- break;
- case 0x3C01: // ar-BH Arabic (Bahrain)
- NLS_id = 48;
- break;
- case 0x4001: // ar-QA Arabic (Qatar)
- NLS_id = 634;
- break;
- case 0x0402: // bg-BG Bulgarian (Bulgaria)
- NLS_id = 100;
- break;
- case 0x0403: // ca-ES Catalan (Spain)
- NLS_id = 724;
- break;
- case 0x0404: // zh-TW Chinese (Taiwan)
- NLS_id = 158;
- break;
- case 0x0804: // zh-CN Chinese (People's Republic of China)
- NLS_id = 156;
- break;
- case 0x0C04: // zh-HK Chinese (Hong Kong S.A.R.)
- NLS_id = 344;
- break;
- case 0x1004: // zh-SG Chinese (Singapore)
- NLS_id = 702;
- break;
- case 0x1404: // zh-MO Chinese (Macau S.A.R.)
- NLS_id = 446;
- break;
- case 0x0405: // cs-CZ Czech (Czech Republic)
- NLS_id = 203;
- break;
- case 0x0406: // da-DK Danish (Denmark)
- NLS_id = 208;
- break;
- case 0x0407: // de-DE German (Germany)
- NLS_id = 276;
- break;
- case 0x0807: // de-CH German (Switzerland)
- NLS_id = 756;
- break;
- case 0x0C07: // de-AT German (Austria)
- NLS_id = 40;
- break;
- case 0x1007: // de-LU German (Luxembourg)
- NLS_id = 442;
- break;
- case 0x1407: // de-LI German (Liechtenstein)
- NLS_id = 438;
- break;
- case 0x0408: // el-GR Greek (Greece)
- NLS_id = 300;
- break;
- case 0x0409: // en-US English (United States)
- NLS_id = 840;
- break;
- case 0x0809: // en-GB English (United Kingdom)
- NLS_id = 826;
- break;
- case 0x0C09: // en-AU English (Australia)
- NLS_id = 36;
- break;
- case 0x1009: // en-CA English (Canada)
- NLS_id = 124;
- break;
- case 0x1409: // en-NZ English (New Zealand)
- NLS_id = 554;
- break;
- case 0x1809: // en-IE English (Ireland)
- NLS_id = 372;
- break;
- case 0x1C09: // en-ZA English (South Africa)
- NLS_id = 710;
- break;
- case 0x2009: // en-JM English (Jamaica)
- NLS_id = 388;
- break;
- case 0x2809: // en-BZ English (Belize)
- NLS_id = 84;
- break;
- case 0x2C09: // en-TT English (Trinidad and Tobago)
- NLS_id = 780;
- break;
- case 0x3009: // en-ZW English (Zimbabwe)
- NLS_id = 716;
- break;
- case 0x3409: // en-PH English (Republic of the Philippines)
- NLS_id = 608;
- break;
- case 0x080A: // es-MX Spanish (Mexico)
- NLS_id = 484;
- break;
- case 0x0C0A: // es-ES Spanish (Spain)
- NLS_id = 724;
- break;
- case 0x100A: // es-GT Spanish (Guatemala)
- NLS_id = 320;
- break;
- case 0x140A: // es-CR Spanish (Costa Rica)
- NLS_id = 188;
- break;
- case 0x180A: // es-PA Spanish (Panama)
- NLS_id = 591;
- break;
- case 0x1C0A: // es-DO Spanish (Dominican Republic)
- NLS_id = 214;
- break;
- case 0x200A: // es-VE Spanish (Venezuela)
- NLS_id = 862;
- break;
- case 0x240A: // es-CO Spanish (Colombia)
- NLS_id = 170;
- break;
- case 0x280A: // es-PE Spanish (Peru)
- NLS_id = 604;
- break;
- case 0x2C0A: // es-AR Spanish (Argentina)
- NLS_id = 32;
- break;
- case 0x300A: // es-EC Spanish (Ecuador)
- NLS_id = 218;
- break;
- case 0x340A: // es-CL Spanish (Chile)
- NLS_id = 152;
- break;
- case 0x380A: // es-UY Spanish (Uruguay)
- NLS_id = 858;
- break;
- case 0x3C0A: // es-PY Spanish (Paraguay)
- NLS_id = 600;
- break;
- case 0x400A: // es-BO Spanish (Bolivia)
- NLS_id = 68;
- break;
- case 0x440A: // es-SV Spanish (El Salvador)
- NLS_id = 222;
- break;
- case 0x480A: // es-HN Spanish (Honduras)
- NLS_id = 340;
- break;
- case 0x4C0A: // es-NI Spanish (Nicaragua)
- NLS_id = 558;
- break;
- case 0x500A: // es-PR Spanish (Puerto Rico)
- NLS_id = 630;
- break;
- case 0x040B: // fi-FI Finnish (Finland)
- NLS_id = 246;
- break;
- case 0x040C: // fr-FR French (France)
- NLS_id = 250;
- break;
- case 0x080C: // fr-BE French (Belgium)
- NLS_id = 56;
- break;
- case 0x0C0C: // fr-CA French (Canada)
- NLS_id = 124;
- break;
- case 0x100C: // fr-CH French (Switzerland)
- NLS_id = 756;
- break;
- case 0x140C: // fr-LU French (Luxembourg)
- NLS_id = 442;
- break;
- case 0x180C: // fr-MC French (Principality of Monaco)
- NLS_id = 492;
- break;
- case 0x040D: // he-IL Hebrew (Israel)
- NLS_id = 376;
- break;
- case 0x040E: // hu-HU Hungarian (Hungary)
- NLS_id = 348;
- break;
- case 0x040F: // is-IS Icelandic (Iceland)
- NLS_id = 352;
- break;
- case 0x0410: // it-IT Italian (Italy)
- NLS_id = 380;
- break;
- case 0x0810: // it-CH Italian (Switzerland)
- NLS_id = 756;
- break;
- case 0x0411: // ja-JP Japanese (Japan)
- NLS_id = 392;
- break;
- case 0x0412: // ko-KR Korean (Korea)
- NLS_id = 410;
- break;
- case 0x0413: // nl-NL Dutch (Netherlands)
- NLS_id = 528;
- break;
- case 0x0813: // nl-BE Dutch (Belgium)
- NLS_id = 56;
- break;
- case 0x0414: // nb-NO Norwegian (Bokm†l) (Norway)
- NLS_id = 578;
- break;
- case 0x0814: // nn-NO Norwegian (Nynorsk) (Norway)
- NLS_id = 578;
- break;
- case 0x0415: // pl-PL Polish (Poland)
- NLS_id = 616;
- break;
- case 0x0416: // pt-BR Portuguese (Brazil)
- NLS_id = 76;
- break;
- case 0x0816: // pt-PT Portuguese (Portugal)
- NLS_id = 620;
- break;
- case 0x0418: // ro-RO Romanian (Romania)
- NLS_id = 642;
- break;
- case 0x0419: // ru-RU Russian (Russia)
- NLS_id = 643;
- break;
- case 0x041A: // hr-HR Croatian (Croatia)
- NLS_id = 191;
- break;
- case 0x041B: // sk-SK Slovak (Slovakia)
- NLS_id = 703;
- break;
- case 0x041C: // sq-AL Albanian (Albania)
- NLS_id = 8;
- break;
- case 0x041D: // sv-SE Swedish (Sweden)
- NLS_id = 752;
- break;
- case 0x081D: // sv-FI Swedish (Finland)
- NLS_id = 246;
- break;
- case 0x041E: // th-TH Thai (Thailand)
- NLS_id = 764;
- break;
- case 0x041F: // tr-TR Turkish (Turkey)
- NLS_id = 792;
- break;
- case 0x0420: // ur-PK Urdu (Islamic Republic of Pakistan)
- NLS_id = 586;
- break;
- case 0x0421: // id-ID Indonesian (Indonesia)
- NLS_id = 360;
- break;
- case 0x0422: // uk-UA Ukrainian (Ukraine)
- NLS_id = 804;
- break;
- case 0x0423: // be-BY Belarusian (Belarus)
- NLS_id = 112;
- break;
- case 0x0424: // sl-SI Slovenian (Slovenia)
- NLS_id = 705;
- break;
- case 0x0425: // et-EE Estonian (Estonia)
- NLS_id = 233;
- break;
- case 0x0426: // lv-LV Latvian (Latvia)
- NLS_id = 428;
- break;
- case 0x0427: // lt-LT Lithuanian (Lithuania)
- NLS_id = 440;
- break;
- case 0x0429: // fa-IR Farsi (Iran)
- NLS_id = 364;
- break;
- case 0x042A: // vi-VN Vietnamese (Viet Nam)
- NLS_id = 704;
- break;
- case 0x042B: // hy-AM Armenian (Armenia)
- NLS_id = 51;
- break;
- case 0x042C: // Lt-az-AZ Azeri (Latin) (Azerbaijan)
- NLS_id = 31;
- break;
- case 0x082C: // Cy-az-AZ Azeri (Cyrillic) (Azerbaijan)
- NLS_id = 31;
- break;
- case 0x042D: // eu-ES Basque (Spain)
- NLS_id = 724;
- break;
- case 0x042F: // mk-MK FYRO Macedonian (Former Yugoslav Republic of Macedonia)
- NLS_id = 807;
- break;
- case 0x0436: // af-ZA Afrikaans (South Africa)
- NLS_id = 710;
- break;
- case 0x0437: // ka-GE Georgian (Georgia)
- NLS_id = 268;
- break;
- case 0x0438: // fo-FO Faeroese (Faeroe Islands)
- NLS_id = 234;
- break;
- case 0x0439: // hi-IN Hindi (India)
- NLS_id = 356;
- break;
- case 0x043E: // ms-MY Malay (Malaysia)
- NLS_id = 458;
- break;
- case 0x083E: // ms-BN Malay (Brunei Darussalam)
- NLS_id = 96;
- break;
- case 0x043F: // kk-KZ Kazakh (Kazakhstan)
- NLS_id = 398;
- break;
- case 0x0440: // ky-KZ Kyrgyz (Kyrgyzstan)
- NLS_id = 398;
- break;
- case 0x0441: // sw-KE Swahili (Kenya)
- NLS_id = 404;
- break;
- case 0x0443: // Lt-uz-UZ Uzbek (Latin) (Uzbekistan)
- NLS_id = 860;
- break;
- case 0x0843: // Cy-uz-UZ Uzbek (Cyrillic) (Uzbekistan)
- NLS_id = 860;
- break;
- case 0x0446: // pa-IN Punjabi (India)
- NLS_id = 356;
- break;
- case 0x0447: // gu-IN Gujarati (India)
- NLS_id = 356;
- break;
- case 0x0449: // ta-IN Tamil (India)
- NLS_id = 356;
- break;
- case 0x044A: // te-IN Telugu (India)
- NLS_id = 356;
- break;
- case 0x044B: // kn-IN Kannada (India)
- NLS_id = 356;
- break;
- case 0x044E: // mr-IN Marathi (India)
- NLS_id = 356;
- break;
- case 0x044F: // sa-IN Sanskrit (India)
- NLS_id = 356;
- break;
- case 0x0450: // mn-MN Mongolian (Mongolia)
- NLS_id = 496;
- break;
- case 0x0456: // gl-ES Galician (Spain)
- NLS_id = 724;
- break;
- case 0x0457: // kok-IN Konkani (India)
- NLS_id = 356;
- break;
- case 0x045A: // syr-SY Syriac (Syria)
- NLS_id = 760;
- break;
- case 0x0465: // div-MV Divehi (Maldives)
- NLS_id = 462;
- break;
- case 0x007F: // Invariant Language (Invariant Country)
- throw new ArgumentException ("There is no region associated with the Invariant Culture (Culture ID: 0x7F).");
- default:
- throw new ArgumentException ("Culture ID " + culture + " (0x" + culture.ToString ("X4")
- + ") is not a supported culture.");
- }
- }
-
- public RegionInfo (string name) {
- switch (name.ToUpper ()) {
- case "AF": // Afghanistan
- NLS_id = 004;
- break;
- case "AL": // Albania
- NLS_id = 008;
- break;
- case "DZ": // Algeria
- NLS_id = 012;
- break;
- case "AS": // American Samoa
- NLS_id = 016;
- break;
- case "AD": // Andorra
- NLS_id = 020;
- break;
- case "AO": // Angola
- NLS_id = 024;
- break;
- case "AI": // Anguilla
- NLS_id = 660;
- break;
- case "AQ": // Antarctica
- NLS_id = 010;
- break;
- case "AG": // Antigua and Barbuda
- NLS_id = 028;
- break;
- case "AR": // Argentina
- NLS_id = 032;
- break;
- case "AM": // Armenia
- NLS_id = 051;
- break;
- case "AW": // Aruba
- NLS_id = 533;
- break;
- case "AU": // Australia
- NLS_id = 036;
- break;
- case "AT": // Austria
- NLS_id = 040;
- break;
- case "AZ": // Azerbaijan
- NLS_id = 031;
- break;
- case "BS": // Bahamas
- NLS_id = 044;
- break;
- case "BH": // Bahrain
- NLS_id = 048;
- break;
- case "BD": // Bangladesh
- NLS_id = 050;
- break;
- case "BB": // Barbados
- NLS_id = 052;
- break;
- case "BY": // Belarus
- NLS_id = 112;
- break;
- case "BE": // Belgium
- NLS_id = 056;
- break;
- case "BZ": // Belize
- NLS_id = 084;
- break;
- case "BJ": // Benin
- NLS_id = 204;
- break;
- case "BM": // Bermuda
- NLS_id = 060;
- break;
- case "BT": // Bhutan
- NLS_id = 064;
- break;
- case "BO": // Bolivia
- NLS_id = 068;
- break;
- case "BA": // Bosnia and Herzegowina
- NLS_id = 070;
- break;
- case "BW": // Botswana
- NLS_id = 072;
- break;
- case "BV": // Bouvet Island
- NLS_id = 074;
- break;
- case "BR": // Brazil
- NLS_id = 076;
- break;
- case "IO": // British Indian Ocean Territory
- NLS_id = 086;
- break;
- case "BN": // Brunei Darussalam
- NLS_id = 096;
- break;
- case "BG": // Bulgaria
- NLS_id = 100;
- break;
- case "BF": // Burkina Faso
- NLS_id = 854;
- break;
- case "BI": // Burundi
- NLS_id = 108;
- break;
- case "KH": // Cambodia
- NLS_id = 116;
- break;
- case "CM": // Cameroon
- NLS_id = 120;
- break;
- case "CA": // Canada
- NLS_id = 124;
- break;
- case "CV": // Cape Verde
- NLS_id = 132;
- break;
- case "KY": // Cayman Islands
- NLS_id = 136;
- break;
- case "CF": // Central African Republic
- NLS_id = 140;
- break;
- case "TD": // Chad
- NLS_id = 148;
- break;
- case "CL": // Chile
- NLS_id = 152;
- break;
- case "CN": // China
- NLS_id = 156;
- break;
- case "CX": // Christmas Island
- NLS_id = 162;
- break;
- case "CC": // Cocos (Keeling) Islands
- NLS_id = 166;
- break;
- case "CO": // Colombia
- NLS_id = 170;
- break;
- case "KM": // Comoros
- NLS_id = 174;
- break;
- case "CG": // Congo
- NLS_id = 178;
- break;
- case "CK": // Cook Islands
- NLS_id = 184;
- break;
- case "CR": // Costa Rica
- NLS_id = 188;
- break;
- case "CI": // Cote D'Ivoire
- NLS_id = 384;
- break;
- case "HR": // Croatia (Local Name: Hrvatska)
- NLS_id = 191;
- break;
- case "CU": // Cuba
- NLS_id = 192;
- break;
- case "CY": // Cyprus
- NLS_id = 196;
- break;
- case "CZ": // Czech Republic
- NLS_id = 203;
- break;
- case "DK": // Denmark
- NLS_id = 208;
- break;
- case "DJ": // Djibouti
- NLS_id = 262;
- break;
- case "DM": // Dominica
- NLS_id = 212;
- break;
- case "DO": // Dominican Republic
- NLS_id = 214;
- break;
- case "TP": // East Timor
- NLS_id = 626;
- break;
- case "EC": // Ecuador
- NLS_id = 218;
- break;
- case "EG": // Egypt
- NLS_id = 818;
- break;
- case "SV": // El Salvador
- NLS_id = 222;
- break;
- case "GQ": // Equatorial Guinea
- NLS_id = 226;
- break;
- case "ER": // Eritrea
- NLS_id = 232;
- break;
- case "EE": // Estonia
- NLS_id = 233;
- break;
- case "ET": // Ethiopia
- NLS_id = 231;
- break;
- case "FK": // Falkland Islands (Malvinas)
- NLS_id = 238;
- break;
- case "FO": // Faroe Islands
- NLS_id = 234;
- break;
- case "FJ": // Fiji
- NLS_id = 242;
- break;
- case "FI": // Finland
- NLS_id = 246;
- break;
- case "FR": // France
- NLS_id = 250;
- break;
- case "FX": // France, Metropolitan
- NLS_id = 249;
- break;
- case "GF": // French Guiana
- NLS_id = 254;
- break;
- case "PF": // French Polynesia
- NLS_id = 258;
- break;
- case "TF": // French Southern Territories
- NLS_id = 260;
- break;
- case "GA": // Gabon
- NLS_id = 266;
- break;
- case "GM": // Gambia
- NLS_id = 270;
- break;
- case "GE": // Georgia
- NLS_id = 268;
- break;
- case "DE": // Germany
- NLS_id = 276;
- break;
- case "GH": // Ghana
- NLS_id = 288;
- break;
- case "GI": // Gibraltar
- NLS_id = 292;
- break;
- case "GR": // Greece
- NLS_id = 300;
- break;
- case "GL": // Greenland
- NLS_id = 304;
- break;
- case "GD": // Grenada
- NLS_id = 308;
- break;
- case "GP": // Guadeloupe
- NLS_id = 312;
- break;
- case "GU": // Guam
- NLS_id = 316;
- break;
- case "GT": // Guatemala
- NLS_id = 320;
- break;
- case "GN": // Guinea
- NLS_id = 324;
- break;
- case "GW": // Guinea-Bissau
- NLS_id = 624;
- break;
- case "GY": // Guyana
- NLS_id = 328;
- break;
- case "HT": // Haiti
- NLS_id = 332;
- break;
- case "HM": // Heard and Mc Donald Islands
- NLS_id = 334;
- break;
- case "VA": // Holy See (Vatican City State)
- NLS_id = 336;
- break;
- case "HN": // Honduras
- NLS_id = 340;
- break;
- case "HK": // Hong Kong
- NLS_id = 344;
- break;
- case "HU": // Hungary
- NLS_id = 348;
- break;
- case "IS": // Iceland
- NLS_id = 352;
- break;
- case "IN": // India
- NLS_id = 356;
- break;
- case "ID": // Indonesia
- NLS_id = 360;
- break;
- case "IR": // Iran (Islamic Republic of)
- NLS_id = 364;
- break;
- case "IQ": // Iraq
- NLS_id = 368;
- break;
- case "IE": // Ireland
- NLS_id = 372;
- break;
- case "IL": // Israel
- NLS_id = 376;
- break;
- case "IT": // Italy
- NLS_id = 380;
- break;
- case "JM": // Jamaica
- NLS_id = 388;
- break;
- case "JP": // Japan
- NLS_id = 392;
- break;
- case "JO": // Jordan
- NLS_id = 400;
- break;
- case "KZ": // Kazakhstan
- NLS_id = 398;
- break;
- case "KE": // Kenya
- NLS_id = 404;
- break;
- case "KI": // Kiribati
- NLS_id = 296;
- break;
- case "KP": // Korea, Democratic People's Republic of
- NLS_id = 408;
- break;
- case "KR": // Korea, Republic of
- NLS_id = 410;
- break;
- case "KW": // Kuwait
- NLS_id = 414;
- break;
- case "KG": // Kyrgyzstan
- NLS_id = 417;
- break;
- case "LA": // Lao People's Democratic Republic
- NLS_id = 418;
- break;
- case "LV": // Latvia
- NLS_id = 428;
- break;
- case "LB": // Lebanon
- NLS_id = 422;
- break;
- case "LS": // Lesotho
- NLS_id = 426;
- break;
- case "LR": // Liberia
- NLS_id = 430;
- break;
- case "LY": // Libyan Arab Jamahiriya
- NLS_id = 434;
- break;
- case "LI": // Liechtenstein
- NLS_id = 438;
- break;
- case "LT": // Lithuania
- NLS_id = 440;
- break;
- case "LU": // Luxembourg
- NLS_id = 442;
- break;
- case "MO": // Macau
- NLS_id = 446;
- break;
- case "MK": // Macedonia, The Former Yugoslav Republic of
- NLS_id = 807;
- break;
- case "MG": // Madagascar
- NLS_id = 450;
- break;
- case "MW": // Malawi
- NLS_id = 454;
- break;
- case "MY": // Malaysia
- NLS_id = 458;
- break;
- case "MV": // Maldives
- NLS_id = 462;
- break;
- case "ML": // Mali
- NLS_id = 466;
- break;
- case "MT": // Malta
- NLS_id = 470;
- break;
- case "MH": // Marshall Islands
- NLS_id = 584;
- break;
- case "MQ": // Martinique
- NLS_id = 474;
- break;
- case "MR": // Mauritania
- NLS_id = 478;
- break;
- case "MU": // Mauritius
- NLS_id = 480;
- break;
- case "YT": // Mayotte
- NLS_id = 175;
- break;
- case "MX": // Mexico
- NLS_id = 484;
- break;
- case "FM": // Micronesia, Federated States of
- NLS_id = 583;
- break;
- case "MD": // Moldova, Republic of
- NLS_id = 498;
- break;
- case "MC": // Monaco
- NLS_id = 492;
- break;
- case "MN": // Mongolia
- NLS_id = 496;
- break;
- case "MS": // Montserrat
- NLS_id = 500;
- break;
- case "MA": // Morocco
- NLS_id = 504;
- break;
- case "MZ": // Mozambique
- NLS_id = 508;
- break;
- case "MM": // Myanmar
- NLS_id = 104;
- break;
- case "NA": // Namibia
- NLS_id = 516;
- break;
- case "NR": // Nauru
- NLS_id = 520;
- break;
- case "NP": // Nepal
- NLS_id = 524;
- break;
- case "NL": // Netherlands
- NLS_id = 528;
- break;
- case "AN": // Netherlands Antilles
- NLS_id = 530;
- break;
- case "NC": // New Caledonia
- NLS_id = 540;
- break;
- case "NZ": // New Zealand
- NLS_id = 554;
- break;
- case "NI": // Nicaragua
- NLS_id = 558;
- break;
- case "NE": // Niger
- NLS_id = 562;
- break;
- case "NG": // Nigeria
- NLS_id = 566;
- break;
- case "NU": // Niue
- NLS_id = 570;
- break;
- case "NF": // Norfolk Island
- NLS_id = 574;
- break;
- case "MP": // Northern Mariana Islands
- NLS_id = 580;
- break;
- case "NO": // Norway
- NLS_id = 578;
- break;
- case "OM": // Oman
- NLS_id = 512;
- break;
- case "PK": // Pakistan
- NLS_id = 586;
- break;
- case "PW": // Palau
- NLS_id = 585;
- break;
- case "PA": // Panama
- NLS_id = 591;
- break;
- case "PG": // Papua New Guinea
- NLS_id = 598;
- break;
- case "PY": // Paraguay
- NLS_id = 600;
- break;
- case "PE": // Peru
- NLS_id = 604;
- break;
- case "PH": // Philippines
- NLS_id = 608;
- break;
- case "PN": // Pitcairn
- NLS_id = 612;
- break;
- case "PL": // Poland
- NLS_id = 616;
- break;
- case "PT": // Portugal
- NLS_id = 620;
- break;
- case "PR": // Puerto Rico
- NLS_id = 630;
- break;
- case "QA": // Qatar
- NLS_id = 634;
- break;
- case "RE": // Reunion
- NLS_id = 638;
- break;
- case "RO": // Romania
- NLS_id = 642;
- break;
- case "RU": // Russian Federation
- NLS_id = 643;
- break;
- case "RW": // Rwanda
- NLS_id = 646;
- break;
- case "KN": // Saint Kitts and Nevis
- NLS_id = 659;
- break;
- case "LC": // Saint Lucia
- NLS_id = 662;
- break;
- case "VC": // Saint Vincent and The Grenadines
- NLS_id = 670;
- break;
- case "WS": // Samoa
- NLS_id = 882;
- break;
- case "SM": // San Marino
- NLS_id = 674;
- break;
- case "ST": // Sao Tome and Principe
- NLS_id = 678;
- break;
- case "SA": // Saudi Arabia
- NLS_id = 682;
- break;
- case "SN": // Senegal
- NLS_id = 686;
- break;
- case "SC": // Seychelles
- NLS_id = 690;
- break;
- case "SL": // Sierra Leone
- NLS_id = 694;
- break;
- case "SG": // Singapore
- NLS_id = 702;
- break;
- case "SK": // Slovakia (Slovak Republic)
- NLS_id = 703;
- break;
- case "SI": // Slovenia
- NLS_id = 705;
- break;
- case "SB": // Solomon Islands
- NLS_id = 090;
- break;
- case "SO": // Somalia
- NLS_id = 706;
- break;
- case "ZA": // South Africa
- NLS_id = 710;
- break;
- case "GS": // South Georgia and The South Sandwich Islands
- NLS_id = 239;
- break;
- case "ES": // Spain
- NLS_id = 724;
- break;
- case "LK": // Sri Lanka
- NLS_id = 144;
- break;
- case "SH": // St. Helena
- NLS_id = 654;
- break;
- case "PM": // St. Pierre and Miquelon
- NLS_id = 666;
- break;
- case "SD": // Sudan
- NLS_id = 736;
- break;
- case "SR": // Suriname
- NLS_id = 740;
- break;
- case "SJ": // Svalbard and Jan Mayen Islands
- NLS_id = 744;
- break;
- case "SZ": // Swaziland
- NLS_id = 748;
- break;
- case "SE": // Sweden
- NLS_id = 752;
- break;
- case "CH": // Switzerland
- NLS_id = 756;
- break;
- case "SY": // Syrian Arab Republic
- NLS_id = 760;
- break;
- case "TW": // Taiwan, Province of China
- NLS_id = 158;
- break;
- case "TJ": // Tajikistan
- NLS_id = 762;
- break;
- case "TZ": // Tanzania, United Republic of
- NLS_id = 834;
- break;
- case "TH": // Thailand
- NLS_id = 764;
- break;
- case "TG": // Togo
- NLS_id = 768;
- break;
- case "TK": // Tokelau
- NLS_id = 772;
- break;
- case "TO": // Tonga
- NLS_id = 776;
- break;
- case "TT": // Trinidad and Tobago
- NLS_id = 780;
- break;
- case "TN": // Tunisia
- NLS_id = 788;
- break;
- case "TR": // Turkey
- NLS_id = 792;
- break;
- case "TM": // Turkmenistan
- NLS_id = 795;
- break;
- case "TC": // Turks and Caicos Islands
- NLS_id = 796;
- break;
- case "TV": // Tuvalu
- NLS_id = 798;
- break;
- case "UG": // Uganda
- NLS_id = 800;
- break;
- case "UA": // Ukraine
- NLS_id = 804;
- break;
- case "AE": // United Arab Emirates
- NLS_id = 784;
- break;
- case "GB": // United Kingdom
- NLS_id = 826;
- break;
- case "US": // United States
- NLS_id = 840;
- break;
- case "UM": // United States Minor Outlying Islands
- NLS_id = 581;
- break;
- case "UY": // Uruguay
- NLS_id = 858;
- break;
- case "UZ": // Uzbekistan
- NLS_id = 860;
- break;
- case "VU": // Vanuatu
- NLS_id = 548;
- break;
- case "VE": // Venezuela
- NLS_id = 862;
- break;
- case "VN": // Viet Nam
- NLS_id = 704;
- break;
- case "VG": // Virgin Islands (British)
- NLS_id = 092;
- break;
- case "VI": // Virgin Islands (U.S.)
- NLS_id = 850;
- break;
- case "WF": // Wallis and Futuna Islands
- NLS_id = 876;
- break;
- case "EH": // Western Sahara
- NLS_id = 732;
- break;
- case "YE": // Yemen
- NLS_id = 887;
- break;
- case "YU": // Yugoslavia
- NLS_id = 891;
- break;
- case "ZR": // Zaire
- NLS_id = 180;
- break;
- case "ZM": // Zambia
- NLS_id = 894;
- break;
- case "ZW": // Zimbabwe
- NLS_id = 716;
- break;
- default:
- throw new ArgumentException ("Region name " + name + " is not supported.");
- }
- }
-
- public virtual string CurrencySymbol {
- get {
- switch (NLS_id) {
- default:
- throw new Exception ("Dunno what is currency symbol for " + NLS_id + " Region. FIXME.");
- }
- }
- }
-
- [MonoTODO]
- public static RegionInfo CurrentRegion {
- get {
- return null;
- }
- }
-
- public virtual string DisplayName {
- get {
- switch (NLS_id) {
- case 203: // Czech republic
- return "Èeská republika";
- case 840: // United States
- return "United States";
- default:
- throw new Exception ("FIXME. Please add your region name in language used in this region.");
- }
- }
- }
-
- public virtual string EnglishName {
- get {
- switch (NLS_id) {
- case 004:
- return "Afghanistan";
- case 008:
- return "Albania";
- case 012:
- return "Algeria";
- case 016:
- return "American Samoa";
- case 020:
- return "Andorra";
- case 024:
- return "Angola";
- case 660:
- return "Anguilla";
- case 010:
- return "Antarctica";
- case 028:
- return "Antigua and Barbuda";
- case 032:
- return "Argentina";
- case 051:
- return "Armenia";
- case 533:
- return "Aruba";
- case 036:
- return "Australia";
- case 040:
- return "Austria";
- case 031:
- return "Azerbaijan";
- case 044:
- return "Bahamas";
- case 048:
- return "Bahrain";
- case 050:
- return "Bangladesh";
- case 052:
- return "Barbados";
- case 112:
- return "Belarus";
- case 056:
- return "Belgium";
- case 084:
- return "Belize";
- case 204:
- return "Benin";
- case 060:
- return "Bermuda";
- case 064:
- return "Bhutan";
- case 068:
- return "Bolivia";
- case 070:
- return "Bosnia and Herzegowina";
- case 072:
- return "Botswana";
- case 074:
- return "Bouvet Island";
- case 076:
- return "Brazil";
- case 086:
- return "British Indian Ocean Territory";
- case 096:
- return "Brunei Darussalam";
- case 100:
- return "Bulgaria";
- case 854:
- return "Burkina Faso";
- case 108:
- return "Burundi";
- case 116:
- return "Cambodia";
- case 120:
- return "Cameroon";
- case 124:
- return "Canada";
- case 132:
- return "Cape Verde";
- case 136:
- return "Cayman Islands";
- case 140:
- return "Central African Republic";
- case 148:
- return "Chad";
- case 152:
- return "Chile";
- case 156:
- return "China";
- case 162:
- return "Christmas Island";
- case 166:
- return "Cocos (Keeling) Islands";
- case 170:
- return "Colombia";
- case 174:
- return "Comoros";
- case 178:
- return "Congo";
- case 184:
- return "Cook Islands";
- case 188:
- return "Costa Rica";
- case 384:
- return "Cote D'Ivoire";
- case 191:
- return "Croatia (Local Name: Hrvatska)";
- case 192:
- return "Cuba";
- case 196:
- return "Cyprus";
- case 203:
- return "Czech Republic";
- case 208:
- return "Denmark";
- case 262:
- return "Djibouti";
- case 212:
- return "Dominica";
- case 214:
- return "Dominican Republic";
- case 626:
- return "East Timor";
- case 218:
- return "Ecuador";
- case 818:
- return "Egypt";
- case 222:
- return "El Salvador";
- case 226:
- return "Equatorial Guinea";
- case 232:
- return "Eritrea";
- case 233:
- return "Estonia";
- case 231:
- return "Ethiopia";
- case 238:
- return "Falkland Islands (Malvinas)";
- case 234:
- return "Faroe Islands";
- case 242:
- return "Fiji";
- case 246:
- return "Finland";
- case 250:
- return "France";
- case 249:
- return "France, Metropolitan";
- case 254:
- return "French Guiana";
- case 258:
- return "French Polynesia";
- case 260:
- return "French Southern Territories";
- case 266:
- return "Gabon";
- case 270:
- return "Gambia";
- case 268:
- return "Georgia";
- case 276:
- return "Germany";
- case 288:
- return "Ghana";
- case 292:
- return "Gibraltar";
- case 300:
- return "Greece";
- case 304:
- return "Greenland";
- case 308:
- return "Grenada";
- case 312:
- return "Guadeloupe";
- case 316:
- return "Guam";
- case 320:
- return "Guatemala";
- case 324:
- return "Guinea";
- case 624:
- return "Guinea-Bissau";
- case 328:
- return "Guyana";
- case 332:
- return "Haiti";
- case 334:
- return "Heard and Mc Donald Islands";
- case 336:
- return "Holy See (Vatican City State)";
- case 340:
- return "Honduras";
- case 344:
- return "Hong Kong";
- case 348:
- return "Hungary";
- case 352:
- return "Iceland";
- case 356:
- return "India";
- case 360:
- return "Indonesia";
- case 364:
- return "Iran (Islamic Republic of)";
- case 368:
- return "Iraq";
- case 372:
- return "Ireland";
- case 376:
- return "Israel";
- case 380:
- return "Italy";
- case 388:
- return "Jamaica";
- case 392:
- return "Japan";
- case 400:
- return "Jordan";
- case 398:
- return "Kazakhstan";
- case 404:
- return "Kenya";
- case 296:
- return "Kiribati";
- case 408:
- return "Korea, Democratic People's Republic of";
- case 410:
- return "Korea, Republic of";
- case 414:
- return "Kuwait";
- case 417:
- return "Kyrgyzstan";
- case 418:
- return "Lao People's Democratic Republic";
- case 428:
- return "Latvia";
- case 422:
- return "Lebanon";
- case 426:
- return "Lesotho";
- case 430:
- return "Liberia";
- case 434:
- return "Libyan Arab Jamahiriya";
- case 438:
- return "Liechtenstein";
- case 440:
- return "Lithuania";
- case 442:
- return "Luxembourg";
- case 446:
- return "Macau";
- case 807:
- return "Macedonia, The Former Yugoslav Republic of";
- case 450:
- return "Madagascar";
- case 454:
- return "Malawi";
- case 458:
- return "Malaysia";
- case 462:
- return "Maldives";
- case 466:
- return "Mali";
- case 470:
- return "Malta";
- case 584:
- return "Marshall Islands";
- case 474:
- return "Martinique";
- case 478:
- return "Mauritania";
- case 480:
- return "Mauritius";
- case 175:
- return "Mayotte";
- case 484:
- return "Mexico";
- case 583:
- return "Micronesia, Federated States of";
- case 498:
- return "Moldova, Republic of";
- case 492:
- return "Monaco";
- case 496:
- return "Mongolia";
- case 500:
- return "Montserrat";
- case 504:
- return "Morocco";
- case 508:
- return "Mozambique";
- case 104:
- return "Myanmar";
- case 516:
- return "Namibia";
- case 520:
- return "Nauru";
- case 524:
- return "Nepal";
- case 528:
- return "Netherlands";
- case 530:
- return "Netherlands Antilles";
- case 540:
- return "New Caledonia";
- case 554:
- return "New Zealand";
- case 558:
- return "Nicaragua";
- case 562:
- return "Niger";
- case 566:
- return "Nigeria";
- case 570:
- return "Niue";
- case 574:
- return "Norfolk Island";
- case 580:
- return "Northern Mariana Islands";
- case 578:
- return "Norway";
- case 512:
- return "Oman";
- case 586:
- return "Pakistan";
- case 585:
- return "Palau";
- case 591:
- return "Panama";
- case 598:
- return "Papua New Guinea";
- case 600:
- return "Paraguay";
- case 604:
- return "Peru";
- case 608:
- return "Philippines";
- case 612:
- return "Pitcairn";
- case 616:
- return "Poland";
- case 620:
- return "Portugal";
- case 630:
- return "Puerto Rico";
- case 634:
- return "Qatar";
- case 638:
- return "Reunion";
- case 642:
- return "Romania";
- case 643:
- return "Russian Federation";
- case 646:
- return "Rwanda";
- case 659:
- return "Saint Kitts and Nevis";
- case 662:
- return "Saint Lucia";
- case 670:
- return "Saint Vincent and The Grenadines";
- case 882:
- return "Samoa";
- case 674:
- return "San Marino";
- case 678:
- return "Sao Tome and Principe";
- case 682:
- return "Saudi Arabia";
- case 686:
- return "Senegal";
- case 690:
- return "Seychelles";
- case 694:
- return "Sierra Leone";
- case 702:
- return "Singapore";
- case 703:
- return "Slovakia (Slovak Republic)";
- case 705:
- return "Slovenia";
- case 090:
- return "Solomon Islands";
- case 706:
- return "Somalia";
- case 710:
- return "South Africa";
- case 239:
- return "South Georgia and The South Sandwich Islands";
- case 724:
- return "Spain";
- case 144:
- return "Sri Lanka";
- case 654:
- return "St. Helena";
- case 666:
- return "St. Pierre and Miquelon";
- case 736:
- return "Sudan";
- case 740:
- return "Suriname";
- case 744:
- return "Svalbard and Jan Mayen Islands";
- case 748:
- return "Swaziland";
- case 752:
- return "Sweden";
- case 756:
- return "Switzerland";
- case 760:
- return "Syrian Arab Republic";
- case 158:
- return "Taiwan, Province of China";
- case 762:
- return "Tajikistan";
- case 834:
- return "Tanzania, United Republic of";
- case 764:
- return "Thailand";
- case 768:
- return "Togo";
- case 772:
- return "Tokelau";
- case 776:
- return "Tonga";
- case 780:
- return "Trinidad and Tobago";
- case 788:
- return "Tunisia";
- case 792:
- return "Turkey";
- case 795:
- return "Turkmenistan";
- case 796:
- return "Turks and Caicos Islands";
- case 798:
- return "Tuvalu";
- case 800:
- return "Uganda";
- case 804:
- return "Ukraine";
- case 784:
- return "United Arab Emirates";
- case 826:
- return "United Kingdom";
- case 840:
- return "United States";
- case 581:
- return "United States Minor Outlying Islands";
- case 858:
- return "Uruguay";
- case 860:
- return "Uzbekistan";
- case 548:
- return "Vanuatu";
- case 862:
- return "Venezuela";
- case 704:
- return "Viet Nam";
- case 092:
- return "Virgin Islands (British)";
- case 850:
- return "Virgin Islands (U.S.)";
- case 876:
- return "Wallis and Futuna Islands";
- case 732:
- return "Western Sahara";
- case 887:
- return "Yemen";
- case 891:
- return "Yugoslavia";
- case 180:
- return "Zaire";
- case 894:
- return "Zambia";
- case 716:
- return "Zimbabwe";
- default:
- throw new Exception ("This code should not be reached.");
- }
- }
- }
-
- public virtual bool IsMetric {
- get {
- switch (NLS_id) {
- case 203: // Czech Republic
- return true;
- case 840: // United States
- return false;
- default:
- throw new Exception ("FIXME. Please define.");
- }
- }
- }
-
- public virtual string ISOCurrencySymbol {
- get {
- switch (NLS_id) {
- default:
- throw new Exception ("This code should not be reached.");
- }
- }
- }
-
- //
- // methods
-
- public override bool Equals(object value) {
- return value == this;
- }
-
- public override int GetHashCode () {
- return NLS_id.GetHashCode ();
- }
- }
-
-}
diff --git a/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs b/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs
deleted file mode 100644
index f744e2bd0b0..00000000000
--- a/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs
+++ /dev/null
@@ -1,745 +0,0 @@
-// TaiwanCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-
-/// <summary>
-/// This is the Japanese calendar. It differs from the Gregorian calendar
-/// only in the years.
-/// </summary>
-/// <remarks>
-/// <para>The Japanese calendar support a single era starting at January 1,
-/// 1912</para>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class TaiwanCalendar : Calendar {
- /// <summary>
- /// Static protected field storing the
- /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
- /// </summary>
- internal static readonly CCGregorianEraHandler M_EraHandler;
-
- /// <summary>
- /// Static constructor, who creates and initializes
- /// <see cref="F:M_EraHandler"/>.
- /// </summary>
- static TaiwanCalendar() {
- M_EraHandler = new CCGregorianEraHandler();
- M_EraHandler.appendEra(1,
- CCGregorianCalendar.fixed_from_dmy(1, 1, 1912));
- }
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public TaiwanCalendar() {
- M_AbbrEraNames = new string[] {"T.C.E."};
- M_EraNames = new string[] {"Taiwan current era"};
- }
-
- /// <value>Overridden. Gives the eras supported by the
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return (int[])M_EraHandler.Eras.Clone();
- }
- }
-
- /// <summary>
- /// A protected member checking a
- /// <see cref="T:System.DateTime"/> value.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/>
- /// to check.
- /// </param>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- internal void M_CheckDateTime(DateTime time) {
- M_EraHandler.CheckDateTime(time);
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number as reference. It is set
- /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = 1;
- if (!M_EraHandler.ValidEra(era))
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the supported range.
- /// </exception>
- internal int M_CheckYEG(int year, ref int era) {
- M_CheckEra(ref era);
- return M_EraHandler.GregorianYear(year, era);
- }
-
- /// <summary>
- /// Checks whether the year is the era is valid, if era = CurrentEra
- /// the right value is set.
- /// </summary>
- /// <param name="year">The year to check.</param>
- /// <param name="era">The era to check.</Param>
- /// <exception cref="T:ArgumentOutOfRangeException">
- /// The exception will be thrown, if the year is not valid.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckYEG(year, ref era);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMEG(int year, int month, ref int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- return gregorianYear;
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMDEG(int year, int month, int day, ref int era)
- {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- M_ArgumentInRange("day", day, 1,
- GetDaysInMonth(year, month, era));
- return gregorianYear;
- }
-
- /// <summary>
- /// Overridden. Adds days to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// days.
- /// </param>
- /// <param name="days">The number of days to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="days"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddDays(DateTime time, int days) {
- DateTime t = base.AddDays(time, days);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds hours to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// hours.
- /// </param>
- /// <param name="hours">The number of hours to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="hours"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddHours(DateTime time, int hours) {
- DateTime t = base.AddHours(time, hours);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds milliseconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// milliseconds.
- /// </param>
- /// <param name="milliseconds">The number of milliseconds given as
- /// double to add. Keep in mind the 100 nanosecond resolution of
- /// <see cref="T:System.DateTime"/>.
- /// </param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="milliseconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddMilliseconds(DateTime time,
- double milliseconds)
- {
- DateTime t = base.AddMilliseconds(time, milliseconds);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds minutes to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// minutes.
- /// </param>
- /// <param name="minutes">The number of minutes to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="minutes"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddMinutes(DateTime time, int minutes) {
- DateTime t = base.AddMinutes(time, minutes);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds seconds to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// seconds.
- /// </param>
- /// <param name="seconds">The number of seconds to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="seconds"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddSeconds(DateTime time, int seconds) {
- DateTime t = base.AddSeconds(time, seconds);
- M_CheckDateTime(t);
- return t;
- }
-
-
- /// <summary>
- /// Overridden. Adds weeks to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// weeks.
- /// </param>
- /// <param name="weeks">The number of weeks to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="weeks"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddWeeks(DateTime time, int weeks) {
- DateTime t = base.AddWeeks(time, weeks);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Gives the hour of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the hour of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetHour(DateTime time) {
- M_CheckDateTime(time);
- return base.GetHour(time);
- }
-
- /// <summary>
- /// Overridden. Gives the milliseconds in the current second
- /// of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the milliseconds in the seconds
- /// of the specified time, starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override double GetMilliseconds(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMilliseconds(time);
- }
-
- /// <summary>
- /// Overridden. Gives the minute of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the minute of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetMinute(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overridden. Gives the second of the specified time.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies the
- /// time.
- /// </param>
- /// <returns>An integer that gives the second of the specified time,
- /// starting with 0.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetSecond(DateTime time) {
- M_CheckDateTime(time);
- return base.GetMinute(time);
- }
-
- /// <summary>
- /// Overrideden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddMonths(DateTime time, int months) {
- DateTime t = CCGregorianCalendar.AddMonths(time, months);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if
- /// <see cref="T:System.DateTime"/> return value is outside all
- /// supported eras.
- /// </exception>
- public override DateTime AddYears(DateTime time, int years) {
- DateTime t = CCGregorianCalendar.AddYears(time, years);
- M_CheckDateTime(t);
- return t;
- }
-
- /// <summary>
- /// Overriden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetDayOfMonth(DateTime time) {
- M_CheckDateTime(time);
- return CCGregorianCalendar.GetDayOfMonth(time);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- M_CheckDateTime(time);
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetDayOfYear(DateTime time) {
- M_CheckDateTime(time);
- return CCGregorianCalendar.GetDayOfYear(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An integer that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> or <paramref name="era"/> are outside the
- /// allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.GetDaysInYear(gregorianYear);
- }
-
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetEra(DateTime time) {
- // M_CheckDateTime not needed, because EraYear does the
- // right thing.
- int rd = CCFixed.FromDateTime(time);
- int era;
- M_EraHandler.EraYear(out era, rd);
- return era;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetMonth(DateTime time) {
- M_CheckDateTime(time);
- return CCGregorianCalendar.GetMonth(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYEG(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the
- /// <see cref="T:System.DateTime"/> parameter is outside all
- /// supported eras.
- /// </exception>
- public override int GetYear(DateTime time) {
- // M_CheckDateTime not needed, because EraYeat does the
- // right thing.
- int rd = CCFixed.FromDateTime(time);
- int era;
- return M_EraHandler.EraYear(out era, rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYMEG(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.is_leap_year(gregorianYear);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- return CCGregorianCalendar.ToDateTime(
- gregorianYear, month, day,
- hour, minute, second, milliseconds);
- }
-
- /// <summary>
- /// This functions returns simply the year for the Taiwan calendar.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <returns>The same argument as the year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the year is negative or the resulting
- /// year is invalid.
- /// </exception>
- public override int ToFourDigitYear(int year) {
- if (year < 0)
- throw new ArgumentOutOfRangeException(
- "year", "Non-negative number required.");
- int era = CurrentEra;
- M_CheckYE(year, ref era);
- return year;
- }
-} // class TaiwanCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs b/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs
deleted file mode 100644
index e6a5cc5dff7..00000000000
--- a/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs
+++ /dev/null
@@ -1,445 +0,0 @@
-// ThaiBuddhistCalendar.cs
-//
-// (C) Ulrich Kunitz 2002
-//
-
-namespace System.Globalization {
-
-using System;
-
-/// <summary>
-/// This is the ThaiBudhist calendar. It differs from the Gegorian calendar
-/// only in the year counting.
-/// </summary>
-/// <remarks>
-/// <para>The implementation uses the
-/// <see cref="N:CalendricalCalculations"/> namespace.
-/// </para>
-/// </remarks>
-[Serializable]
-public class ThaiBuddhistCalendar : Calendar {
- /// <summary>
- /// Static protected field storing the
- /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
- /// </summary>
- internal static readonly CCGregorianEraHandler M_EraHandler;
-
- /// <value>
- /// The standard era for this calendar.
- /// </value>
- public const int ThaiBuddhistEra = 1;
-
- /// <summary>
- /// Static constructor, who creates and initializes
- /// <see cref="F:M_EraHandler"/>.
- /// </summary>
- static ThaiBuddhistCalendar() {
- M_EraHandler = new CCGregorianEraHandler();
- M_EraHandler.appendEra(ThaiBuddhistEra,
- CCGregorianCalendar.fixed_from_dmy(1, 1, -542));
- }
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public ThaiBuddhistCalendar() {
- M_AbbrEraNames = new string[] {"T.B.C.E."};
- M_EraNames = new string[] {"ThaiBuddhist current era"};
- if (M_TwoDigitYearMax == 99)
- M_TwoDigitYearMax = 2572;
- }
-
- /// <value>Overridden. Gives the eras supported by the
- /// calendar as an array of integers.
- /// </value>
- public override int[] Eras {
- get {
- return (int[])M_EraHandler.Eras.Clone();
- }
- }
-
- /// <summary>
- /// A protected method checking the era number.
- /// </summary>
- /// <param name="era">The era number as reference. It is set
- /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- internal void M_CheckEra(ref int era) {
- if (era == CurrentEra)
- era = ThaiBuddhistEra;
- if (!M_EraHandler.ValidEra(era))
- throw new ArgumentException("Era value was not valid.");
- }
-
- /// <summary>
- /// A protected method checking calendar year and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year is outside of
- /// the supported range.
- /// </exception>
- internal int M_CheckYEG(int year, ref int era) {
- M_CheckEra(ref era);
- return M_EraHandler.GregorianYear(year, era);
- }
-
- /// <summary>
- /// Checks whether the year is the era is valid, if era = CurrentEra
- /// the right value is set.
- /// </summary>
- /// <param name="year">The year to check.</param>
- /// <param name="era">The era to check.</Param>
- /// <exception cref="T:ArgumentOutOfRangeException">
- /// The exception will be thrown, if the year is not valid.
- /// </exception>
- internal override void M_CheckYE(int year, ref int era) {
- M_CheckYEG(year, ref era);
- }
-
- /// <summary>
- /// A protected method checking the calendar year, month, and
- /// era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year or month is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMEG(int year, int month, ref int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- if (month < 1 || month > 12)
- throw new ArgumentOutOfRangeException("month",
- "Month must be between one and twelve.");
- return gregorianYear;
- }
-
- /// <summary>
- /// A protected method checking the calendar day, month, and year
- /// and the era number.
- /// </summary>
- /// <param name="year">An integer representing the calendar year.
- /// </param>
- /// <param name="month">An integer giving the calendar month.
- /// </param>
- /// <param name="day">An integer giving the calendar day.
- /// </param>
- /// <param name="era">The era number as reference.</param>
- /// <exception name="T:System.ArgumentException">
- /// The exception is thrown if the era is not supported by the class.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown if the calendar year, month, or day is
- /// outside of the supported range.
- /// </exception>
- internal int M_CheckYMDEG(int year, int month, int day, ref int era)
- {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- M_ArgumentInRange("day", day, 1,
- GetDaysInMonth(year, month, era));
- return gregorianYear;
- }
-
- /// <summary>
- /// Overrideden. Adds months to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// months.
- /// </param>
- /// <param name="months">The number of months to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="months"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddMonths(DateTime time, int months) {
- return CCGregorianCalendar.AddMonths(time, months);
- }
-
- /// <summary>
- /// Overridden. Adds years to a given date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> to which to add
- /// years.
- /// </param>
- /// <param name="years">The number of years to add.</param>
- /// <returns>A new <see cref="T:System.DateTime"/> value, that
- /// results from adding <paramref name="years"/> to the specified
- /// DateTime.</returns>
- public override DateTime AddYears(DateTime time, int years) {
- return CCGregorianCalendar.AddYears(time, years);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the month from
- /// <paramref name="time"/>.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override int GetDayOfMonth(DateTime time) {
- return CCGregorianCalendar.GetDayOfMonth(time);
- }
-
- /// <summary>
- /// Overriden. Gets the day of the week from the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer giving the day of months, starting with 1.
- /// </returns>
- public override DayOfWeek GetDayOfWeek(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- return (DayOfWeek)CCFixed.day_of_week(rd);
- }
-
- /// <summary>
- /// Overridden. Gives the number of the day in the year.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the day of the year,
- /// starting with 1.</returns>
- public override int GetDayOfYear(DateTime time) {
- return CCGregorianCalendar.GetDayOfYear(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days in the specified month
- /// of the given year and era.
- /// </summary>
- /// <param name="year">An integer that gives the year.
- /// </param>
- /// <param name="month">An integer that gives the month, starting
- /// with 1.</param>
- /// <param name="era">An integer that gives the era of the specified
- /// year.</param>
- /// <returns>An integer that gives the number of days of the
- /// specified month.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if <paramref name="month"/>,
- /// <paramref name="year"/> ,or <paramref name="era"/> is outside
- /// the allowed range.
- /// </exception>
- public override int GetDaysInMonth(int year, int month, int era) {
- int gregorianYear = M_CheckYMEG(year, month, ref era);
- return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
- }
-
- /// <summary>
- /// Overridden. Gives the number of days of the specified
- /// year of the given era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An ineger that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of days of the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
- /// The exception is thrown, if
- /// <paramref name="year"/> or <paramref name="era"/> are outside the
- /// allowed range.
- /// </exception>
- public override int GetDaysInYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.GetDaysInYear(gregorianYear);
- }
-
- /// <summary>
- /// Overridden. Gives the era of the specified date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the era of the calendar.
- /// </returns>
- public override int GetEra(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- int era;
- M_EraHandler.EraYear(out era, rd);
- return era;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the month of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the month,
- /// starting with 1.</returns>
- public override int GetMonth(DateTime time) {
- return CCGregorianCalendar.GetMonth(time);
- }
-
- /// <summary>
- /// Overridden. Gives the number of months in the specified year
- /// and era.
- /// </summary>
- /// <param name="year">An integer that specifies the year.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>An integer that gives the number of the months in the
- /// specified year.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or the era are not valid.
- /// </exception>
- public override int GetMonthsInYear(int year, int era) {
- M_CheckYE(year, ref era);
- return 12;
- }
-
- /// <summary>
- /// Overridden. Gives the number of the year of the specified
- /// date.
- /// </summary>
- /// <param name="time">The
- /// <see cref="T:System.DateTime"/> that specifies a
- /// date.
- /// </param>
- /// <returns>An integer representing the year,
- /// starting with 1.</returns>
- public override int GetYear(DateTime time) {
- int rd = CCFixed.FromDateTime(time);
- int era;
- return M_EraHandler.EraYear(out era, rd);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given day
- /// is a leap day.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given day is a leap
- /// day.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, day, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
- }
-
- /// <summary>
- /// Overridden. Tells whether the given month
- /// is a leap month.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given month is a leap
- /// month.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year, month, or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapMonth(int year, int month, int era) {
- M_CheckYMEG(year, month, ref era);
- return false;
- }
-
- /// <summary>
- /// Overridden. Tells whether the given year
- /// is a leap year.
- /// </summary>
- /// <param name="year">An integer that specifies the year in the
- /// given era.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A boolean that tells whether the given year is a leap
- /// year.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if the year or era is not
- /// valid.
- /// </exception>
- public override bool IsLeapYear(int year, int era) {
- int gregorianYear = M_CheckYEG(year, ref era);
- return CCGregorianCalendar.is_leap_year(gregorianYear);
- }
-
- /// <summary>
- /// Overridden. Creates the
- /// <see cref="T:System.DateTime"/> from the parameters.
- /// </summary>
- /// <param name="year">An integer that gives the year in the
- /// <paramref name="era"/>.
- /// </param>
- /// <param name="month">An integer that specifies the month.
- /// </param>
- /// <param name="day">An integer that specifies the day.
- /// </param>
- /// <param name="hour">An integer that specifies the hour.
- /// </param>
- /// <param name="minute">An integer that specifies the minute.
- /// </param>
- /// <param name="second">An integer that gives the second.
- /// </param>
- /// <param name="milliseconds">An integer that gives the
- /// milliseconds.
- /// </param>
- /// <param name="era">An integer that specifies the era.
- /// </param>
- /// <returns>A
- /// <see cref="T:system.DateTime"/> representig the date and time.
- /// </returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// The exception is thrown, if at least one of the parameters
- /// is out of range.
- /// </exception>
- public override DateTime ToDateTime(int year, int month, int day,
- int hour, int minute, int second, int milliseconds,
- int era)
- {
- int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
- return CCGregorianCalendar.ToDateTime(
- gregorianYear, month, day,
- hour, minute, second, milliseconds);
- }
-} // class ThaiBuddhistCalendar
-
-} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/UnicodeCategory.cs b/mcs/class/corlib/System.Globalization/UnicodeCategory.cs
deleted file mode 100644
index 2db258b3743..00000000000
--- a/mcs/class/corlib/System.Globalization/UnicodeCategory.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// System.Globalization.UnicodeCategory.cs
-//
-// Author:
-// Joe Shaw (joe@ximian.com)
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-//
-
-namespace System.Globalization {
-
- public enum UnicodeCategory {
- UppercaseLetter = 0,
- LowercaseLetter = 1,
- TitlecaseLetter = 2,
- ModifierLetter = 3,
- OtherLetter = 4,
- NonSpacingMark = 5,
- SpacingCombiningMark = 6,
- EnclosingMark = 7,
- DecimalDigitNumber = 8,
- LetterNumber = 9,
- OtherNumber = 10,
- SpaceSeparator = 11,
- LineSeparator = 12,
- ParagraphSeparator = 13,
- Control = 14,
- Format = 15,
- Surrogate = 16,
- PrivateUse = 17,
- ConnectorPunctuation = 18,
- DashPunctuation = 19,
- OpenPunctuation = 20,
- ClosePunctuation = 21,
- InitialQuotePunctuation = 22,
- FinalQuotePunctuation = 23,
- OtherPunctuation = 24,
- MathSymbol = 25,
- CurrencySymbol = 26,
- ModifierSymbol = 27,
- OtherSymbol = 28,
- OtherNotAssigned = 29,
- }
-} \ No newline at end of file