001: /*
002: * Copyright 2001-2005 Stephen Colebourne
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.joda.time;
017:
018: import org.joda.time.chrono.BuddhistChronology;
019: import org.joda.time.chrono.CopticChronology;
020: import org.joda.time.chrono.GJChronology;
021: import org.joda.time.chrono.GregorianChronology;
022: import org.joda.time.chrono.ISOChronology;
023: import org.joda.time.chrono.JulianChronology;
024:
025: /**
026: * Chronology provides access to the individual date time fields for a
027: * chronological calendar system.
028: * <p>
029: * Various chronologies are supported by subclasses including ISO
030: * and GregorianJulian. To construct a Chronology you should use the
031: * factory methods on the chronology subclass in the chrono package.
032: * <p>
033: * For example, to obtain the current time in the coptic calendar system:
034: * <pre>
035: * DateTime dt = new DateTime(CopticChronology.getInstance());
036: * </pre>
037: * <p>
038: * The provided chronology implementations are:
039: * <ul>
040: * <li>ISO - Based on the ISO8601 standard and suitable for use after about 1600
041: * <li>GJ - Historically accurate calendar with Julian followed by Gregorian
042: * <li>Gregorian - The Gregorian calendar system used for all time (proleptic)
043: * <li>Julian - The Julian calendar system used for all time (proleptic)
044: * <li>Buddhist - The Buddhist calendar system which is an offset in years from GJ
045: * <li>Coptic - The Coptic calendar system which defines 30 day months
046: * <li>Ethiopic - The Ethiopic calendar system which defines 30 day months
047: * </ul>
048: * Hopefully future releases will contain more chronologies.
049: * <p>
050: * This class defines a number of fields with names from the ISO8601 standard.
051: * It does not 'strongly' define these fields however, thus implementations
052: * are free to interpret the field names as they wish.
053: * For example, a week could be defined as 10 days and a month as 40 days in a
054: * special WeirdChronology implementation. Clearly the GJ and ISO
055: * implementations provided use the field names as you would expect.
056: *
057: * @see org.joda.time.chrono.ISOChronology
058: * @see org.joda.time.chrono.GJChronology
059: * @see org.joda.time.chrono.GregorianChronology
060: * @see org.joda.time.chrono.JulianChronology
061: * @see org.joda.time.chrono.CopticChronology
062: * @see org.joda.time.chrono.BuddhistChronology
063: * @see org.joda.time.chrono.EthiopicChronology
064: *
065: * @author Stephen Colebourne
066: * @author Brian S O'Neill
067: * @since 1.0
068: */
069: public abstract class Chronology {
070:
071: /**
072: * Gets an instance of the ISOChronology in the default zone.
073: * <p>
074: * {@link ISOChronology} defines all fields in line with the ISO8601 standard.
075: * This chronology is the default, and is suitable for all normal datetime processing.
076: * It is <i>unsuitable</i> for historical datetimes before October 15, 1582
077: * as it applies the modern Gregorian calendar rules before that date.
078: *
079: * @return the ISO chronology
080: * @deprecated Use ISOChronology.getInstance()
081: */
082: public static Chronology getISO() {
083: return ISOChronology.getInstance();
084: }
085:
086: /**
087: * Gets an instance of the ISOChronology in the UTC zone.
088: * <p>
089: * {@link ISOChronology} defines all fields in line with the ISO8601 standard.
090: * This chronology is the default, and is suitable for all normal datetime processing.
091: * It is <i>unsuitable</i> for historical datetimes before October 15, 1582
092: * as it applies the modern Gregorian calendar rules before that date.
093: *
094: * @return the ISO chronology
095: * @deprecated Use ISOChronology.getInstanceUTC()
096: */
097: public static Chronology getISOUTC() {
098: return ISOChronology.getInstanceUTC();
099: }
100:
101: /**
102: * Gets an instance of the ISOChronology in the specified zone.
103: * <p>
104: * {@link ISOChronology} defines all fields in line with the ISO8601 standard.
105: * This chronology is the default, and is suitable for all normal datetime processing.
106: * It is <i>unsuitable</i> for historical datetimes before October 15, 1582
107: * as it applies the modern Gregorian calendar rules before that date.
108: *
109: * @param zone the zone to use, null means default zone
110: * @return the ISO chronology
111: * @deprecated Use ISOChronology.getInstance(zone)
112: */
113: public static Chronology getISO(DateTimeZone zone) {
114: return ISOChronology.getInstance(zone);
115: }
116:
117: //-----------------------------------------------------------------------
118: /**
119: * Gets an instance of the GJChronology in the default zone.
120: * <p>
121: * {@link GJChronology} defines all fields using standard meanings.
122: * This chronology is intended to be used as a replacement for <code>GregorianCalendar</code>.
123: * The Gregorian calendar system is used after October 15, 1582, while the
124: * Julian calendar system is used before.
125: * <p>
126: * Unlike <code>GregorianCalendar</code>, this chronology returns a year of -1
127: * for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero.
128: * <p>
129: * This method uses the standard Julian to Gregorian cutover date of
130: * October 15th 1582. If you require a cutover on a different date, then use
131: * the factories on <code>GJChronology</code> itself.
132: * <p>
133: * When dealing solely with dates in the modern era, from 1600 onwards,
134: * we recommend using ISOChronology, which is the default.
135: *
136: * @return the GJ chronology
137: * @deprecated Use GJChronology.getInstance()
138: */
139: public static Chronology getGJ() {
140: return GJChronology.getInstance();
141: }
142:
143: /**
144: * Gets an instance of the GJChronology in the UTC zone.
145: * <p>
146: * {@link GJChronology} defines all fields using standard meanings.
147: * This chronology is intended to be used as a replacement for <code>GregorianCalendar</code>.
148: * The Gregorian calendar system is used after October 15, 1582, while the
149: * Julian calendar system is used before.
150: * <p>
151: * Unlike <code>GregorianCalendar</code>, this chronology returns a year of -1
152: * for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero.
153: * <p>
154: * This method uses the standard Julian to Gregorian cutover date of
155: * October 15th 1582. If you require a cutover on a different date, then use
156: * the factories on <code>GJChronology</code> itself.
157: * <p>
158: * When dealing solely with dates in the modern era, from 1600 onwards,
159: * we recommend using ISOChronology, which is the default.
160: *
161: * @return the GJ chronology
162: * @deprecated Use GJChronology.getInstanceUTC()
163: */
164: public static Chronology getGJUTC() {
165: return GJChronology.getInstanceUTC();
166: }
167:
168: /**
169: * Gets an instance of the GJChronology in the specified zone.
170: * <p>
171: * {@link GJChronology} defines all fields using standard meanings.
172: * This chronology is intended to be used as a replacement for <code>GregorianCalendar</code>.
173: * The Gregorian calendar system is used after October 15, 1582, while the
174: * Julian calendar system is used before.
175: * <p>
176: * Unlike <code>GregorianCalendar</code>, this chronology returns a year of -1
177: * for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero.
178: * <p>
179: * This method uses the standard Julian to Gregorian cutover date of
180: * October 15th 1582. If you require a cutover on a different date, then use
181: * the factories on <code>GJChronology</code> itself.
182: * <p>
183: * When dealing solely with dates in the modern era, from 1600 onwards,
184: * we recommend using ISOChronology, which is the default.
185: *
186: * @param zone the zone to use, null means default zone
187: * @return the GJ chronology
188: * @deprecated Use GJChronology.getInstance(zone)
189: */
190: public static Chronology getGJ(DateTimeZone zone) {
191: return GJChronology.getInstance(zone);
192: }
193:
194: //-----------------------------------------------------------------------
195: /**
196: * Gets an instance of the GregorianChronology in the default zone.
197: * <p>
198: * {@link GregorianChronology} defines all fields using standard meanings.
199: * It uses the Gregorian calendar rules <i>for all time</i> (proleptic)
200: * thus it is NOT a replacement for <code>GregorianCalendar</code>.
201: * For that purpose, you should use {@link #getGJ()}.
202: * <p>
203: * The Gregorian calendar system defines a leap year every four years,
204: * except that every 100 years is not leap, but every 400 is leap.
205: * <p>
206: * Technically, this chronology is almost identical to the ISO chronology,
207: * thus we recommend using ISOChronology instead, which is the default.
208: *
209: * @return the Gregorian chronology
210: * @deprecated Use GregorianChronology.getInstance()
211: */
212: public static Chronology getGregorian() {
213: return GregorianChronology.getInstance();
214: }
215:
216: /**
217: * Gets an instance of the GregorianChronology in the UTC zone.
218: * <p>
219: * {@link GregorianChronology} defines all fields using standard meanings.
220: * It uses the Gregorian calendar rules <i>for all time</i> (proleptic)
221: * thus it is NOT a replacement for <code>GregorianCalendar</code>.
222: * For that purpose, you should use {@link #getGJ()}.
223: * <p>
224: * The Gregorian calendar system defines a leap year every four years,
225: * except that every 100 years is not leap, but every 400 is leap.
226: * <p>
227: * Technically, this chronology is almost identical to the ISO chronology,
228: * thus we recommend using ISOChronology instead, which is the default.
229: *
230: * @return the Gregorian chronology
231: * @deprecated Use GregorianChronology.getInstanceUTC()
232: */
233: public static Chronology getGregorianUTC() {
234: return GregorianChronology.getInstanceUTC();
235: }
236:
237: /**
238: * Gets an instance of the GregorianChronology in the specified zone.
239: * <p>
240: * {@link GregorianChronology} defines all fields using standard meanings.
241: * It uses the Gregorian calendar rules <i>for all time</i> (proleptic)
242: * thus it is NOT a replacement for <code>GregorianCalendar</code>.
243: * For that purpose, you should use {@link #getGJ()}.
244: * <p>
245: * The Gregorian calendar system defines a leap year every four years,
246: * except that every 100 years is not leap, but every 400 is leap.
247: * <p>
248: * Technically, this chronology is almost identical to the ISO chronology,
249: * thus we recommend using ISOChronology instead, which is the default.
250: *
251: * @param zone the zone to use, null means default zone
252: * @return the Gregorian chronology
253: * @deprecated Use GregorianChronology.getInstance(zone)
254: */
255: public static Chronology getGregorian(DateTimeZone zone) {
256: return GregorianChronology.getInstance(zone);
257: }
258:
259: //-----------------------------------------------------------------------
260: /**
261: * Gets an instance of the JulianChronology in the default zone.
262: * <p>
263: * {@link JulianChronology} defines all fields using standard meanings.
264: * It uses the Julian calendar rules <i>for all time</i> (proleptic).
265: * The Julian calendar system defines a leap year every four years.
266: *
267: * @return the Julian chronology
268: * @deprecated Use JulianChronology.getInstance()
269: */
270: public static Chronology getJulian() {
271: return JulianChronology.getInstance();
272: }
273:
274: /**
275: * Gets an instance of the JulianChronology in the UTC zone.
276: * <p>
277: * {@link JulianChronology} defines all fields using standard meanings.
278: * It uses the Julian calendar rules <i>for all time</i> (proleptic).
279: * The Julian calendar system defines a leap year every four years.
280: *
281: * @return the Julian chronology
282: * @deprecated Use JulianChronology.getInstanceUTC()
283: */
284: public static Chronology getJulianUTC() {
285: return JulianChronology.getInstanceUTC();
286: }
287:
288: /**
289: * Gets an instance of the JulianChronology in the specified zone.
290: * <p>
291: * {@link JulianChronology} defines all fields using standard meanings.
292: * It uses the Julian calendar rules <i>for all time</i> (proleptic).
293: * The Julian calendar system defines a leap year every four years.
294: *
295: * @param zone the zone to use, null means default zone
296: * @return the Julian chronology
297: * @deprecated Use JulianChronology.getInstance(zone)
298: */
299: public static Chronology getJulian(DateTimeZone zone) {
300: return JulianChronology.getInstance(zone);
301: }
302:
303: //-----------------------------------------------------------------------
304: /**
305: * Gets an instance of the BuddhistChronology in the default zone.
306: * <p>
307: * {@link BuddhistChronology} defines all fields using standard meanings,
308: * however the year is offset by 543. The chronology cannot be used before
309: * year 1 in the Buddhist calendar.
310: *
311: * @return the Buddhist chronology
312: * @deprecated Use BuddhistChronology.getInstance()
313: */
314: public static Chronology getBuddhist() {
315: return BuddhistChronology.getInstance();
316: }
317:
318: /**
319: * Gets an instance of the BuddhistChronology in the UTC zone.
320: * <p>
321: * {@link BuddhistChronology} defines all fields using standard meanings,
322: * however the year is offset by 543. The chronology cannot be used before
323: * year 1 in the Buddhist calendar.
324: *
325: * @return the Buddhist chronology
326: * @deprecated Use BuddhistChronology.getInstanceUTC()
327: */
328: public static Chronology getBuddhistUTC() {
329: return BuddhistChronology.getInstanceUTC();
330: }
331:
332: /**
333: * Gets an instance of the BuddhistChronology in the specified zone.
334: * <p>
335: * {@link BuddhistChronology} defines all fields using standard meanings,
336: * however the year is offset by 543. The chronology cannot be used before
337: * year 1 in the Buddhist calendar.
338: *
339: * @param zone the zone to use, null means default zone
340: * @return the Buddhist chronology
341: * @deprecated Use BuddhistChronology.getInstance(zone)
342: */
343: public static Chronology getBuddhist(DateTimeZone zone) {
344: return BuddhistChronology.getInstance(zone);
345: }
346:
347: //-----------------------------------------------------------------------
348: /**
349: * Gets an instance of the CopticChronology in the default zone.
350: * <p>
351: * {@link CopticChronology} defines fields sensibly for the Coptic calendar system.
352: * The Coptic calendar system defines every fourth year as leap.
353: * The year is broken down into 12 months, each 30 days in length.
354: * An extra period at the end of the year is either 5 or 6 days in length
355: * and is returned as a 13th month.
356: * Year 1 in the Coptic calendar began on August 29, 284 CE (Julian).
357: * The chronology cannot be used before the first Coptic year.
358: *
359: * @return the Coptic chronology
360: * @deprecated Use CopticChronology.getInstance()
361: */
362: public static Chronology getCoptic() {
363: return CopticChronology.getInstance();
364: }
365:
366: /**
367: * Gets an instance of the CopticChronology in the UTC zone.
368: * <p>
369: * {@link CopticChronology} defines fields sensibly for the Coptic calendar system.
370: * The Coptic calendar system defines every fourth year as leap.
371: * The year is broken down into 12 months, each 30 days in length.
372: * An extra period at the end of the year is either 5 or 6 days in length
373: * and is returned as a 13th month.
374: * Year 1 in the Coptic calendar began on August 29, 284 CE (Julian).
375: * The chronology cannot be used before the first Coptic year.
376: *
377: * @return the Coptic chronology
378: * @deprecated Use CopticChronology.getInstanceUTC()
379: */
380: public static Chronology getCopticUTC() {
381: return CopticChronology.getInstanceUTC();
382: }
383:
384: /**
385: * Gets an instance of the CopticChronology in the specified zone.
386: * <p>
387: * {@link CopticChronology} defines fields sensibly for the Coptic calendar system.
388: * The Coptic calendar system defines every fourth year as leap.
389: * The year is broken down into 12 months, each 30 days in length.
390: * An extra period at the end of the year is either 5 or 6 days in length
391: * and is returned as a 13th month.
392: * Year 1 in the Coptic calendar began on August 29, 284 CE (Julian).
393: * The chronology cannot be used before the first Coptic year.
394: *
395: * @param zone the zone to use, null means default zone
396: * @return the Coptic chronology
397: * @deprecated Use CopticChronology.getInstance(zone)
398: */
399: public static Chronology getCoptic(DateTimeZone zone) {
400: return CopticChronology.getInstance(zone);
401: }
402:
403: //-----------------------------------------------------------------------
404: /**
405: * Returns the DateTimeZone that this Chronology operates in, or null if
406: * unspecified.
407: *
408: * @return the DateTimeZone, null if unspecified
409: */
410: public abstract DateTimeZone getZone();
411:
412: /**
413: * Returns an instance of this Chronology that operates in the UTC time
414: * zone. Chronologies that do not operate in a time zone or are already
415: * UTC must return themself.
416: *
417: * @return a version of this chronology that ignores time zones
418: */
419: public abstract Chronology withUTC();
420:
421: /**
422: * Returns an instance of this Chronology that operates in any time zone.
423: *
424: * @return a version of this chronology with a specific time zone
425: * @param zone to use, or default if null
426: * @see org.joda.time.chrono.ZonedChronology
427: */
428: public abstract Chronology withZone(DateTimeZone zone);
429:
430: /**
431: * Returns a datetime millisecond instant, formed from the given year,
432: * month, day, and millisecond values. The set of given values must refer
433: * to a valid datetime, or else an IllegalArgumentException is thrown.
434: * <p>
435: * The default implementation calls upon separate DateTimeFields to
436: * determine the result. Subclasses are encouraged to provide a more
437: * efficient implementation.
438: *
439: * @param year year to use
440: * @param monthOfYear month to use
441: * @param dayOfMonth day of month to use
442: * @param millisOfDay millisecond to use
443: * @return millisecond instant from 1970-01-01T00:00:00Z
444: * @throws IllegalArgumentException if the values are invalid
445: */
446: public abstract long getDateTimeMillis(int year, int monthOfYear,
447: int dayOfMonth, int millisOfDay);
448:
449: /**
450: * Returns a datetime millisecond instant, formed from the given year,
451: * month, day, hour, minute, second, and millisecond values. The set of
452: * given values must refer to a valid datetime, or else an
453: * IllegalArgumentException is thrown.
454: * <p>
455: * The default implementation calls upon separate DateTimeFields to
456: * determine the result. Subclasses are encouraged to provide a more
457: * efficient implementation.
458: *
459: * @param year year to use
460: * @param monthOfYear month to use
461: * @param dayOfMonth day of month to use
462: * @param hourOfDay hour to use
463: * @param minuteOfHour minute to use
464: * @param secondOfMinute second to use
465: * @param millisOfSecond millisecond to use
466: * @return millisecond instant from 1970-01-01T00:00:00Z
467: * @throws IllegalArgumentException if the values are invalid
468: */
469: public abstract long getDateTimeMillis(int year, int monthOfYear,
470: int dayOfMonth, int hourOfDay, int minuteOfHour,
471: int secondOfMinute, int millisOfSecond);
472:
473: /**
474: * Returns a datetime millisecond instant, from from the given instant,
475: * hour, minute, second, and millisecond values. The set of given values
476: * must refer to a valid datetime, or else an IllegalArgumentException is
477: * thrown.
478: * <p>
479: * The default implementation calls upon separate DateTimeFields to
480: * determine the result. Subclasses are encouraged to provide a more
481: * efficient implementation.
482: *
483: * @param instant instant to start from
484: * @param hourOfDay hour to use
485: * @param minuteOfHour minute to use
486: * @param secondOfMinute second to use
487: * @param millisOfSecond millisecond to use
488: * @return millisecond instant from 1970-01-01T00:00:00Z
489: * @throws IllegalArgumentException if the values are invalid
490: */
491: public abstract long getDateTimeMillis(long instant, int hourOfDay,
492: int minuteOfHour, int secondOfMinute, int millisOfSecond);
493:
494: //-----------------------------------------------------------------------
495: /**
496: * Validates whether the values are valid for the fields of a partial instant.
497: *
498: * @param partial the partial instant to validate
499: * @param values the values to validate, not null, match fields in partial
500: * @throws IllegalArgumentException if the instant is invalid
501: */
502: public abstract void validate(ReadablePartial partial, int[] values);
503:
504: /**
505: * Gets the values of a partial from an instant.
506: *
507: * @param partial the partial instant to use
508: * @param instant the instant to query
509: * @return the values of this partial extracted from the instant
510: */
511: public abstract int[] get(ReadablePartial partial, long instant);
512:
513: /**
514: * Sets the partial into the instant.
515: *
516: * @param partial the partial instant to use
517: * @param instant the instant to update
518: * @return the updated instant
519: */
520: public abstract long set(ReadablePartial partial, long instant);
521:
522: //-----------------------------------------------------------------------
523: /**
524: * Gets the values of a period from an interval.
525: *
526: * @param period the period instant to use
527: * @param startInstant the start instant of an interval to query
528: * @param endInstant the start instant of an interval to query
529: * @return the values of the period extracted from the interval
530: */
531: public abstract int[] get(ReadablePeriod period, long startInstant,
532: long endInstant);
533:
534: /**
535: * Gets the values of a period from an interval.
536: *
537: * @param period the period instant to use
538: * @param duration the duration to query
539: * @return the values of the period extracted from the duration
540: */
541: public abstract int[] get(ReadablePeriod period, long duration);
542:
543: /**
544: * Adds the period to the instant, specifying the number of times to add.
545: *
546: * @param period the period to add, null means add nothing
547: * @param instant the instant to add to
548: * @param scalar the number of times to add
549: * @return the updated instant
550: */
551: public abstract long add(ReadablePeriod period, long instant,
552: int scalar);
553:
554: //-----------------------------------------------------------------------
555: /**
556: * Adds the duration to the instant, specifying the number of times to add.
557: *
558: * @param instant the instant to add to
559: * @param duration the duration to add
560: * @param scalar the number of times to add
561: * @return the updated instant
562: */
563: public abstract long add(long instant, long duration, int scalar);
564:
565: // Millis
566: //-----------------------------------------------------------------------
567: /**
568: * Get the millis duration field for this chronology.
569: *
570: * @return DurationField or UnsupportedDurationField if unsupported
571: */
572: public abstract DurationField millis();
573:
574: /**
575: * Get the millis of second field for this chronology.
576: *
577: * @return DateTimeField or UnsupportedDateTimeField if unsupported
578: */
579: public abstract DateTimeField millisOfSecond();
580:
581: /**
582: * Get the millis of day field for this chronology.
583: *
584: * @return DateTimeField or UnsupportedDateTimeField if unsupported
585: */
586: public abstract DateTimeField millisOfDay();
587:
588: // Second
589: //-----------------------------------------------------------------------
590: /**
591: * Get the seconds duration field for this chronology.
592: *
593: * @return DurationField or UnsupportedDurationField if unsupported
594: */
595: public abstract DurationField seconds();
596:
597: /**
598: * Get the second of minute field for this chronology.
599: *
600: * @return DateTimeField or UnsupportedDateTimeField if unsupported
601: */
602: public abstract DateTimeField secondOfMinute();
603:
604: /**
605: * Get the second of day field for this chronology.
606: *
607: * @return DateTimeField or UnsupportedDateTimeField if unsupported
608: */
609: public abstract DateTimeField secondOfDay();
610:
611: // Minute
612: //-----------------------------------------------------------------------
613: /**
614: * Get the minutes duration field for this chronology.
615: *
616: * @return DurationField or UnsupportedDurationField if unsupported
617: */
618: public abstract DurationField minutes();
619:
620: /**
621: * Get the minute of hour field for this chronology.
622: *
623: * @return DateTimeField or UnsupportedDateTimeField if unsupported
624: */
625: public abstract DateTimeField minuteOfHour();
626:
627: /**
628: * Get the minute of day field for this chronology.
629: *
630: * @return DateTimeField or UnsupportedDateTimeField if unsupported
631: */
632: public abstract DateTimeField minuteOfDay();
633:
634: // Hour
635: //-----------------------------------------------------------------------
636: /**
637: * Get the hours duration field for this chronology.
638: *
639: * @return DurationField or UnsupportedDurationField if unsupported
640: */
641: public abstract DurationField hours();
642:
643: /**
644: * Get the hour of day (0-23) field for this chronology.
645: *
646: * @return DateTimeField or UnsupportedDateTimeField if unsupported
647: */
648: public abstract DateTimeField hourOfDay();
649:
650: /**
651: * Get the hour of day (offset to 1-24) field for this chronology.
652: *
653: * @return DateTimeField or UnsupportedDateTimeField if unsupported
654: */
655: public abstract DateTimeField clockhourOfDay();
656:
657: // Halfday
658: //-----------------------------------------------------------------------
659: /**
660: * Get the halfdays duration field for this chronology.
661: *
662: * @return DurationField or UnsupportedDurationField if unsupported
663: */
664: public abstract DurationField halfdays();
665:
666: /**
667: * Get the hour of am/pm (0-11) field for this chronology.
668: *
669: * @return DateTimeField or UnsupportedDateTimeField if unsupported
670: */
671: public abstract DateTimeField hourOfHalfday();
672:
673: /**
674: * Get the hour of am/pm (offset to 1-12) field for this chronology.
675: *
676: * @return DateTimeField or UnsupportedDateTimeField if unsupported
677: */
678: public abstract DateTimeField clockhourOfHalfday();
679:
680: /**
681: * Get the AM(0) PM(1) field for this chronology.
682: *
683: * @return DateTimeField or UnsupportedDateTimeField if unsupported
684: */
685: public abstract DateTimeField halfdayOfDay();
686:
687: // Day
688: //-----------------------------------------------------------------------
689: /**
690: * Get the days duration field for this chronology.
691: *
692: * @return DurationField or UnsupportedDurationField if unsupported
693: */
694: public abstract DurationField days();
695:
696: /**
697: * Get the day of week field for this chronology.
698: *
699: * <p>DayOfWeek values are defined in {@link DateTimeConstants}.
700: * They use the ISO definitions, where 1 is Monday and 7 is Sunday.
701: *
702: * @return DateTimeField or UnsupportedDateTimeField if unsupported
703: */
704: public abstract DateTimeField dayOfWeek();
705:
706: /**
707: * Get the day of month field for this chronology.
708: *
709: * @return DateTimeField or UnsupportedDateTimeField if unsupported
710: */
711: public abstract DateTimeField dayOfMonth();
712:
713: /**
714: * Get the day of year field for this chronology.
715: *
716: * @return DateTimeField or UnsupportedDateTimeField if unsupported
717: */
718: public abstract DateTimeField dayOfYear();
719:
720: // Week
721: //-----------------------------------------------------------------------
722: /**
723: * Get the weeks duration field for this chronology.
724: *
725: * @return DurationField or UnsupportedDurationField if unsupported
726: */
727: public abstract DurationField weeks();
728:
729: /**
730: * Get the week of a week based year field for this chronology.
731: *
732: * @return DateTimeField or UnsupportedDateTimeField if unsupported
733: */
734: public abstract DateTimeField weekOfWeekyear();
735:
736: // Weekyear
737: //-----------------------------------------------------------------------
738: /**
739: * Get the weekyears duration field for this chronology.
740: *
741: * @return DurationField or UnsupportedDurationField if unsupported
742: */
743: public abstract DurationField weekyears();
744:
745: /**
746: * Get the year of a week based year field for this chronology.
747: *
748: * @return DateTimeField or UnsupportedDateTimeField if unsupported
749: */
750: public abstract DateTimeField weekyear();
751:
752: /**
753: * Get the year of a week based year in a century field for this chronology.
754: *
755: * @return DateTimeField or UnsupportedDateTimeField if unsupported
756: */
757: public abstract DateTimeField weekyearOfCentury();
758:
759: // Month
760: //-----------------------------------------------------------------------
761: /**
762: * Get the months duration field for this chronology.
763: *
764: * @return DurationField or UnsupportedDurationField if unsupported
765: */
766: public abstract DurationField months();
767:
768: /**
769: * Get the month of year field for this chronology.
770: *
771: * @return DateTimeField or UnsupportedDateTimeField if unsupported
772: */
773: public abstract DateTimeField monthOfYear();
774:
775: // Year
776: //-----------------------------------------------------------------------
777: /**
778: * Get the years duration field for this chronology.
779: *
780: * @return DurationField or UnsupportedDurationField if unsupported
781: */
782: public abstract DurationField years();
783:
784: /**
785: * Get the year field for this chronology.
786: *
787: * @return DateTimeField or UnsupportedDateTimeField if unsupported
788: */
789: public abstract DateTimeField year();
790:
791: /**
792: * Get the year of era field for this chronology.
793: *
794: * @return DateTimeField or UnsupportedDateTimeField if unsupported
795: */
796: public abstract DateTimeField yearOfEra();
797:
798: /**
799: * Get the year of century field for this chronology.
800: *
801: * @return DateTimeField or UnsupportedDateTimeField if unsupported
802: */
803: public abstract DateTimeField yearOfCentury();
804:
805: // Century
806: //-----------------------------------------------------------------------
807: /**
808: * Get the centuries duration field for this chronology.
809: *
810: * @return DurationField or UnsupportedDurationField if unsupported
811: */
812: public abstract DurationField centuries();
813:
814: /**
815: * Get the century of era field for this chronology.
816: *
817: * @return DateTimeField or UnsupportedDateTimeField if unsupported
818: */
819: public abstract DateTimeField centuryOfEra();
820:
821: // Era
822: //-----------------------------------------------------------------------
823: /**
824: * Get the eras duration field for this chronology.
825: *
826: * @return DurationField or UnsupportedDurationField if unsupported
827: */
828: public abstract DurationField eras();
829:
830: /**
831: * Get the era field for this chronology.
832: *
833: * @return DateTimeField or UnsupportedDateTimeField if unsupported
834: */
835: public abstract DateTimeField era();
836:
837: //-----------------------------------------------------------------------
838: /**
839: * Gets a debugging toString.
840: *
841: * @return a debugging string
842: */
843: public abstract String toString();
844:
845: }
|