/* GENERATED SOURCE. DO NOT MODIFY. */ // © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2005-2016, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ package android.icu.util; import java.util.Date; import java.util.Locale; /** * Implement the Coptic calendar system. *
* CopticCalendar usually should be instantiated using
* {@link android.icu.util.Calendar#getInstance(ULocale)} passing in a ULocale
* with the tag "@calendar=coptic"
.
CopticCalendar
using the current time
* in the default time zone with the default locale.
*/
public CopticCalendar() {
super();
}
/**
* Constructs a CopticCalendar
based on the current time
* in the given time zone with the default locale.
*
* @param zone The time zone for the new calendar.
*/
public CopticCalendar(TimeZone zone) {
super(zone);
}
/**
* Constructs a CopticCalendar
based on the current time
* in the default time zone with the given locale.
*
* @param aLocale The locale for the new calendar.
*/
public CopticCalendar(Locale aLocale) {
super(aLocale);
}
/**
* Constructs a CopticCalendar
based on the current time
* in the default time zone with the given locale.
*
* @param locale The icu locale for the new calendar.
*/
public CopticCalendar(ULocale locale) {
super(locale);
}
/**
* Constructs a CopticCalendar
based on the current time
* in the given time zone with the given locale.
*
* @param zone The time zone for the new calendar.
* @param aLocale The locale for the new calendar.
*/
public CopticCalendar(TimeZone zone, Locale aLocale) {
super(zone, aLocale);
}
/**
* Constructs a CopticCalendar
based on the current time
* in the given time zone with the given locale.
*
* @param zone The time zone for the new calendar.
* @param locale The icu locale for the new calendar.
*/
public CopticCalendar(TimeZone zone, ULocale locale) {
super(zone, locale);
}
/**
* Constructs a CopticCalendar
with the given date set
* in the default time zone with the default locale.
*
* @param year The value used to set the calendar's {@link #YEAR YEAR} time field.
* @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
* The value is 0-based. e.g., 0 for Tout.
* @param date The value used to set the calendar's {@link #DATE DATE} time field.
*/
public CopticCalendar(int year, int month, int date) {
super(year, month, date);
}
/**
* Constructs a CopticCalendar
with the given date set
* in the default time zone with the default locale.
*
* @param date The date to which the new calendar is set.
*/
public CopticCalendar(Date date) {
super(date);
}
/**
* Constructs a CopticCalendar
with the given date
* and time set for the default time zone with the default locale.
*
* @param year The value used to set the calendar's {@link #YEAR YEAR} time field.
* @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
* The value is 0-based. e.g., 0 for Tout.
* @param date The value used to set the calendar's {@link #DATE DATE} time field.
* @param hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field.
* @param minute The value used to set the calendar's {@link #MINUTE MINUTE} time field.
* @param second The value used to set the calendar's {@link #SECOND SECOND} time field.
*/
public CopticCalendar(int year, int month, int date, int hour,
int minute, int second) {
super(year, month, date, hour, minute, second);
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return "coptic";
}
/**
* {@inheritDoc}
* @deprecated This API is ICU internal only.
* @hide draft / provisional / internal are hidden on Android
*/
@Override
@Deprecated
protected boolean isEra0CountingBackward() {
return true;
}
/**
* {@inheritDoc}
* @deprecated This API is ICU internal only.
* @hide original deprecated declaration
* @hide draft / provisional / internal are hidden on Android
*/
@Override
@Deprecated
protected int handleGetExtendedYear() {
int eyear;
if (newerField(EXTENDED_YEAR, YEAR) == EXTENDED_YEAR) {
eyear = internalGet(EXTENDED_YEAR, 1); // Default to year 1
} else {
// The year defaults to the epoch start, the era to AD
int era = internalGet(ERA, CE);
if (era == BCE) {
eyear = 1 - internalGet(YEAR, 1); // Convert to extended year
} else {
eyear = internalGet(YEAR, 1); // Default to year 1
}
}
return eyear;
}
/**
* {@inheritDoc}
* @deprecated This API is ICU internal only.
* @hide original deprecated declaration
* @hide draft / provisional / internal are hidden on Android
*/
@Override
@Deprecated
protected void handleComputeFields(int julianDay) {
int era, year;
int[] fields = new int[3];
jdToCE(julianDay, getJDEpochOffset(), fields);
// fields[0] eyear
// fields[1] month
// fields[2] day
if (fields[0] <= 0) {
era = BCE;
year = 1 - fields[0];
} else {
era = CE;
year = fields[0];
}
internalSet(EXTENDED_YEAR, fields[0]);
internalSet(ERA, era);
internalSet(YEAR, year);
internalSet(MONTH, fields[1]);
internalSet(ORDINAL_MONTH, fields[1]);
internalSet(DAY_OF_MONTH, fields[2]);
internalSet(DAY_OF_YEAR, (30 * fields[1]) + fields[2]);
}
/**
* {@inheritDoc}
* @deprecated This API is ICU internal only.
* @hide original deprecated declaration
* @hide draft / provisional / internal are hidden on Android
*/
@Override
@Deprecated
protected int getJDEpochOffset() {
return JD_EPOCH_OFFSET;
}
/**
* Convert an Coptic year, month, and day to a Julian day.
*
* @param year the year
* @param month the month
* @param date the day
* @hide draft / provisional / internal are hidden on Android
*/
// The equivalent operation can be done by public Calendar API.
// This API was accidentally marked as @draft, but we have no good
// reason to keep this. For now, we leave it as is, but may be
// removed in future. 2008-03-21 yoshito
public static int copticToJD(long year, int month, int date) {
return ceToJD(year, month, date, JD_EPOCH_OFFSET);
}
}