(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / corlib / System.Globalization / TaiwanCalendar.cs
blob939ed774c94eab2d6c553dff76119396a5598341
1 // TaiwanCalendar.cs
2 //
3 // (C) Ulrich Kunitz 2002
4 //
6 //
7 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 namespace System.Globalization {
31 using System;
33 /// <summary>
34 /// This is the Japanese calendar. It differs from the Gregorian calendar
35 /// only in the years.
36 /// </summary>
37 /// <remarks>
38 /// <para>The Japanese calendar support a single era starting at January 1,
39 /// 1912</para>
40 /// <para>The implementation uses the
41 /// <see cref="N:CalendricalCalculations"/> namespace.
42 /// </para>
43 /// </remarks>
44 [Serializable]
45 [MonoTODO ("Fix serialization compatibility with MS.NET")]
46 public class TaiwanCalendar : Calendar {
47 /// <summary>
48 /// Static protected field storing the
49 /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
50 /// </summary>
51 internal static readonly CCGregorianEraHandler M_EraHandler;
53 /// <summary>
54 /// Static constructor, who creates and initializes
55 /// <see cref="F:M_EraHandler"/>.
56 /// </summary>
57 static TaiwanCalendar() {
58 M_EraHandler = new CCGregorianEraHandler();
59 M_EraHandler.appendEra(1,
60 CCGregorianCalendar.fixed_from_dmy(1, 1, 1912));
63 /// <summary>
64 /// Default constructor.
65 /// </summary>
66 public TaiwanCalendar() {
67 M_AbbrEraNames = new string[] {"T.C.E."};
68 M_EraNames = new string[] {"Taiwan current era"};
71 /// <value>Overridden. Gives the eras supported by the
72 /// calendar as an array of integers.
73 /// </value>
74 public override int[] Eras {
75 get {
76 return (int[])M_EraHandler.Eras.Clone();
80 int twoDigitYearMax = 99;
82 public override int TwoDigitYearMax
84 get {
85 return twoDigitYearMax;
87 set {
88 M_ArgumentInRange ("value", value, 100, M_MaxYear);
90 twoDigitYearMax = value;
94 /// <summary>
95 /// A protected member checking a
96 /// <see cref="T:System.DateTime"/> value.
97 /// </summary>
98 /// <param name="time">The
99 /// <see cref="T:System.DateTime"/>
100 /// to check.
101 /// </param>
102 /// <exception cref="T:System.ArgumentOutOfRangeException">
103 /// The exception is thrown if the
104 /// <see cref="T:System.DateTime"/> parameter is outside all
105 /// supported eras.
106 /// </exception>
107 internal void M_CheckDateTime(DateTime time) {
108 M_EraHandler.CheckDateTime(time);
111 /// <summary>
112 /// A protected method checking the era number.
113 /// </summary>
114 /// <param name="era">The era number as reference. It is set
115 /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
116 /// <exception name="T:System.ArgumentException">
117 /// The exception is thrown if the era is not supported by the class.
118 /// </exception>
119 internal void M_CheckEra(ref int era) {
120 if (era == CurrentEra)
121 era = 1;
122 if (!M_EraHandler.ValidEra(era))
123 throw new ArgumentException("Era value was not valid.");
126 /// <summary>
127 /// A protected method checking calendar year and the era number.
128 /// </summary>
129 /// <param name="year">An integer representing the calendar year.
130 /// </param>
131 /// <param name="era">The era number as reference.</param>
132 /// <exception name="T:System.ArgumentException">
133 /// The exception is thrown if the era is not supported by the class.
134 /// </exception>
135 /// <exception cref="T:System.ArgumentOutOfRangeException">
136 /// The exception is thrown if the calendar year is outside of
137 /// the supported range.
138 /// </exception>
139 internal int M_CheckYEG(int year, ref int era) {
140 M_CheckEra(ref era);
141 return M_EraHandler.GregorianYear(year, era);
144 /// <summary>
145 /// Checks whether the year is the era is valid, if era = CurrentEra
146 /// the right value is set.
147 /// </summary>
148 /// <param name="year">The year to check.</param>
149 /// <param name="era">The era to check.</Param>
150 /// <exception cref="T:ArgumentOutOfRangeException">
151 /// The exception will be thrown, if the year is not valid.
152 /// </exception>
153 internal override void M_CheckYE(int year, ref int era) {
154 M_CheckYEG(year, ref era);
157 /// <summary>
158 /// A protected method checking the calendar year, month, and
159 /// era number.
160 /// </summary>
161 /// <param name="year">An integer representing the calendar year.
162 /// </param>
163 /// <param name="month">An integer giving the calendar month.
164 /// </param>
165 /// <param name="era">The era number as reference.</param>
166 /// <exception name="T:System.ArgumentException">
167 /// The exception is thrown if the era is not supported by the class.
168 /// </exception>
169 /// <exception cref="T:System.ArgumentOutOfRangeException">
170 /// The exception is thrown if the calendar year or month is
171 /// outside of the supported range.
172 /// </exception>
173 internal int M_CheckYMEG(int year, int month, ref int era) {
174 int gregorianYear = M_CheckYEG(year, ref era);
175 if (month < 1 || month > 12)
176 throw new ArgumentOutOfRangeException("month",
177 "Month must be between one and twelve.");
178 return gregorianYear;
181 /// <summary>
182 /// A protected method checking the calendar day, month, and year
183 /// and the era number.
184 /// </summary>
185 /// <param name="year">An integer representing the calendar year.
186 /// </param>
187 /// <param name="month">An integer giving the calendar month.
188 /// </param>
189 /// <param name="day">An integer giving the calendar day.
190 /// </param>
191 /// <param name="era">The era number as reference.</param>
192 /// <exception name="T:System.ArgumentException">
193 /// The exception is thrown if the era is not supported by the class.
194 /// </exception>
195 /// <exception cref="T:System.ArgumentOutOfRangeException">
196 /// The exception is thrown if the calendar year, month, or day is
197 /// outside of the supported range.
198 /// </exception>
199 internal int M_CheckYMDEG(int year, int month, int day, ref int era)
201 int gregorianYear = M_CheckYMEG(year, month, ref era);
202 M_ArgumentInRange("day", day, 1,
203 GetDaysInMonth(year, month, era));
204 return gregorianYear;
207 #if false
209 // Ifdefed out because this is not on the .NET Framework
211 /// <summary>
212 /// Overridden. Adds days to a given date.
213 /// </summary>
214 /// <param name="time">The
215 /// <see cref="T:System.DateTime"/> to which to add
216 /// days.
217 /// </param>
218 /// <param name="days">The number of days to add.</param>
219 /// <returns>A new <see cref="T:System.DateTime"/> value, that
220 /// results from adding <paramref name="days"/> to the specified
221 /// DateTime.</returns>
222 /// <exception cref="T:System.ArgumentOutOfRangeException">
223 /// The exception is thrown if the
224 /// <see cref="T:System.DateTime"/> return value is outside all
225 /// supported eras.
226 /// </exception>
227 public override DateTime AddDays(DateTime time, int days) {
228 DateTime t = base.AddDays(time, days);
229 M_CheckDateTime(t);
230 return t;
233 /// <summary>
234 /// Overridden. Adds hours to a given date.
235 /// </summary>
236 /// <param name="time">The
237 /// <see cref="T:System.DateTime"/> to which to add
238 /// hours.
239 /// </param>
240 /// <param name="hours">The number of hours to add.</param>
241 /// <returns>A new <see cref="T:System.DateTime"/> value, that
242 /// results from adding <paramref name="hours"/> to the specified
243 /// DateTime.</returns>
244 /// <exception cref="T:System.ArgumentOutOfRangeException">
245 /// The exception is thrown if the
246 /// <see cref="T:System.DateTime"/> return value is outside all
247 /// supported eras.
248 /// </exception>
249 public override DateTime AddHours(DateTime time, int hours) {
250 DateTime t = base.AddHours(time, hours);
251 M_CheckDateTime(t);
252 return t;
255 /// <summary>
256 /// Overridden. Adds milliseconds to a given date.
257 /// </summary>
258 /// <param name="time">The
259 /// <see cref="T:System.DateTime"/> to which to add
260 /// milliseconds.
261 /// </param>
262 /// <param name="milliseconds">The number of milliseconds given as
263 /// double to add. Keep in mind the 100 nanosecond resolution of
264 /// <see cref="T:System.DateTime"/>.
265 /// </param>
266 /// <returns>A new <see cref="T:System.DateTime"/> value, that
267 /// results from adding <paramref name="milliseconds"/> to the specified
268 /// DateTime.</returns>
269 /// <exception cref="T:System.ArgumentOutOfRangeException">
270 /// The exception is thrown if the
271 /// <see cref="T:System.DateTime"/> return value is outside all
272 /// supported eras.
273 /// </exception>
274 public override DateTime AddMilliseconds(DateTime time,
275 double milliseconds)
277 DateTime t = base.AddMilliseconds(time, milliseconds);
278 M_CheckDateTime(t);
279 return t;
282 /// <summary>
283 /// Overridden. Adds minutes to a given date.
284 /// </summary>
285 /// <param name="time">The
286 /// <see cref="T:System.DateTime"/> to which to add
287 /// minutes.
288 /// </param>
289 /// <param name="minutes">The number of minutes to add.</param>
290 /// <returns>A new <see cref="T:System.DateTime"/> value, that
291 /// results from adding <paramref name="minutes"/> to the specified
292 /// DateTime.</returns>
293 /// <exception cref="T:System.ArgumentOutOfRangeException">
294 /// The exception is thrown if the
295 /// <see cref="T:System.DateTime"/> return value is outside all
296 /// supported eras.
297 /// </exception>
298 public override DateTime AddMinutes(DateTime time, int minutes) {
299 DateTime t = base.AddMinutes(time, minutes);
300 M_CheckDateTime(t);
301 return t;
304 /// <summary>
305 /// Overridden. Adds seconds to a given date.
306 /// </summary>
307 /// <param name="time">The
308 /// <see cref="T:System.DateTime"/> to which to add
309 /// seconds.
310 /// </param>
311 /// <param name="seconds">The number of seconds to add.</param>
312 /// <returns>A new <see cref="T:System.DateTime"/> value, that
313 /// results from adding <paramref name="seconds"/> to the specified
314 /// DateTime.</returns>
315 /// <exception cref="T:System.ArgumentOutOfRangeException">
316 /// The exception is thrown if the
317 /// <see cref="T:System.DateTime"/> return value is outside all
318 /// supported eras.
319 /// </exception>
320 public override DateTime AddSeconds(DateTime time, int seconds) {
321 DateTime t = base.AddSeconds(time, seconds);
322 M_CheckDateTime(t);
323 return t;
327 /// <summary>
328 /// Overridden. Adds weeks to a given date.
329 /// </summary>
330 /// <param name="time">The
331 /// <see cref="T:System.DateTime"/> to which to add
332 /// weeks.
333 /// </param>
334 /// <param name="weeks">The number of weeks to add.</param>
335 /// <returns>A new <see cref="T:System.DateTime"/> value, that
336 /// results from adding <paramref name="weeks"/> to the specified
337 /// DateTime.</returns>
338 /// <exception cref="T:System.ArgumentOutOfRangeException">
339 /// The exception is thrown if the
340 /// <see cref="T:System.DateTime"/> return value is outside all
341 /// supported eras.
342 /// </exception>
343 public override DateTime AddWeeks(DateTime time, int weeks) {
344 DateTime t = base.AddWeeks(time, weeks);
345 M_CheckDateTime(t);
346 return t;
349 /// <summary>
350 /// Overridden. Gives the hour of the specified time.
351 /// </summary>
352 /// <param name="time">The
353 /// <see cref="T:System.DateTime"/> that specifies the
354 /// time.
355 /// </param>
356 /// <returns>An integer that gives the hour of the specified time,
357 /// starting with 0.</returns>
358 /// <exception cref="T:System.ArgumentOutOfRangeException">
359 /// The exception is thrown if the
360 /// <see cref="T:System.DateTime"/> parameter is outside all
361 /// supported eras.
362 /// </exception>
363 public override int GetHour(DateTime time) {
364 M_CheckDateTime(time);
365 return base.GetHour(time);
368 /// <summary>
369 /// Overridden. Gives the milliseconds in the current second
370 /// of the specified time.
371 /// </summary>
372 /// <param name="time">The
373 /// <see cref="T:System.DateTime"/> that specifies the
374 /// time.
375 /// </param>
376 /// <returns>An integer that gives the milliseconds in the seconds
377 /// of the specified time, starting with 0.</returns>
378 /// <exception cref="T:System.ArgumentOutOfRangeException">
379 /// The exception is thrown if the
380 /// <see cref="T:System.DateTime"/> parameter is outside all
381 /// supported eras.
382 /// </exception>
383 public override double GetMilliseconds(DateTime time) {
384 M_CheckDateTime(time);
385 return base.GetMilliseconds(time);
388 /// <summary>
389 /// Overridden. Gives the minute of the specified time.
390 /// </summary>
391 /// <param name="time">The
392 /// <see cref="T:System.DateTime"/> that specifies the
393 /// time.
394 /// </param>
395 /// <returns>An integer that gives the minute of the specified time,
396 /// starting with 0.</returns>
397 /// <exception cref="T:System.ArgumentOutOfRangeException">
398 /// The exception is thrown if the
399 /// <see cref="T:System.DateTime"/> parameter is outside all
400 /// supported eras.
401 /// </exception>
402 public override int GetMinute(DateTime time) {
403 M_CheckDateTime(time);
404 return base.GetMinute(time);
407 /// <summary>
408 /// Overridden. Gives the second of the specified time.
409 /// </summary>
410 /// <param name="time">The
411 /// <see cref="T:System.DateTime"/> that specifies the
412 /// time.
413 /// </param>
414 /// <returns>An integer that gives the second of the specified time,
415 /// starting with 0.</returns>
416 /// <exception cref="T:System.ArgumentOutOfRangeException">
417 /// The exception is thrown if the
418 /// <see cref="T:System.DateTime"/> parameter is outside all
419 /// supported eras.
420 /// </exception>
421 public override int GetSecond(DateTime time) {
422 M_CheckDateTime(time);
423 return base.GetMinute(time);
425 #endif
427 /// <summary>
428 /// Overrideden. Adds months to a given date.
429 /// </summary>
430 /// <param name="time">The
431 /// <see cref="T:System.DateTime"/> to which to add
432 /// months.
433 /// </param>
434 /// <param name="months">The number of months to add.</param>
435 /// <returns>A new <see cref="T:System.DateTime"/> value, that
436 /// results from adding <paramref name="months"/> to the specified
437 /// DateTime.</returns>
438 /// <exception cref="T:System.ArgumentOutOfRangeException">
439 /// The exception is thrown if
440 /// <see cref="T:System.DateTime"/> return value is outside all
441 /// supported eras.
442 /// </exception>
443 public override DateTime AddMonths(DateTime time, int months) {
444 DateTime t = CCGregorianCalendar.AddMonths(time, months);
445 M_CheckDateTime(t);
446 return t;
449 /// <summary>
450 /// Overridden. Adds years to a given date.
451 /// </summary>
452 /// <param name="time">The
453 /// <see cref="T:System.DateTime"/> to which to add
454 /// years.
455 /// </param>
456 /// <param name="years">The number of years to add.</param>
457 /// <returns>A new <see cref="T:System.DateTime"/> value, that
458 /// results from adding <paramref name="years"/> to the specified
459 /// DateTime.</returns>
460 /// <exception cref="T:System.ArgumentOutOfRangeException">
461 /// The exception is thrown if
462 /// <see cref="T:System.DateTime"/> return value is outside all
463 /// supported eras.
464 /// </exception>
465 public override DateTime AddYears(DateTime time, int years) {
466 DateTime t = CCGregorianCalendar.AddYears(time, years);
467 M_CheckDateTime(t);
468 return t;
471 /// <summary>
472 /// Overriden. Gets the day of the month from
473 /// <paramref name="time"/>.
474 /// </summary>
475 /// <param name="time">The
476 /// <see cref="T:System.DateTime"/> that specifies a
477 /// date.
478 /// </param>
479 /// <returns>An integer giving the day of months, starting with 1.
480 /// </returns>
481 /// <exception cref="T:System.ArgumentOutOfRangeException">
482 /// The exception is thrown if the
483 /// <see cref="T:System.DateTime"/> parameter is outside all
484 /// supported eras.
485 /// </exception>
486 public override int GetDayOfMonth(DateTime time) {
487 M_CheckDateTime(time);
488 return CCGregorianCalendar.GetDayOfMonth(time);
491 /// <summary>
492 /// Overriden. Gets the day of the week from the specified date.
493 /// </summary>
494 /// <param name="time">The
495 /// <see cref="T:System.DateTime"/> that specifies a
496 /// date.
497 /// </param>
498 /// <returns>An integer giving the day of months, starting with 1.
499 /// </returns>
500 /// <exception cref="T:System.ArgumentOutOfRangeException">
501 /// The exception is thrown if the
502 /// <see cref="T:System.DateTime"/> parameter is outside all
503 /// supported eras.
504 /// </exception>
505 public override DayOfWeek GetDayOfWeek(DateTime time) {
506 M_CheckDateTime(time);
507 int rd = CCFixed.FromDateTime(time);
508 return (DayOfWeek)CCFixed.day_of_week(rd);
511 /// <summary>
512 /// Overridden. Gives the number of the day in the year.
513 /// </summary>
514 /// <param name="time">The
515 /// <see cref="T:System.DateTime"/> that specifies a
516 /// date.
517 /// </param>
518 /// <returns>An integer representing the day of the year,
519 /// starting with 1.</returns>
520 /// <exception cref="T:System.ArgumentOutOfRangeException">
521 /// The exception is thrown if the
522 /// <see cref="T:System.DateTime"/> parameter is outside all
523 /// supported eras.
524 /// </exception>
525 public override int GetDayOfYear(DateTime time) {
526 M_CheckDateTime(time);
527 return CCGregorianCalendar.GetDayOfYear(time);
530 /// <summary>
531 /// Overridden. Gives the number of days in the specified month
532 /// of the given year and era.
533 /// </summary>
534 /// <param name="year">An integer that gives the year.
535 /// </param>
536 /// <param name="month">An integer that gives the month, starting
537 /// with 1.</param>
538 /// <param name="era">An integer that gives the era of the specified
539 /// year.</param>
540 /// <returns>An integer that gives the number of days of the
541 /// specified month.</returns>
542 /// <exception cref="T:System.ArgumentOutOfRangeException">
543 /// The exception is thrown, if <paramref name="month"/>,
544 /// <paramref name="year"/> ,or <paramref name="era"/> is outside
545 /// the allowed range.
546 /// </exception>
547 public override int GetDaysInMonth(int year, int month, int era) {
548 int gregorianYear = M_CheckYMEG(year, month, ref era);
549 return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
552 /// <summary>
553 /// Overridden. Gives the number of days of the specified
554 /// year of the given era.
555 /// </summary>
556 /// <param name="year">An integer that specifies the year.
557 /// </param>
558 /// <param name="era">An ineger that specifies the era.
559 /// </param>
560 /// <returns>An integer that gives the number of days of the
561 /// specified year.</returns>
562 /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
563 /// The exception is thrown, if
564 /// <paramref name="year"/> or <paramref name="era"/> are outside the
565 /// allowed range.
566 /// </exception>
567 public override int GetDaysInYear(int year, int era) {
568 int gregorianYear = M_CheckYEG(year, ref era);
569 return CCGregorianCalendar.GetDaysInYear(gregorianYear);
573 /// <summary>
574 /// Overridden. Gives the era of the specified date.
575 /// </summary>
576 /// <param name="time">The
577 /// <see cref="T:System.DateTime"/> that specifies a
578 /// date.
579 /// </param>
580 /// <returns>An integer representing the era of the calendar.
581 /// </returns>
582 /// <exception cref="T:System.ArgumentOutOfRangeException">
583 /// The exception is thrown if the
584 /// <see cref="T:System.DateTime"/> parameter is outside all
585 /// supported eras.
586 /// </exception>
587 public override int GetEra(DateTime time) {
588 // M_CheckDateTime not needed, because EraYear does the
589 // right thing.
590 int rd = CCFixed.FromDateTime(time);
591 int era;
592 M_EraHandler.EraYear(out era, rd);
593 return era;
596 /// <summary>
597 /// Overridden. Gives the number of the month of the specified
598 /// date.
599 /// </summary>
600 /// <param name="time">The
601 /// <see cref="T:System.DateTime"/> that specifies a
602 /// date.
603 /// </param>
604 /// <returns>An integer representing the month,
605 /// starting with 1.</returns>
606 /// <exception cref="T:System.ArgumentOutOfRangeException">
607 /// The exception is thrown if the
608 /// <see cref="T:System.DateTime"/> parameter is outside all
609 /// supported eras.
610 /// </exception>
611 public override int GetMonth(DateTime time) {
612 M_CheckDateTime(time);
613 return CCGregorianCalendar.GetMonth(time);
616 /// <summary>
617 /// Overridden. Gives the number of months in the specified year
618 /// and era.
619 /// </summary>
620 /// <param name="year">An integer that specifies the year.
621 /// </param>
622 /// <param name="era">An integer that specifies the era.
623 /// </param>
624 /// <returns>An integer that gives the number of the months in the
625 /// specified year.</returns>
626 /// <exception cref="T:System.ArgumentOutOfRangeException">
627 /// The exception is thrown, if the year or the era are not valid.
628 /// </exception>
629 public override int GetMonthsInYear(int year, int era) {
630 M_CheckYEG(year, ref era);
631 return 12;
634 /// <summary>
635 /// Overridden. Gives the number of the year of the specified
636 /// date.
637 /// </summary>
638 /// <param name="time">The
639 /// <see cref="T:System.DateTime"/> that specifies a
640 /// date.
641 /// </param>
642 /// <returns>An integer representing the year,
643 /// starting with 1.</returns>
644 /// <exception cref="T:System.ArgumentOutOfRangeException">
645 /// The exception is thrown if the
646 /// <see cref="T:System.DateTime"/> parameter is outside all
647 /// supported eras.
648 /// </exception>
649 public override int GetYear(DateTime time) {
650 // M_CheckDateTime not needed, because EraYeat does the
651 // right thing.
652 int rd = CCFixed.FromDateTime(time);
653 int era;
654 return M_EraHandler.EraYear(out era, rd);
657 /// <summary>
658 /// Overridden. Tells whether the given day
659 /// is a leap day.
660 /// </summary>
661 /// <param name="year">An integer that specifies the year in the
662 /// given era.
663 /// </param>
664 /// <param name="month">An integer that specifies the month.
665 /// </param>
666 /// <param name="day">An integer that specifies the day.
667 /// </param>
668 /// <param name="era">An integer that specifies the era.
669 /// </param>
670 /// <returns>A boolean that tells whether the given day is a leap
671 /// day.
672 /// </returns>
673 /// <exception cref="T:System.ArgumentOutOfRangeException">
674 /// The exception is thrown, if the year, month, day, or era is not
675 /// valid.
676 /// </exception>
677 public override bool IsLeapDay(int year, int month, int day, int era)
679 int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
680 return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
683 /// <summary>
684 /// Overridden. Tells whether the given month
685 /// is a leap month.
686 /// </summary>
687 /// <param name="year">An integer that specifies the year in the
688 /// given era.
689 /// </param>
690 /// <param name="month">An integer that specifies the month.
691 /// </param>
692 /// <param name="era">An integer that specifies the era.
693 /// </param>
694 /// <returns>A boolean that tells whether the given month is a leap
695 /// month.
696 /// </returns>
697 /// <exception cref="T:System.ArgumentOutOfRangeException">
698 /// The exception is thrown, if the year, month, or era is not
699 /// valid.
700 /// </exception>
701 public override bool IsLeapMonth(int year, int month, int era) {
702 M_CheckYMEG(year, month, ref era);
703 return false;
706 /// <summary>
707 /// Overridden. Tells whether the given year
708 /// is a leap year.
709 /// </summary>
710 /// <param name="year">An integer that specifies the year in the
711 /// given era.
712 /// </param>
713 /// <param name="era">An integer that specifies the era.
714 /// </param>
715 /// <returns>A boolean that tells whether the given year is a leap
716 /// year.
717 /// </returns>
718 /// <exception cref="T:System.ArgumentOutOfRangeException">
719 /// The exception is thrown, if the year or era is not
720 /// valid.
721 /// </exception>
722 public override bool IsLeapYear(int year, int era) {
723 int gregorianYear = M_CheckYEG(year, ref era);
724 return CCGregorianCalendar.is_leap_year(gregorianYear);
727 /// <summary>
728 /// Overridden. Creates the
729 /// <see cref="T:System.DateTime"/> from the parameters.
730 /// </summary>
731 /// <param name="year">An integer that gives the year in the
732 /// <paramref name="era"/>.
733 /// </param>
734 /// <param name="month">An integer that specifies the month.
735 /// </param>
736 /// <param name="day">An integer that specifies the day.
737 /// </param>
738 /// <param name="hour">An integer that specifies the hour.
739 /// </param>
740 /// <param name="minute">An integer that specifies the minute.
741 /// </param>
742 /// <param name="second">An integer that gives the second.
743 /// </param>
744 /// <param name="milliseconds">An integer that gives the
745 /// milliseconds.
746 /// </param>
747 /// <param name="era">An integer that specifies the era.
748 /// </param>
749 /// <returns>A
750 /// <see cref="T:system.DateTime"/> representig the date and time.
751 /// </returns>
752 /// <exception cref="T:System.ArgumentOutOfRangeException">
753 /// The exception is thrown, if at least one of the parameters
754 /// is out of range.
755 /// </exception>
756 public override DateTime ToDateTime(int year, int month, int day,
757 int hour, int minute, int second, int milliseconds,
758 int era)
760 int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
761 M_CheckHMSM(hour, minute, second, milliseconds);
762 return CCGregorianCalendar.ToDateTime(
763 gregorianYear, month, day,
764 hour, minute, second, milliseconds);
767 /// <summary>
768 /// This functions returns simply the year for the Taiwan calendar.
769 /// </summary>
770 /// <param name="year">An integer that gives the year.
771 /// </param>
772 /// <returns>The same argument as the year.
773 /// </returns>
774 /// <exception cref="T:System.ArgumentOutOfRangeException">
775 /// The exception is thrown if the year is negative or the resulting
776 /// year is invalid.
777 /// </exception>
778 public override int ToFourDigitYear(int year) {
779 if (year < 0)
780 throw new ArgumentOutOfRangeException(
781 "year", "Non-negative number required.");
782 int era = CurrentEra;
783 M_CheckYE(year, ref era);
784 return year;
786 } // class TaiwanCalendar
788 } // namespace System.Globalization