test/java/time/tck/java/time/chrono/CopticChronology.java
Print this page
@@ -52,11 +52,11 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package tck.java.time.calendar;
+package tck.java.time.chrono;
import static java.time.temporal.ChronoField.EPOCH_DAY;
import java.io.Serializable;
import java.util.Arrays;
@@ -65,13 +65,13 @@
import java.time.DateTimeException;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.ValueRange;
-import java.time.temporal.Chrono;
-import java.time.temporal.ChronoLocalDate;
-import java.time.temporal.Era;
+import java.time.chrono.Chronology;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Era;
/**
* The Coptic calendar system.
* <p>
* This chronology defines the rules of the Coptic calendar system.
@@ -94,26 +94,26 @@
* </ul><p>
*
* <h4>Implementation notes</h4>
* This class is immutable and thread-safe.
*/
-public final class CopticChrono extends Chrono<CopticChrono> implements Serializable {
+public final class CopticChronology extends Chronology implements Serializable {
/**
* Singleton instance of the Coptic chronology.
*/
- public static final CopticChrono INSTANCE = new CopticChrono();
+ public static final CopticChronology INSTANCE = new CopticChronology();
/**
* The singleton instance for the era BEFORE_AM.
* This has the numeric value of {@code 0}.
*/
- public static final Era<CopticChrono> ERA_BEFORE_AM = CopticEra.BEFORE_AM;
+ public static final Era ERA_BEFORE_AM = CopticEra.BEFORE_AM;
/**
* The singleton instance for the era AM - 'Era of the Martyrs'.
* This has the numeric value of {@code 1}.
*/
- public static final Era<CopticChrono> ERA_AM = CopticEra.AM;
+ public static final Era ERA_AM = CopticEra.AM;
/**
* Serialization version.
*/
private static final long serialVersionUID = 7291205177830286973L;
@@ -135,11 +135,11 @@
static final ValueRange DOM_RANGE_LEAP = ValueRange.of(1, 6);
/**
* Public Constructor to be instantiated by the ServiceLoader
*/
- public CopticChrono() {
+ public CopticChronology() {
}
/**
* Resolve singleton.
*
@@ -151,12 +151,12 @@
//-----------------------------------------------------------------------
/**
* Gets the ID of the chronology - 'Coptic'.
* <p>
- * The ID uniquely identifies the {@code Chrono}.
- * It can be used to lookup the {@code Chrono} using {@link #of(String)}.
+ * The ID uniquely identifies the {@code Chronology}.
+ * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
*
* @return the chronology ID - 'Coptic'
* @see #getCalendarType()
*/
@Override
@@ -167,11 +167,11 @@
/**
* Gets the calendar type of the underlying calendar system - 'coptic'.
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
- * It can be used to lookup the {@code Chrono} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
* @return the calendar system type - 'coptic'
* @see #getId()
@@ -181,21 +181,21 @@
return "coptic";
}
//-----------------------------------------------------------------------
@Override
- public ChronoLocalDate<CopticChrono> date(int prolepticYear, int month, int dayOfMonth) {
+ public CopticDate date(int prolepticYear, int month, int dayOfMonth) {
return new CopticDate(prolepticYear, month, dayOfMonth);
}
@Override
- public ChronoLocalDate<CopticChrono> dateYearDay(int prolepticYear, int dayOfYear) {
+ public CopticDate dateYearDay(int prolepticYear, int dayOfYear) {
return new CopticDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1);
}
@Override
- public ChronoLocalDate<CopticChrono> date(TemporalAccessor dateTime) {
+ public CopticDate date(TemporalAccessor dateTime) {
if (dateTime instanceof CopticDate) {
return (CopticDate) dateTime;
}
return CopticDate.ofEpochDay(dateTime.getLong(EPOCH_DAY));
}
@@ -215,25 +215,25 @@
public boolean isLeapYear(long prolepticYear) {
return Math.floorMod(prolepticYear, 4) == 3;
}
@Override
- public int prolepticYear(Era<CopticChrono> era, int yearOfEra) {
+ public int prolepticYear(Era era, int yearOfEra) {
if (era instanceof CopticEra == false) {
throw new DateTimeException("Era must be CopticEra");
}
return (era == CopticEra.AM ? yearOfEra : 1 - yearOfEra);
}
@Override
- public Era<CopticChrono> eraOf(int eraValue) {
+ public Era eraOf(int eraValue) {
return CopticEra.of(eraValue);
}
@Override
- public List<Era<CopticChrono>> eras() {
- return Arrays.<Era<CopticChrono>>asList(CopticEra.values());
+ public List<Era> eras() {
+ return Arrays.<Era>asList(CopticEra.values());
}
//-----------------------------------------------------------------------
@Override
public ValueRange range(ChronoField field) {