diff --git a/src-extra/main/java/javax/time/extra/ISOPeriod.java b/src-extra/main/java/javax/time/extra/ISOPeriod.java index 365c5fb7..c783fbe4 100644 --- a/src-extra/main/java/javax/time/extra/ISOPeriod.java +++ b/src-extra/main/java/javax/time/extra/ISOPeriod.java @@ -422,8 +422,8 @@ public static ISOPeriod of(Duration duration) { * @throws ArithmeticException if the period exceeds the supported range */ public static ISOPeriod between(LocalDate startDate, LocalDate endDate) { - long startMonth = startDate.getYear() * 12L + startDate.getMonthOfYear().ordinal(); // safe - long endMonth = endDate.getYear() * 12L + endDate.getMonthOfYear().ordinal(); // safe + long startMonth = startDate.getYear() * 12L + startDate.getMonth().ordinal(); // safe + long endMonth = endDate.getYear() * 12L + endDate.getMonth().ordinal(); // safe long totalMonths = endMonth - startMonth; // safe int days = endDate.getDayOfMonth() - startDate.getDayOfMonth(); if (totalMonths > 0 && days < 0) { @@ -432,7 +432,7 @@ public static ISOPeriod between(LocalDate startDate, LocalDate endDate) { days = (int) (endDate.toEpochDay() - calcDate.toEpochDay()); // safe } else if (totalMonths < 0 && days > 0) { totalMonths++; - days -= endDate.getMonthOfYear().lengthInDays(endDate.isLeapYear()); + days -= endDate.getMonth().lengthInDays(endDate.isLeapYear()); } long years = totalMonths / 12; // safe int months = (int) (totalMonths % 12); // safe @@ -454,10 +454,10 @@ public static ISOPeriod between(LocalDate startDate, LocalDate endDate) { * @throws ArithmeticException if the period exceeds the supported range */ public static ISOPeriod yearsBetween(LocalDate startDate, LocalDate endDate) { - long startMonth = startDate.getYear() * 12L + startDate.getMonthOfYear().ordinal(); // safe - long endMonth = endDate.getYear() * 12L + endDate.getMonthOfYear().ordinal(); // safe + long startMonth = startDate.getYear() * 12L + startDate.getMonth().ordinal(); // safe + long endMonth = endDate.getYear() * 12L + endDate.getMonth().ordinal(); // safe long years = (endMonth - startMonth) / 12; // safe - if (endDate.getMonthOfYear() == startDate.getMonthOfYear()) { + if (endDate.getMonth() == startDate.getMonth()) { if (years > 0 && endDate.getDayOfMonth() < startDate.getDayOfMonth()) { years--; // safe } else if (years < 0 && endDate.getDayOfMonth() > startDate.getDayOfMonth()) { @@ -482,8 +482,8 @@ public static ISOPeriod yearsBetween(LocalDate startDate, LocalDate endDate) { * @throws ArithmeticException if the period exceeds the supported range */ public static ISOPeriod monthsBetween(LocalDate startDate, LocalDate endDate) { - long startMonth = startDate.getYear() * 12L + startDate.getMonthOfYear().ordinal(); // safe - long endMonth = endDate.getYear() * 12L + endDate.getMonthOfYear().ordinal(); // safe + long startMonth = startDate.getYear() * 12L + startDate.getMonth().ordinal(); // safe + long endMonth = endDate.getYear() * 12L + endDate.getMonth().ordinal(); // safe long months = endMonth - startMonth; // safe if (months > 0 && endDate.getDayOfMonth() < startDate.getDayOfMonth()) { months--; // safe diff --git a/src-extra/test/java/javax/time/extra/TestWeekendRules.java b/src-extra/test/java/javax/time/extra/TestWeekendRules.java index 34499f88..f34ec10a 100644 --- a/src-extra/test/java/javax/time/extra/TestWeekendRules.java +++ b/src-extra/test/java/javax/time/extra/TestWeekendRules.java @@ -113,7 +113,7 @@ public void test_nextNonWeekendDay() { } } else { assertEquals(test.getYear(), 2008); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), 1); } } diff --git a/src-openjdk/test/java/java/util/TestGregorianCalendar.java b/src-openjdk/test/java/java/util/TestGregorianCalendar.java index 85042012..889d0a9b 100644 --- a/src-openjdk/test/java/java/util/TestGregorianCalendar.java +++ b/src-openjdk/test/java/java/util/TestGregorianCalendar.java @@ -149,7 +149,7 @@ public void test_toLocalDateTime() { for (int i = 0; i < 500; i++) { LocalDateTime test = gcal.toLocalDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -164,7 +164,7 @@ public void test_toLocalDateTime_endOfDay() { for (int i = 0; i < 500; i++) { LocalDateTime test = gcal.toLocalDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), (24L * 60L * 60L - 1L) * 1000000000L); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -179,7 +179,7 @@ public void test_toLocalDateTime_fixedOffset() { for (int i = 0; i < 500; i++) { LocalDateTime test = gcal.toLocalDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -194,7 +194,7 @@ public void test_toLocalDateTime_variableOffset() { for (int i = 0; i < 500; i++) { LocalDateTime test = gcal.toLocalDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -211,7 +211,7 @@ public void test_toLocalDateTime_manualOffset() { for (int i = 0; i < 500; i++) { LocalDateTime test = gcal.toLocalDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -229,7 +229,7 @@ public void test_toLocalDate() { for (int i = 0; i < 500; i++) { LocalDate test = gcal.toLocalDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); gcal.add(Calendar.DATE, 1); @@ -243,7 +243,7 @@ public void test_toLocalDate_endOfDay() { for (int i = 0; i < 500; i++) { LocalDate test = gcal.toLocalDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); gcal.add(Calendar.DATE, 1); @@ -257,7 +257,7 @@ public void test_toLocalDate_fixedOffset() { for (int i = 0; i < 500; i++) { LocalDate test = gcal.toLocalDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); gcal.add(Calendar.DATE, 1); @@ -271,7 +271,7 @@ public void test_toLocalDate_variableOffset() { for (int i = 0; i < 500; i++) { LocalDate test = gcal.toLocalDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); gcal.add(Calendar.DATE, 1); @@ -287,7 +287,7 @@ public void test_toLocalDate_manualOffset() { for (int i = 0; i < 500; i++) { LocalDate test = gcal.toLocalDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); gcal.add(Calendar.DATE, 1); @@ -368,7 +368,7 @@ public void test_toOffsetDateTime() { for (int i = 0; i < 500; i++) { OffsetDateTime test = gcal.toOffsetDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toOffsetTime().toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -384,7 +384,7 @@ public void test_toOffsetDateTime_endOfDay() { for (int i = 0; i < 500; i++) { OffsetDateTime test = gcal.toOffsetDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toOffsetTime().toLocalTime().toNanoOfDay(), (24L * 60L * 60L - 1L) * 1000000000L); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -400,7 +400,7 @@ public void test_toOffsetDateTime_fixedOffset() { for (int i = 0; i < 500; i++) { OffsetDateTime test = gcal.toOffsetDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toOffsetTime().toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -416,7 +416,7 @@ public void test_toOffsetDateTime_variableOffset() { for (int i = 0; i < 500; i++) { OffsetDateTime test = gcal.toOffsetDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toOffsetTime().toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -435,7 +435,7 @@ public void test_toOffsetDateTime_manualOffset() { for (int i = 0; i < 500; i++) { OffsetDateTime test = gcal.toOffsetDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toOffsetTime().toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -454,7 +454,7 @@ public void test_toOffsetDate() { for (int i = 0; i < 500; i++) { OffsetDate test = gcal.toOffsetDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); assertEquals(test.getOffset().getID(), "Z"); @@ -469,7 +469,7 @@ public void test_toOffsetDate_endOfDay() { for (int i = 0; i < 500; i++) { OffsetDate test = gcal.toOffsetDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); assertEquals(test.getOffset().getID(), "Z"); @@ -484,7 +484,7 @@ public void test_toOffsetDate_fixedOffset() { for (int i = 0; i < 500; i++) { OffsetDate test = gcal.toOffsetDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); assertEquals(test.getOffset().getID(), "+12:00"); @@ -499,7 +499,7 @@ public void test_toOffsetDate_variableOffset() { for (int i = 0; i < 500; i++) { OffsetDate test = gcal.toOffsetDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); boolean isDST = TimeZone.getTimeZone("Europe/Paris").inDaylightTime(gcal.getTime()); @@ -517,7 +517,7 @@ public void test_toOffsetDate_manualOffset() { for (int i = 0; i < 500; i++) { OffsetDate test = gcal.toOffsetDate(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); assertEquals(test.getOffset().getID(), "+00:45"); @@ -601,7 +601,7 @@ public void test_toZonedDateTime() { for (int i = 0; i < 500; i++) { ZonedDateTime test = gcal.toZonedDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -618,7 +618,7 @@ public void test_toZonedDateTime_endOfDay() { for (int i = 0; i < 500; i++) { ZonedDateTime test = gcal.toZonedDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), (24L * 60L * 60L - 1L) * 1000000000L); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -635,7 +635,7 @@ public void test_toZonedDateTime_fixedZoned() { for (int i = 0; i < 500; i++) { ZonedDateTime test = gcal.toZonedDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -652,7 +652,7 @@ public void test_toZonedDateTime_variableZoned() { for (int i = 0; i < 500; i++) { ZonedDateTime test = gcal.toZonedDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); @@ -673,7 +673,7 @@ public void test_toZonedDateTime_manualZoned() { for (int i = 0; i < 500; i++) { ZonedDateTime test = gcal.toZonedDateTime(); assertEquals(test.getYear(), gcal.get(Calendar.YEAR)); - assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1); + assertEquals(test.getMonth().getValue(), gcal.get(Calendar.MONTH) + 1); assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE)); assertEquals(test.toLocalTime().toNanoOfDay(), 0); assertEquals(test.getYear(), i < 366 ? 2008 : 2009); diff --git a/src-standard/main/java/javax/time/chrono/Chrono.java b/src-standard/main/java/javax/time/chrono/Chrono.java index f9f154d1..8220ea35 100644 --- a/src-standard/main/java/javax/time/chrono/Chrono.java +++ b/src-standard/main/java/javax/time/chrono/Chrono.java @@ -141,21 +141,21 @@ public static Set getAvailableNames() { * * @param era the calendar system era of the correct type, not null * @param yearOfEra the calendar system year-of-era - * @param monthOfYear the calendar system month-of-year + * @param month the calendar system month-of-year * @param dayOfMonth the calendar system day-of-month * @return the date in this calendar system, not null */ - public abstract ChronoDate date(Era era, int yearOfEra, int monthOfYear, int dayOfMonth); + public abstract ChronoDate date(Era era, int yearOfEra, int month, int dayOfMonth); /** * Creates a date in this calendar system from the proleptic-year, month-of-year and day-of-month fields. * * @param prolepticYear the calendar system proleptic-year - * @param monthOfYear the calendar system month-of-year + * @param month the calendar system month-of-year * @param dayOfMonth the calendar system day-of-month * @return the date in this calendar system, not null */ - public abstract ChronoDate date(int prolepticYear, int monthOfYear, int dayOfMonth); + public abstract ChronoDate date(int prolepticYear, int month, int dayOfMonth); /** * Creates a date in this calendar system from another calendrical object. diff --git a/src-standard/main/java/javax/time/chrono/ChronoDate.java b/src-standard/main/java/javax/time/chrono/ChronoDate.java index 6bc10a54..45b190c5 100644 --- a/src-standard/main/java/javax/time/chrono/ChronoDate.java +++ b/src-standard/main/java/javax/time/chrono/ChronoDate.java @@ -198,7 +198,7 @@ public int getProlepticYear() { * * @return the month-of-year, within the valid range for the chronology */ - public int getMonthOfYear() { + public int getMonth() { return DateTimes.safeToInt(get(LocalDateTimeField.MONTH_OF_YEAR)); } @@ -333,11 +333,11 @@ public ChronoDate withYearOfEra(int yearOfEra) { *

* This instance is immutable and unaffected by this method call. * - * @param monthOfYear the month-of-year to set + * @param month the month-of-year to set * @return a date based on this one with the specified month-of-year, not null */ - public ChronoDate withMonthOfYear(int monthOfYear) { - return with(LocalDateTimeField.MONTH_OF_YEAR, monthOfYear); + public ChronoDate withMonth(int month) { + return with(LocalDateTimeField.MONTH_OF_YEAR, month); } /** @@ -682,7 +682,7 @@ public LocalDate toLocalDate() { * The comparison is based on the time-line position of the dates. * Only two dates with the same calendar system can be compared. *

- * The default implementation uses {@link #getProlepticYear()}, {@link #getMonthOfYear()} + * The default implementation uses {@link #getProlepticYear()}, {@link #getMonth()} * and {@link #getDayOfMonth()}. * * @param other the other date to compare to, not null @@ -692,7 +692,7 @@ public LocalDate toLocalDate() { public int compareTo(ChronoDate other) { int cmp = DateTimes.safeCompare(getProlepticYear(), other.getProlepticYear()); if (cmp == 0) { - cmp = DateTimes.safeCompare(getMonthOfYear(), other.getMonthOfYear()); + cmp = DateTimes.safeCompare(getMonth(), other.getMonth()); if (cmp == 0) { cmp = DateTimes.safeCompare(getDayOfMonth(), other.getDayOfMonth()); } @@ -707,7 +707,7 @@ public int compareTo(ChronoDate other) { * Only two dates with the same calendar system will compare equal. *

* The default implementation uses {@link #getChronology()}, #getProlepticYear()}, - * {@link #getMonthOfYear()} and {@link #getDayOfMonth()}. + * {@link #getMonth()} and {@link #getDayOfMonth()}. * * @param obj the object to check, null returns false * @return true if this is equal to the other date @@ -721,7 +721,7 @@ public boolean equals(Object obj) { ChronoDate other = (ChronoDate) obj; return getChronology().equals(other.getChronology()) && getProlepticYear() == other.getProlepticYear() && - getMonthOfYear() == other.getMonthOfYear() && + getMonth() == other.getMonth() && getDayOfMonth() == other.getDayOfMonth(); } return false; @@ -731,13 +731,13 @@ public boolean equals(Object obj) { * A hash code for this date. *

* The default implementation uses {@link #getChronology()}, #getProlepticYear()}, - * {@link #getMonthOfYear()} and {@link #getDayOfMonth()}. + * {@link #getMonth()} and {@link #getDayOfMonth()}. * * @return a suitable hash code */ @Override public int hashCode() { - return getChronology().hashCode() ^ Integer.rotateLeft(getProlepticYear(), 16) ^ (getMonthOfYear() << 8) ^ getDayOfMonth(); + return getChronology().hashCode() ^ Integer.rotateLeft(getProlepticYear(), 16) ^ (getMonth() << 8) ^ getDayOfMonth(); } //----------------------------------------------------------------------- @@ -751,7 +751,7 @@ public int hashCode() { @Override public String toString() { int yearValue = getYearOfEra(); - int monthValue = getMonthOfYear(); + int monthValue = getMonth(); int dayValue = getDayOfMonth(); int absYear = Math.abs(yearValue); StringBuilder buf = new StringBuilder(12); diff --git a/src-standard/main/java/javax/time/chrono/CopticChrono.java b/src-standard/main/java/javax/time/chrono/CopticChrono.java index 3f60b14c..f92b290e 100644 --- a/src-standard/main/java/javax/time/chrono/CopticChrono.java +++ b/src-standard/main/java/javax/time/chrono/CopticChrono.java @@ -98,16 +98,16 @@ public String getName() { //----------------------------------------------------------------------- @Override - public ChronoDate date(Era era, int yearOfEra, int monthOfYear, int dayOfMonth) { + public ChronoDate date(Era era, int yearOfEra, int month, int dayOfMonth) { if (era instanceof CopticEra) { throw new CalendricalException("Era must be a CopticEra"); } - return date(prolepticYear((CopticEra) era, yearOfEra), monthOfYear, dayOfMonth); + return date(prolepticYear((CopticEra) era, yearOfEra), month, dayOfMonth); } @Override - public ChronoDate date(int prolepticYear, int monthOfYear, int dayOfMonth) { - return new CopticDate(prolepticYear, monthOfYear, dayOfMonth); + public ChronoDate date(int prolepticYear, int month, int dayOfMonth) { + return new CopticDate(prolepticYear, month, dayOfMonth); } @Override diff --git a/src-standard/main/java/javax/time/chrono/CopticDate.java b/src-standard/main/java/javax/time/chrono/CopticDate.java index f8f9d614..2dae886d 100644 --- a/src-standard/main/java/javax/time/chrono/CopticDate.java +++ b/src-standard/main/java/javax/time/chrono/CopticDate.java @@ -105,13 +105,13 @@ private static CopticDate resolvePreviousValid(int prolepticYear, int month, int * Creates an instance. * * @param prolepticYear the Coptic proleptic-year - * @param monthOfYear the Coptic month, from 1 to 13 + * @param month the Coptic month, from 1 to 13 * @param dayOfMonth the Coptic day-of-month, from 1 to 30 * @throws CalendricalException if the date is invalid */ - CopticDate(int prolepticYear, int monthOfYear, int dayOfMonth) { + CopticDate(int prolepticYear, int month, int dayOfMonth) { this.prolepticYear = prolepticYear; - this.month = (short) monthOfYear; + this.month = (short) month; this.day = (short) dayOfMonth; } diff --git a/src-standard/main/java/javax/time/chrono/ISOChrono.java b/src-standard/main/java/javax/time/chrono/ISOChrono.java index a34998a4..d408e1cb 100644 --- a/src-standard/main/java/javax/time/chrono/ISOChrono.java +++ b/src-standard/main/java/javax/time/chrono/ISOChrono.java @@ -99,16 +99,16 @@ public String getName() { //----------------------------------------------------------------------- @Override - public ChronoDate date(Era era, int yearOfEra, int monthOfYear, int dayOfMonth) { + public ChronoDate date(Era era, int yearOfEra, int month, int dayOfMonth) { if (era instanceof ISOEra) { throw new CalendricalException("Era must be a ISOEra"); } - return date(prolepticYear((ISOEra) era, yearOfEra), monthOfYear, dayOfMonth); + return date(prolepticYear((ISOEra) era, yearOfEra), month, dayOfMonth); } @Override - public ChronoDate date(int prolepticYear, int monthOfYear, int dayOfMonth) { - return new ISODate(LocalDate.of(prolepticYear, monthOfYear, dayOfMonth)); + public ChronoDate date(int prolepticYear, int month, int dayOfMonth) { + return new ISODate(LocalDate.of(prolepticYear, month, dayOfMonth)); } @Override diff --git a/src-standard/main/java/javax/time/chrono/ISODate.java b/src-standard/main/java/javax/time/chrono/ISODate.java index 8e5d8e30..24f2856c 100644 --- a/src-standard/main/java/javax/time/chrono/ISODate.java +++ b/src-standard/main/java/javax/time/chrono/ISODate.java @@ -84,7 +84,7 @@ public long get(DateTimeField field) { case DAY_OF_WEEK: return isoDate.getDayOfWeek().getValue(); case DAY_OF_MONTH: return isoDate.getDayOfMonth(); case DAY_OF_YEAR: return isoDate.getDayOfYear(); - case MONTH_OF_YEAR: return isoDate.getMonthOfYear().getValue(); + case MONTH_OF_YEAR: return isoDate.getMonth().getValue(); case YEAR_OF_ERA: return (isoDate.getYear() >= 1 ? isoDate.getYear() : 1 - isoDate.getYear()); case YEAR: return isoDate.getYear(); case ERA: return (isoDate.getYear() >= 1 ? 1 : 0); @@ -105,7 +105,7 @@ public ISODate with(DateTimeField field, long newValue) { case DAY_OF_WEEK: return plusDays(nvalue - getDayOfWeek().getValue()); case DAY_OF_MONTH: return with(isoDate.withDayOfMonth(nvalue)); case DAY_OF_YEAR: return with(isoDate.withDayOfYear(nvalue)); - case MONTH_OF_YEAR: return with(isoDate.withMonthOfYear(nvalue)); + case MONTH_OF_YEAR: return with(isoDate.withMonth(nvalue)); case YEAR_OF_ERA: return with(isoDate.withYear(isoDate.getYear() >= 1 ? nvalue : (1 - nvalue))); case YEAR: return with(isoDate.withYear(nvalue)); case ERA: return with(isoDate.withYear(1 - isoDate.getYear())); diff --git a/src-standard/main/java/javax/time/chrono/MinguoChrono.java b/src-standard/main/java/javax/time/chrono/MinguoChrono.java index 06f258b2..d3c09cb4 100644 --- a/src-standard/main/java/javax/time/chrono/MinguoChrono.java +++ b/src-standard/main/java/javax/time/chrono/MinguoChrono.java @@ -102,16 +102,16 @@ public String getName() { //----------------------------------------------------------------------- @Override - public ChronoDate date(Era era, int yearOfEra, int monthOfYear, int dayOfMonth) { + public ChronoDate date(Era era, int yearOfEra, int month, int dayOfMonth) { if (era instanceof MinguoEra) { throw new CalendricalException("Era must be a MinguoEra"); } - return date(prolepticYear((MinguoEra) era, yearOfEra), monthOfYear, dayOfMonth); + return date(prolepticYear((MinguoEra) era, yearOfEra), month, dayOfMonth); } @Override - public ChronoDate date(int prolepticYear, int monthOfYear, int dayOfMonth) { - return new MinguoDate(LocalDate.of(prolepticYear - YEARS_DIFFERENCE, monthOfYear, dayOfMonth)); + public ChronoDate date(int prolepticYear, int month, int dayOfMonth) { + return new MinguoDate(LocalDate.of(prolepticYear - YEARS_DIFFERENCE, month, dayOfMonth)); } @Override diff --git a/src-standard/main/java/javax/time/chrono/MinguoDate.java b/src-standard/main/java/javax/time/chrono/MinguoDate.java index 625599f6..bdce3ece 100644 --- a/src-standard/main/java/javax/time/chrono/MinguoDate.java +++ b/src-standard/main/java/javax/time/chrono/MinguoDate.java @@ -85,7 +85,7 @@ public long get(DateTimeField field) { case DAY_OF_WEEK: return isoDate.getDayOfWeek().getValue(); case DAY_OF_MONTH: return isoDate.getDayOfMonth(); case DAY_OF_YEAR: return isoDate.getDayOfYear(); - case MONTH_OF_YEAR: return isoDate.getMonthOfYear().getValue(); + case MONTH_OF_YEAR: return isoDate.getMonth().getValue(); case YEAR_OF_ERA: { int prolepticYear = getProlepticYear(); return (prolepticYear >= 1 ? prolepticYear : 1 - prolepticYear); @@ -108,7 +108,7 @@ public MinguoDate with(DateTimeField field, long newValue) { case DAY_OF_WEEK: return plusDays(newValue - getDayOfWeek().getValue()); case DAY_OF_MONTH: return with(isoDate.withDayOfMonth(nvalue)); case DAY_OF_YEAR: return with(isoDate.withDayOfYear(nvalue)); - case MONTH_OF_YEAR: return with(isoDate.withMonthOfYear(nvalue)); + case MONTH_OF_YEAR: return with(isoDate.withMonth(nvalue)); case YEAR_OF_ERA: return with(isoDate.withYear( getProlepticYear() >= 1 ? nvalue + YEARS_DIFFERENCE : (1 - nvalue) + YEARS_DIFFERENCE)); case YEAR: return with(isoDate.withYear(nvalue + YEARS_DIFFERENCE)); diff --git a/src-standard/main/java/javax/time/extended/MonthDay.java b/src-standard/main/java/javax/time/extended/MonthDay.java index 5d33fb95..59e90c2d 100644 --- a/src-standard/main/java/javax/time/extended/MonthDay.java +++ b/src-standard/main/java/javax/time/extended/MonthDay.java @@ -130,7 +130,7 @@ public static MonthDay now() { */ public static MonthDay now(Clock clock) { final LocalDate now = LocalDate.now(clock); // called once - return MonthDay.of(now.getMonthOfYear(), now.getDayOfMonth()); + return MonthDay.of(now.getMonth(), now.getDayOfMonth()); } //----------------------------------------------------------------------- @@ -280,7 +280,7 @@ public long get(DateTimeField field) { * * @return the month-of-year, not null */ - public Month getMonthOfYear() { + public Month getMonth() { return month; } @@ -303,7 +303,7 @@ public MonthDay with(DateTimeField field, long newValue) { f.checkValidValue(newValue); switch (f) { case DAY_OF_MONTH: return withDayOfMonth((int) newValue); - case MONTH_OF_YEAR: return withMonthOfYear((int) newValue); + case MONTH_OF_YEAR: return withMonth((int) newValue); } throw new CalendricalException(field.getName() + " not valid for MonthDay"); } @@ -323,7 +323,7 @@ public MonthDay with(DateTimeField field, long newValue) { * @return a {@code MonthDay} based on this month-day with the requested month, not null * @throws CalendricalException if the month-of-year value is invalid */ - public MonthDay withMonthOfYear(int month) { + public MonthDay withMonth(int month) { Month moy = Month.of(month); int maxDays = moy.maxLengthInDays(); if (day > maxDays) { @@ -375,7 +375,7 @@ public MonthDay withDayOfMonth(int dayOfMonth) { */ public LocalDate adjustDate(LocalDate date) { DateTimes.checkNotNull(date, "LocalDate must not be null"); - if (date.getMonthOfYear() == month && date.getDayOfMonth() == day) { + if (date.getMonth() == month && date.getDayOfMonth() == day) { return date; } return LocalDate.of(date.getYear(), month, isValidYear(date.getYear()) ? day : 28); @@ -450,7 +450,7 @@ public R extract(Class type) { @Override public MonthDay with(CalendricalAdjuster adjuster) { if (adjuster instanceof Month) { - return withMonthOfYear(((Month) adjuster).getValue()); + return withMonth(((Month) adjuster).getValue()); } else if (adjuster instanceof MonthDay) { return ((MonthDay) adjuster); } diff --git a/src-standard/main/java/javax/time/extended/QuarterOfYear.java b/src-standard/main/java/javax/time/extended/QuarterOfYear.java index 673dcfd0..f74feb18 100644 --- a/src-standard/main/java/javax/time/extended/QuarterOfYear.java +++ b/src-standard/main/java/javax/time/extended/QuarterOfYear.java @@ -285,7 +285,7 @@ public QuarterOfYear with(CalendricalAdjuster adjuster) { @Override public LocalDate adjustDate(LocalDate date) { - return date.plusMonths(3 * (ofMonth(date.getMonthOfYear()).getValue() - getValue())); + return date.plusMonths(3 * (ofMonth(date.getMonth()).getValue() - getValue())); } //----------------------------------------------------------------------- diff --git a/src-standard/main/java/javax/time/extended/QuarterYearField.java b/src-standard/main/java/javax/time/extended/QuarterYearField.java index 290eedc9..9983464e 100644 --- a/src-standard/main/java/javax/time/extended/QuarterYearField.java +++ b/src-standard/main/java/javax/time/extended/QuarterYearField.java @@ -111,7 +111,7 @@ public DateTimeValueRange range(CalendricalObject calendrical) { LocalDate date = calendrical.extract(LocalDate.class); if (date != null) { if (this == DAY_OF_QUARTER) { - switch (date.getMonthOfYear().ordinal() / 3) { + switch (date.getMonth().ordinal() / 3) { case 0: return (date.isLeapYear() ? RANGE_DOQ_91 : RANGE_DOQ_90); case 1: return RANGE_DOQ_91; case 2: return RANGE_DOQ_92; @@ -129,8 +129,8 @@ public long get(CalendricalObject calendrical) { if (date != null) { switch (this) { case DAY_OF_QUARTER: return doq(date); - case MONTH_OF_QUARTER: return (date.getMonthOfYear().ordinal() % 3) + 1; - case QUARTER_OF_YEAR: return (date.getMonthOfYear().ordinal() / 3) + 1; + case MONTH_OF_QUARTER: return (date.getMonth().ordinal() % 3) + 1; + case QUARTER_OF_YEAR: return (date.getMonth().ordinal() / 3) + 1; } throw new IllegalStateException("Unreachable"); } @@ -159,9 +159,9 @@ public R set(R calendrical, long newValue) { switch (this) { case DAY_OF_QUARTER: date = date.plusDays(value0 - (doq(date) - 1)); break; - case MONTH_OF_QUARTER: date = date.plusMonths(value0 - (date.getMonthOfYear().ordinal() % 3)); + case MONTH_OF_QUARTER: date = date.plusMonths(value0 - (date.getMonth().ordinal() % 3)); break; - case QUARTER_OF_YEAR: date = date.plusMonths((value0 - (date.getMonthOfYear().ordinal() / 3)) * 3); + case QUARTER_OF_YEAR: date = date.plusMonths((value0 - (date.getMonth().ordinal() / 3)) * 3); break; default: throw new IllegalStateException("Unreachable"); @@ -185,7 +185,7 @@ public R roll(R calendrical, long roll) { } private static int doq(LocalDate date) { - return date.getDayOfYear() - QUARTER_DAYS[(date.getMonthOfYear().ordinal() / 3) + (date.isLeapYear() ? 4 : 0)]; + return date.getDayOfYear() - QUARTER_DAYS[(date.getMonth().ordinal() / 3) + (date.isLeapYear() ? 4 : 0)]; } //----------------------------------------------------------------------- diff --git a/src-standard/main/java/javax/time/extended/Year.java b/src-standard/main/java/javax/time/extended/Year.java index e55a358b..b0a082cb 100644 --- a/src-standard/main/java/javax/time/extended/Year.java +++ b/src-standard/main/java/javax/time/extended/Year.java @@ -502,7 +502,7 @@ public YearMonth atMonth(int month) { * @throws CalendricalException if the month-day is February 29th and this is not a leap year */ public LocalDate atMonthDay(MonthDay monthDay) { - return LocalDate.of(year, monthDay.getMonthOfYear(), monthDay.getDayOfMonth()); + return LocalDate.of(year, monthDay.getMonth(), monthDay.getDayOfMonth()); } /** diff --git a/src-standard/main/java/javax/time/extended/YearMonth.java b/src-standard/main/java/javax/time/extended/YearMonth.java index 9dbf79ef..0f54ddb1 100644 --- a/src-standard/main/java/javax/time/extended/YearMonth.java +++ b/src-standard/main/java/javax/time/extended/YearMonth.java @@ -131,7 +131,7 @@ public static YearMonth now() { */ public static YearMonth now(Clock clock) { final LocalDate now = LocalDate.now(clock); // called once - return YearMonth.of(now.getYear(), now.getMonthOfYear()); + return YearMonth.of(now.getYear(), now.getMonth()); } //----------------------------------------------------------------------- @@ -244,7 +244,7 @@ public long get(DateTimeField field) { if (field instanceof LocalDateTimeField) { switch ((LocalDateTimeField) field) { case MONTH_OF_YEAR: return month.getValue(); - case EPOCH_MONTH: return ((year - 1970) * 12L) + getMonthOfYear().ordinal(); + case EPOCH_MONTH: return ((year - 1970) * 12L) + getMonth().ordinal(); case YEAR_OF_ERA: return (year < 1 ? 1 - year : year); case YEAR: return year; case ERA: return (year < 1 ? 0 : 1); @@ -277,7 +277,7 @@ public int getYear() { * * @return the month-of-year, not null */ - public Month getMonthOfYear() { + public Month getMonth() { return month; } @@ -288,7 +288,7 @@ public YearMonth with(DateTimeField field, long newValue) { LocalDateTimeField f = (LocalDateTimeField) field; f.checkValidValue(newValue); switch (f) { - case MONTH_OF_YEAR: return withMonthOfYear((int) newValue); + case MONTH_OF_YEAR: return withMonth((int) newValue); case EPOCH_MONTH: return plusMonths(newValue - get(EPOCH_MONTH)); case YEAR_OF_ERA: return withYear((int) (year < 1 ? 1 - newValue : newValue)); case YEAR: return withYear((int) newValue); @@ -323,7 +323,7 @@ public YearMonth withYear(int year) { * @return a {@code YearMonth} based on this year-month with the requested month, not null * @throws CalendricalException if the month-of-year value is invalid */ - public YearMonth withMonthOfYear(int month) { + public YearMonth withMonth(int month) { return with(year, Month.of(month)); } @@ -446,7 +446,7 @@ public YearMonth minusMonths(long months) { */ public LocalDate adjustDate(LocalDate date) { DateTimes.checkNotNull(date, "LocalDate must not be null"); - if (date.getYear() == year && date.getMonthOfYear() == month) { + if (date.getYear() == year && date.getMonth() == month) { return date; } return LocalDate.of(year, month, Math.min(date.getDayOfMonth(), lengthInDays())); @@ -537,7 +537,7 @@ public YearMonth with(CalendricalAdjuster adjuster) { if (adjuster instanceof Year) { return withYear(((Year) adjuster).getValue()); } else if (adjuster instanceof Month) { - return withMonthOfYear(((Month) adjuster).getValue()); + return withMonth(((Month) adjuster).getValue()); } else if (adjuster instanceof YearMonth) { return ((YearMonth) adjuster); } diff --git a/src-standard/main/java/javax/time/zone/TZDBZoneRulesCompiler.java b/src-standard/main/java/javax/time/zone/TZDBZoneRulesCompiler.java index df01716d..b7607d7b 100644 --- a/src-standard/main/java/javax/time/zone/TZDBZoneRulesCompiler.java +++ b/src-standard/main/java/javax/time/zone/TZDBZoneRulesCompiler.java @@ -976,7 +976,7 @@ void adjustToFowards(int year) { if (adjustForwards == false && dayOfMonth > 0) { LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6); dayOfMonth = adjustedDate.getDayOfMonth(); - month = adjustedDate.getMonthOfYear(); + month = adjustedDate.getMonth(); adjustForwards = true; } } diff --git a/src-standard/test/java/javax/time/Performance.java b/src-standard/test/java/javax/time/Performance.java index 383dc988..c6c5f5ce 100644 --- a/src-standard/test/java/javax/time/Performance.java +++ b/src-standard/test/java/javax/time/Performance.java @@ -174,7 +174,7 @@ private static void queryListDateTime(List list) { long start = System.nanoTime(); for (LocalDateTime dt : list) { total += dt.getYear(); - total += dt.getMonthOfYear().getValue(); + total += dt.getMonth().getValue(); total += dt.getDayOfMonth(); total += dt.getHourOfDay(); total += dt.getMinuteOfHour(); @@ -241,7 +241,7 @@ private static void queryListLocalDate(List list) { long start = System.nanoTime(); for (LocalDate dt : list) { total += dt.getYear(); - total += dt.getMonthOfYear().getValue(); + total += dt.getMonth().getValue(); total += dt.getDayOfMonth(); } long end = System.nanoTime(); @@ -358,7 +358,7 @@ private static void queryListZonedDateTime(List list) { long start = System.nanoTime(); for (ZonedDateTime dt : list) { total += dt.getYear(); - total += dt.getMonthOfYear().getValue(); + total += dt.getMonth().getValue(); total += dt.getDayOfMonth(); total += dt.getHourOfDay(); total += dt.getMinuteOfHour(); diff --git a/src-standard/test/java/javax/time/TestFluentAPI.java b/src-standard/test/java/javax/time/TestFluentAPI.java index 61dea319..f5fb4973 100644 --- a/src-standard/test/java/javax/time/TestFluentAPI.java +++ b/src-standard/test/java/javax/time/TestFluentAPI.java @@ -98,13 +98,13 @@ public static void main(String[] args) { tod.withHourOfDay(12).withMinuteOfHour(30); - QuarterOfYear q = QuarterOfYear.ofMonth(date.getMonthOfYear()); + QuarterOfYear q = QuarterOfYear.ofMonth(date.getMonth()); MonthDay md = MonthDay.of(FEBRUARY, 4); md = md.with(MARCH); DAY_OF_MONTH.getValueRange().getMaximum(); - date.getMonthOfYear().maxLengthInDays(); + date.getMonth().maxLengthInDays(); DAY_OF_MONTH.range(date).getMaximum(); FEBRUARY.maxLengthInDays(); // DAY_OF_MONTH.getValueRange(FEBRUARY); diff --git a/src-standard/test/java/javax/time/UsabilityBasic.java b/src-standard/test/java/javax/time/UsabilityBasic.java index 9834f5f8..de2a7f5b 100644 --- a/src-standard/test/java/javax/time/UsabilityBasic.java +++ b/src-standard/test/java/javax/time/UsabilityBasic.java @@ -83,11 +83,11 @@ private static void simpleCalendar() { date = date.withDayOfMonth(1); System.out.println(date); - int month = date.getMonthOfYear().getValue(); + int month = date.getMonth().getValue(); date = date.with(DateAdjusters.previousOrCurrent(DayOfWeek.MONDAY)); System.out.println(date); - while (date.getMonthOfYear().getValue() <= month) { + while (date.getMonth().getValue() <= month) { String row = ""; for (int i = 0; i < 7; i++) { row += date.getDayOfMonth() + " "; diff --git a/src-standard/test/java/javax/time/UsabilityChrono.java b/src-standard/test/java/javax/time/UsabilityChrono.java index d696795b..ec4f5abb 100644 --- a/src-standard/test/java/javax/time/UsabilityChrono.java +++ b/src-standard/test/java/javax/time/UsabilityChrono.java @@ -62,11 +62,11 @@ private UsabilityChrono() { // date = date.withDayOfMonth(1); // System.out.println(date); // -// int month = date.getMonthOfYear(); +// int month = date.getMonth(); // date = CopticDate.of(date.toLocalDate().with(DateAdjusters.previousOrCurrent(DayOfWeek.MONDAY))); // System.out.println(date); // -// while (date.getMonthOfYear() <= month) { +// while (date.getMonth() <= month) { // String row = ""; // for (int i = 0; i < 7; i++) { // row += date.getDayOfMonth() + " "; @@ -85,11 +85,11 @@ private static void newPackagePluggable() { date = date.with(DAY_OF_MONTH, 1); System.out.println(date); - int month = date.getMonthOfYear(); + int month = date.getMonth(); date = date.with(DAY_OF_WEEK, 1); System.out.println(date); - while (date.getMonthOfYear() <= month) { + while (date.getMonth() <= month) { String row = ""; for (int i = 0; i < 7; i++) { row += date.getDayOfMonth() + " "; diff --git a/src-standard/test/java/javax/time/extended/TestMonthDay.java b/src-standard/test/java/javax/time/extended/TestMonthDay.java index b1065229..557c21a2 100644 --- a/src-standard/test/java/javax/time/extended/TestMonthDay.java +++ b/src-standard/test/java/javax/time/extended/TestMonthDay.java @@ -117,7 +117,7 @@ public void test_immutable() { //----------------------------------------------------------------------- void check(MonthDay test, int m, int d) { - assertEquals(test.getMonthOfYear().getValue(), m); + assertEquals(test.getMonth().getValue(), m); assertEquals(test.getDayOfMonth(), d); } @@ -146,7 +146,7 @@ public void now_Clock() { Instant instant = OffsetDateTime.of(2010, 12, 31, 0, 0, ZoneOffset.UTC).toInstant(); Clock clock = Clock.fixed(instant, ZoneId.UTC); MonthDay test = MonthDay.now(clock); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); } @@ -402,82 +402,82 @@ Object[][] provider_sampleDates() { @Test(dataProvider="sampleDates", groups={"tck"}) public void test_get(int m, int d) { MonthDay a = MonthDay.of(m, d); - assertEquals(a.getMonthOfYear(), Month.of(m)); + assertEquals(a.getMonth(), Month.of(m)); assertEquals(a.getDayOfMonth(), d); } //----------------------------------------------------------------------- - // with(MonthOfYear) + // with(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_with_MonthOfYear() { + public void test_with_Month() { assertEquals(MonthDay.of(6, 30).with(Month.JANUARY), MonthDay.of(1, 30)); } @Test(groups={"tck"}) - public void test_with_MonthOfYear_adjustToValid() { + public void test_with_Month_adjustToValid() { assertEquals(MonthDay.of(7, 31).with(Month.JUNE), MonthDay.of(6, 30)); } @Test(groups={"tck"}) - public void test_with_MonthOfYear_adjustToValidFeb() { + public void test_with_Month_adjustToValidFeb() { assertEquals(MonthDay.of(7, 31).with(Month.FEBRUARY), MonthDay.of(2, 29)); } @Test(groups={"implementation"}) - public void test_with_MonthOfYear_noChangeSame() { + public void test_with_Month_noChangeSame() { MonthDay test = MonthDay.of(6, 30); assertSame(test.with(Month.JUNE), test); } @Test(groups={"tck"}) - public void test_with_MonthOfYear_noChangeEqual() { + public void test_with_Month_noChangeEqual() { MonthDay test = MonthDay.of(6, 30); assertEquals(test.with(Month.JUNE), test); } @Test(expectedExceptions=NullPointerException.class, groups={"tck"}) - public void test_with_MonthOfYear_null() { + public void test_with_Month_null() { MonthDay.of(6, 30).with((Month) null); } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear() { - assertEquals(MonthDay.of(6, 30).withMonthOfYear(1), MonthDay.of(1, 30)); + public void test_withMonth() { + assertEquals(MonthDay.of(6, 30).withMonth(1), MonthDay.of(1, 30)); } @Test(groups={"tck"}) - public void test_withMonthOfYear_adjustToValid() { - assertEquals(MonthDay.of(7, 31).withMonthOfYear(6), MonthDay.of(6, 30)); + public void test_withMonth_adjustToValid() { + assertEquals(MonthDay.of(7, 31).withMonth(6), MonthDay.of(6, 30)); } @Test(groups={"tck"}) - public void test_withMonthOfYear_adjustToValidFeb() { - assertEquals(MonthDay.of(7, 31).withMonthOfYear(2), MonthDay.of(2, 29)); + public void test_withMonth_adjustToValidFeb() { + assertEquals(MonthDay.of(7, 31).withMonth(2), MonthDay.of(2, 29)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_int_noChangeSame() { + public void test_withMonth_int_noChangeSame() { MonthDay test = MonthDay.of(6, 30); - assertSame(test.withMonthOfYear(6), test); + assertSame(test.withMonth(6), test); } @Test(groups={"tck"}) - public void test_withMonthOfYear_int_noChangeEqual() { + public void test_withMonth_int_noChangeEqual() { MonthDay test = MonthDay.of(6, 30); - assertEquals(test.withMonthOfYear(6), test); + assertEquals(test.withMonth(6), test); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_tooLow() { - MonthDay.of(6, 30).withMonthOfYear(0); + public void test_withMonth_tooLow() { + MonthDay.of(6, 30).withMonth(0); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_tooHigh() { - MonthDay.of(6, 30).withMonthOfYear(13); + public void test_withMonth_tooHigh() { + MonthDay.of(6, 30).withMonth(13); } //----------------------------------------------------------------------- diff --git a/src-standard/test/java/javax/time/extended/TestQuarterOfYear.java b/src-standard/test/java/javax/time/extended/TestQuarterOfYear.java index b0cb7818..8ccba636 100644 --- a/src-standard/test/java/javax/time/extended/TestQuarterOfYear.java +++ b/src-standard/test/java/javax/time/extended/TestQuarterOfYear.java @@ -89,7 +89,7 @@ public void test_of_int_valueTooHigh() { } //----------------------------------------------------------------------- - // ofMonth(MonthOfYear) + // ofMonth(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) public void test_getQuarterOfYear() { diff --git a/src-standard/test/java/javax/time/extended/TestYear.java b/src-standard/test/java/javax/time/extended/TestYear.java index ba564ffa..ff31146d 100644 --- a/src-standard/test/java/javax/time/extended/TestYear.java +++ b/src-standard/test/java/javax/time/extended/TestYear.java @@ -626,7 +626,7 @@ public void test_lengthInDays() { } //----------------------------------------------------------------------- - // isValidMonthDay(MonthOfYear) + // isValidMonthDay(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) public void test_isValidMonthDay_june() { @@ -708,7 +708,7 @@ public void test_isValidMonthDay_null() { // } //----------------------------------------------------------------------- - // atMonth(MonthOfYear) + // atMonth(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) public void test_atMonth() { @@ -738,7 +738,7 @@ public void test_atMonth_int_invalidMonth() { } //----------------------------------------------------------------------- - // atMonthDay(MonthOfYear) + // atMonthDay(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) public void test_atMonthDay() { diff --git a/src-standard/test/java/javax/time/extended/TestYearMonth.java b/src-standard/test/java/javax/time/extended/TestYearMonth.java index 73325aab..8ddce5a1 100644 --- a/src-standard/test/java/javax/time/extended/TestYearMonth.java +++ b/src-standard/test/java/javax/time/extended/TestYearMonth.java @@ -114,7 +114,7 @@ public void test_immutable() { //----------------------------------------------------------------------- void check(YearMonth test, int y, int m) { assertEquals(test.getYear(), y); - assertEquals(test.getMonthOfYear().getValue(), m); + assertEquals(test.getMonth().getValue(), m); } //----------------------------------------------------------------------- @@ -143,7 +143,7 @@ public void now_Clock() { Clock clock = Clock.fixed(instant, ZoneId.UTC); YearMonth test = YearMonth.now(clock); assertEquals(test.getYear(), 2010); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); } @Test(expectedExceptions=NullPointerException.class, groups={"tck"}) @@ -422,28 +422,28 @@ public void test_with_Year_null() { } //----------------------------------------------------------------------- - // with(MonthOfYear) + // with(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_with_MonthOfYear() { + public void test_with_Month() { YearMonth test = YearMonth.of(2008, 6); assertEquals(test.with(Month.JANUARY), YearMonth.of(2008, 1)); } @Test(groups={"implementation"}) - public void test_with_MonthOfYear_noChange_same() { + public void test_with_Month_noChange_same() { YearMonth test = YearMonth.of(2008, 6); assertSame(test.with(Month.JUNE), test); } @Test(groups={"tck"}) - public void test_with_MonthOfYear_noChange_equal() { + public void test_with_Month_noChange_equal() { YearMonth test = YearMonth.of(2008, 6); assertEquals(test.with(Month.JUNE), test); } @Test(expectedExceptions=NullPointerException.class, groups={"tck"}) - public void test_with_MonthOfYear_null() { + public void test_with_Month_null() { YearMonth test = YearMonth.of(2008, 6); test.with((Month) null); } @@ -482,36 +482,36 @@ public void test_withYear_tooHigh() { } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear() { + public void test_withMonth() { YearMonth test = YearMonth.of(2008, 6); - assertEquals(test.withMonthOfYear(1), YearMonth.of(2008, 1)); + assertEquals(test.withMonth(1), YearMonth.of(2008, 1)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_int_noChange_same() { + public void test_withMonth_int_noChange_same() { YearMonth test = YearMonth.of(2008, 6); - assertSame(test.withMonthOfYear(6), test); + assertSame(test.withMonth(6), test); } @Test(groups={"tck"}) - public void test_withMonthOfYear_int_noChange_equal() { + public void test_withMonth_int_noChange_equal() { YearMonth test = YearMonth.of(2008, 6); - assertEquals(test.withMonthOfYear(6), test); + assertEquals(test.withMonth(6), test); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_tooLow() { + public void test_withMonth_tooLow() { YearMonth test = YearMonth.of(2008, 6); - test.withMonthOfYear(0); + test.withMonth(0); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_tooHigh() { + public void test_withMonth_tooHigh() { YearMonth test = YearMonth.of(2008, 6); - test.withMonthOfYear(13); + test.withMonth(13); } // //----------------------------------------------------------------------- diff --git a/src/main/java/javax/time/LocalDate.java b/src/main/java/javax/time/LocalDate.java index da095dbf..b3e18f0e 100644 --- a/src/main/java/javax/time/LocalDate.java +++ b/src/main/java/javax/time/LocalDate.java @@ -389,7 +389,7 @@ public long get(DateTimeField field) { case ALIGNED_WEEK_OF_YEAR: return ((getDayOfYear() - 1) / 7) + 1; case EPOCH_DAY: return toEpochDay(); case MONTH_OF_YEAR: return month; - case EPOCH_MONTH: return ((year - 1970) * 12L) + getMonthOfYear().ordinal(); + case EPOCH_MONTH: return ((year - 1970) * 12L) + getMonth().ordinal(); case YEAR_OF_ERA: return (year < 1 ? 1 - year : year); case YEAR: return year; case ERA: return (year < 1 ? 0 : 1); @@ -416,10 +416,10 @@ public int getYear() { *

* This method returns the month as an {@code int} from 1 to 12. * Application code is frequently clearer if the enum {@link Month} - * is used by calling {@link #getMonthOfYear()}. + * is used by calling {@link #getMonth()}. * * @return the month-of-year, from 1 to 12 - * @see #getMonthOfYear() + * @see #getMonth() */ public int getMonthValue() { return month; @@ -436,7 +436,7 @@ public int getMonthValue() { * @return the month-of-year, not null * @see #getMonthValue() */ - public Month getMonthOfYear() { + public Month getMonth() { return Month.of(month); } @@ -459,7 +459,7 @@ public int getDayOfMonth() { * @return the day-of-year, from 1 to 365, or 366 in a leap year */ public int getDayOfYear() { - return getMonthOfYear().getMonthStartDayOfYear(isLeapYear()) + day - 1; + return getMonth().getMonthStartDayOfYear(isLeapYear()) + day - 1; } /** @@ -535,7 +535,7 @@ public LocalDate with(DateTimeField field, long newValue) { case EPOCH_DAY: return LocalDate.ofEpochDay(newValue); case ALIGNED_WEEK_OF_MONTH: return plusWeeks(newValue - get(ALIGNED_WEEK_OF_MONTH)); case ALIGNED_WEEK_OF_YEAR: return plusWeeks(newValue - get(ALIGNED_WEEK_OF_YEAR)); - case MONTH_OF_YEAR: return withMonthOfYear((int) newValue); + case MONTH_OF_YEAR: return withMonth((int) newValue); case EPOCH_MONTH: return plusMonths(newValue - get(EPOCH_MONTH)); case YEAR_OF_ERA: return withYear((int) (year < 1 ? 1 - newValue : newValue)); case YEAR: return withYear((int) newValue); @@ -575,7 +575,7 @@ public LocalDate withYear(int year) { * @return a {@code LocalDate} based on this date with the requested month, not null * @throws CalendricalException if the month-of-year value is invalid */ - public LocalDate withMonthOfYear(int month) { + public LocalDate withMonth(int month) { if (this.month == month) { return this; } diff --git a/src/main/java/javax/time/LocalDateTime.java b/src/main/java/javax/time/LocalDateTime.java index a92bba7d..cfdaaa08 100644 --- a/src/main/java/javax/time/LocalDateTime.java +++ b/src/main/java/javax/time/LocalDateTime.java @@ -484,10 +484,10 @@ public int getYear() { *

* This method returns the month as an {@code int} from 1 to 12. * Application code is frequently clearer if the enum {@link Month} - * is used by calling {@link #getMonthOfYear()}. + * is used by calling {@link #getMonth()}. * * @return the month-of-year, from 1 to 12 - * @see #getMonthOfYear() + * @see #getMonth() */ public int getMonthValue() { return date.getMonthValue(); @@ -504,8 +504,8 @@ public int getMonthValue() { * @return the month-of-year, not null * @see #getMonthValue() */ - public Month getMonthOfYear() { - return date.getMonthOfYear(); + public Month getMonth() { + return date.getMonth(); } /** @@ -664,8 +664,8 @@ public LocalDateTime withYear(int year) { * @return a {@code LocalDateTime} based on this date-time with the requested month, not null * @throws CalendricalException if the month-of-year value is invalid */ - public LocalDateTime withMonthOfYear(int month) { - return with(date.withMonthOfYear(month), time); + public LocalDateTime withMonth(int month) { + return with(date.withMonth(month), time); } /** @@ -731,7 +731,7 @@ public LocalDateTime withDayOfYear(int dayOfYear) { */ public LocalDateTime withDate(int year, Month month, int dayOfMonth) { if (year == getYear() && - month == getMonthOfYear() && + month == getMonth() && dayOfMonth == getDayOfMonth()) { return this; } @@ -756,7 +756,7 @@ public LocalDateTime withDate(int year, Month month, int dayOfMonth) { */ public LocalDateTime withDate(int year, int month, int dayOfMonth) { if (year == getYear() && - month == getMonthOfYear().getValue() && + month == getMonth().getValue() && dayOfMonth == getDayOfMonth()) { return this; } diff --git a/src/main/java/javax/time/Month.java b/src/main/java/javax/time/Month.java index 636ddfac..9f74d1df 100644 --- a/src/main/java/javax/time/Month.java +++ b/src/main/java/javax/time/Month.java @@ -143,15 +143,15 @@ public enum Month implements DateTimeObject, DateAdjuster { * This factory allows the enum to be obtained from the {@code int} value. * The {@code int} value follows the ISO-8601 standard, from 1 (January) to 12 (December). * - * @param monthOfYear the month-of-year to represent, from 1 (January) to 12 (December) - * @return the MonthOfYear singleton, not null + * @param month the month-of-year to represent, from 1 (January) to 12 (December) + * @return the month-of-year, not null * @throws CalendricalException if the month-of-year is invalid */ - public static Month of(int monthOfYear) { - if (monthOfYear < 1 || monthOfYear > 12) { - throw new CalendricalException("Invalid value for MonthOfYear: " + monthOfYear); + public static Month of(int month) { + if (month < 1 || month > 12) { + throw new CalendricalException("Invalid value for MonthOfYear: " + month); } - return ENUMS[monthOfYear - 1]; + return ENUMS[month - 1]; } //----------------------------------------------------------------------- @@ -378,7 +378,7 @@ public int getMonthEndDayOfYear(boolean leapYear) { * This method exists to fulfill the {@link CalendricalObject} interface. * This implementation returns the following types: *

@@ -411,7 +411,7 @@ public Month with(CalendricalAdjuster adjuster) { @Override public LocalDate adjustDate(LocalDate date) { - return date.withMonthOfYear(getValue()); + return date.withMonth(getValue()); } //----------------------------------------------------------------------- diff --git a/src/main/java/javax/time/OffsetDate.java b/src/main/java/javax/time/OffsetDate.java index c586f9e1..b6509dd3 100644 --- a/src/main/java/javax/time/OffsetDate.java +++ b/src/main/java/javax/time/OffsetDate.java @@ -323,10 +323,10 @@ public int getYear() { *

* This method returns the month as an {@code int} from 1 to 12. * Application code is frequently clearer if the enum {@link Month} - * is used by calling {@link #getMonthOfYear()}. + * is used by calling {@link #getMonth()}. * * @return the month-of-year, from 1 to 12 - * @see #getMonthOfYear() + * @see #getMonth() */ public int getMonthValue() { return date.getMonthValue(); @@ -343,8 +343,8 @@ public int getMonthValue() { * @return the month-of-year, not null * @see #getMonthValue() */ - public Month getMonthOfYear() { - return date.getMonthOfYear(); + public Month getMonth() { + return date.getMonth(); } /** @@ -463,8 +463,8 @@ public OffsetDate withYear(int year) { * @return an {@code OffsetDate} based on this date with the requested month, not null * @throws CalendricalException if the month-of-year value is invalid */ - public OffsetDate withMonthOfYear(int month) { - return with(date.withMonthOfYear(month), offset); + public OffsetDate withMonth(int month) { + return with(date.withMonth(month), offset); } /** diff --git a/src/main/java/javax/time/OffsetDateTime.java b/src/main/java/javax/time/OffsetDateTime.java index 49422863..f5a20991 100644 --- a/src/main/java/javax/time/OffsetDateTime.java +++ b/src/main/java/javax/time/OffsetDateTime.java @@ -594,10 +594,10 @@ public int getYear() { *

* This method returns the month as an {@code int} from 1 to 12. * Application code is frequently clearer if the enum {@link Month} - * is used by calling {@link #getMonthOfYear()}. + * is used by calling {@link #getMonth()}. * * @return the month-of-year, from 1 to 12 - * @see #getMonthOfYear() + * @see #getMonth() */ public int getMonthValue() { return dateTime.getMonthValue(); @@ -614,8 +614,8 @@ public int getMonthValue() { * @return the month-of-year, not null * @see #getMonthValue() */ - public Month getMonthOfYear() { - return dateTime.getMonthOfYear(); + public Month getMonth() { + return dateTime.getMonth(); } /** @@ -771,8 +771,8 @@ public OffsetDateTime withYear(int year) { * @return an {@code OffsetDateTime} based on this date-time with the requested month, not null * @throws CalendricalException if the month-of-year value is invalid */ - public OffsetDateTime withMonthOfYear(int month) { - return with(dateTime.withMonthOfYear(month), offset); + public OffsetDateTime withMonth(int month) { + return with(dateTime.withMonth(month), offset); } /** diff --git a/src/main/java/javax/time/ZonedDateTime.java b/src/main/java/javax/time/ZonedDateTime.java index 28f255d6..7784223e 100644 --- a/src/main/java/javax/time/ZonedDateTime.java +++ b/src/main/java/javax/time/ZonedDateTime.java @@ -770,10 +770,10 @@ public int getYear() { *

* This method returns the month as an {@code int} from 1 to 12. * Application code is frequently clearer if the enum {@link Month} - * is used by calling {@link #getMonthOfYear()}. + * is used by calling {@link #getMonth()}. * * @return the month-of-year, from 1 to 12 - * @see #getMonthOfYear() + * @see #getMonth() */ public int getMonthValue() { return dateTime.getMonthValue(); @@ -790,8 +790,8 @@ public int getMonthValue() { * @return the month-of-year, not null * @see #getMonthValue() */ - public Month getMonthOfYear() { - return dateTime.getMonthOfYear(); + public Month getMonth() { + return dateTime.getMonth(); } /** @@ -1105,8 +1105,8 @@ public ZonedDateTime with(Month month) { * @return a {@code ZonedDateTime} based on this date-time with the requested month, not null * @throws CalendricalException if the month value is invalid */ - public ZonedDateTime withMonthOfYear(int month) { - LocalDateTime newDT = dateTime.toLocalDateTime().withMonthOfYear(month); + public ZonedDateTime withMonth(int month) { + LocalDateTime newDT = dateTime.toLocalDateTime().withMonth(month); return (newDT == dateTime.toLocalDateTime() ? this : resolve(newDT, zone, this, ZoneResolvers.retainOffset())); } diff --git a/src/main/java/javax/time/calendrical/DateAdjusters.java b/src/main/java/javax/time/calendrical/DateAdjusters.java index 1bf15ae9..46c21ef4 100644 --- a/src/main/java/javax/time/calendrical/DateAdjusters.java +++ b/src/main/java/javax/time/calendrical/DateAdjusters.java @@ -149,7 +149,7 @@ public LocalDate adjustDate(LocalDate date) { LAST_DAY_OF_MONTH { /** {@inheritDoc} */ public LocalDate adjustDate(LocalDate date) { - int dom = date.getMonthOfYear().lengthInDays(date.isLeapYear()); + int dom = date.getMonth().lengthInDays(date.isLeapYear()); return date.withDayOfMonth(dom); } }, diff --git a/src/main/java/javax/time/calendrical/LocalDateTimeField.java b/src/main/java/javax/time/calendrical/LocalDateTimeField.java index 2be63b3e..922bebdf 100644 --- a/src/main/java/javax/time/calendrical/LocalDateTimeField.java +++ b/src/main/java/javax/time/calendrical/LocalDateTimeField.java @@ -317,10 +317,10 @@ public DateTimeValueRange range(CalendricalObject calendrical) { LocalDate date = calendrical.extract(LocalDate.class); if (date != null) { switch (this) { - case DAY_OF_MONTH: return DateTimeValueRange.of(1, date.getMonthOfYear().lengthInDays(date.isLeapYear())); + case DAY_OF_MONTH: return DateTimeValueRange.of(1, date.getMonth().lengthInDays(date.isLeapYear())); case DAY_OF_YEAR: return DateTimeValueRange.of(1, date.isLeapYear() ? 366 : 365); case ALIGNED_WEEK_OF_MONTH: return DateTimeValueRange.of(1, - date.getMonthOfYear() == Month.FEBRUARY && date.isLeapYear() == false ? 4 : 5); + date.getMonth() == Month.FEBRUARY && date.isLeapYear() == false ? 4 : 5); } } return getValueRange(); diff --git a/src/main/java/javax/time/zone/ZoneRulesBuilder.java b/src/main/java/javax/time/zone/ZoneRulesBuilder.java index 3acd31c4..198ccbc3 100644 --- a/src/main/java/javax/time/zone/ZoneRulesBuilder.java +++ b/src/main/java/javax/time/zone/ZoneRulesBuilder.java @@ -193,7 +193,7 @@ public ZoneRulesBuilder addRuleToWindow( DateTimes.checkNotNull(dateTime, "Rule end date-time must not be null"); return addRuleToWindow( dateTime.getYear(), dateTime.getYear(), - dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), + dateTime.getMonth(), dateTime.getDayOfMonth(), null, dateTime.toLocalTime(), false, timeDefinition, savingAmountSecs); } @@ -678,7 +678,7 @@ ZoneOffsetTransitionRule toTransitionRule(ZoneOffset standardOffset, int savings } if (timeEndOfDay && dayOfMonthIndicator > 0 && (dayOfMonthIndicator == 28 && month == Month.FEBRUARY) == false) { LocalDate date = LocalDate.of(2004, month, dayOfMonthIndicator).plusDays(1); // leap-year - month = date.getMonthOfYear(); + month = date.getMonth(); dayOfMonthIndicator = date.getDayOfMonth(); if (dayOfWeek != null) { dayOfWeek = dayOfWeek.next(); diff --git a/src/test/java/javax/time/TestLocalDate.java b/src/test/java/javax/time/TestLocalDate.java index 0adb0fa5..2fdc9872 100644 --- a/src/test/java/javax/time/TestLocalDate.java +++ b/src/test/java/javax/time/TestLocalDate.java @@ -139,7 +139,7 @@ public void test_immutable() { //----------------------------------------------------------------------- private void check(LocalDate test_2008_02_29, int y, int m, int d) { assertEquals(test_2008_02_29.getYear(), y); - assertEquals(test_2008_02_29.getMonthOfYear().getValue(), m); + assertEquals(test_2008_02_29.getMonth().getValue(), m); assertEquals(test_2008_02_29.getDayOfMonth(), d); } @@ -186,7 +186,7 @@ public void now_Clock_allSecsInDay_utc() { Clock clock = Clock.fixed(instant, ZoneId.UTC); LocalDate test = LocalDate.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2)); } } @@ -198,7 +198,7 @@ public void now_Clock_allSecsInDay_offset() { Clock clock = Clock.fixed(instant.minusSeconds(OFFSET_PONE.getTotalSeconds()), ZoneId.of(OFFSET_PONE)); LocalDate test = LocalDate.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60) ? 1 : 2); } } @@ -210,7 +210,7 @@ public void now_Clock_allSecsInDay_beforeEpoch() { Clock clock = Clock.fixed(instant, ZoneId.UTC); LocalDate test = LocalDate.now(clock); assertEquals(test.getYear(), 1969); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), (i >= -24 * 60 * 60 ? 31 : 30)); } } @@ -364,14 +364,14 @@ public void factory_ofYearDay_ints_yearTooLow() { // Since plusDays/minusDays actually depends on MJDays, it cannot be used for testing private LocalDate next(LocalDate date) { int newDayOfMonth = date.getDayOfMonth() + 1; - if (newDayOfMonth <= date.getMonthOfYear().lengthInDays(isIsoLeap(date.getYear()))) { + if (newDayOfMonth <= date.getMonth().lengthInDays(isIsoLeap(date.getYear()))) { return date.withDayOfMonth(newDayOfMonth); } date = date.withDayOfMonth(1); - if (date.getMonthOfYear() == Month.DECEMBER) { + if (date.getMonth() == Month.DECEMBER) { date = date.withYear(date.getYear() + 1); } - return date.with(date.getMonthOfYear().next()); + return date.with(date.getMonth().next()); } private LocalDate previous(LocalDate date) { @@ -379,11 +379,11 @@ private LocalDate previous(LocalDate date) { if (newDayOfMonth > 0) { return date.withDayOfMonth(newDayOfMonth); } - date = date.with(date.getMonthOfYear().previous()); - if (date.getMonthOfYear() == Month.DECEMBER) { + date = date.with(date.getMonth().previous()); + if (date.getMonth() == Month.DECEMBER) { date = date.withYear(date.getYear() - 1); } - return date.withDayOfMonth(date.getMonthOfYear().lengthInDays(isIsoLeap(date.getYear()))); + return date.withDayOfMonth(date.getMonth().lengthInDays(isIsoLeap(date.getYear()))); } //----------------------------------------------------------------------- @@ -447,7 +447,7 @@ public void test_factory_CalendricalObject_null() { // LocalDate t = LocalDate.parse(parsable); // assertNotNull(t, parsable); // assertEquals(t.getYear(), y, parsable); -// assertEquals(t.getMonthOfYear().getValue(), m, parsable); +// assertEquals(t.getMonth().getValue(), m, parsable); // assertEquals(t.getDayOfMonth(), d, parsable); // } // @@ -601,7 +601,7 @@ Object[][] provider_sampleDates() { public void test_get(int y, int m, int d) { LocalDate a = LocalDate.of(y, m, d); assertEquals(a.getYear(), y); - assertEquals(a.getMonthOfYear(), Month.of(m)); + assertEquals(a.getMonth(), Month.of(m)); assertEquals(a.getDayOfMonth(), d); } @@ -726,28 +726,28 @@ public void test_withYear_int_adjustDay() { } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear_int_normal() { - LocalDate t = TEST_2007_07_15.withMonthOfYear(1); + public void test_withMonth_int_normal() { + LocalDate t = TEST_2007_07_15.withMonth(1); assertEquals(t, LocalDate.of(2007, 1, 15)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_int_noChange_same() { - LocalDate t = TEST_2007_07_15.withMonthOfYear(7); + public void test_withMonth_int_noChange_same() { + LocalDate t = TEST_2007_07_15.withMonth(7); assertSame(t, TEST_2007_07_15); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_int_invalid() { - TEST_2007_07_15.withMonthOfYear(13); + public void test_withMonth_int_invalid() { + TEST_2007_07_15.withMonth(13); } @Test(groups={"tck"}) - public void test_withMonthOfYear_int_adjustDay() { - LocalDate t = LocalDate.of(2007, 12, 31).withMonthOfYear(11); + public void test_withMonth_int_adjustDay() { + LocalDate t = LocalDate.of(2007, 12, 31).withMonth(11); LocalDate expected = LocalDate.of(2007, 11, 30); assertEquals(t, expected); } diff --git a/src/test/java/javax/time/TestLocalDateTime.java b/src/test/java/javax/time/TestLocalDateTime.java index dcb5e56c..9d0caf36 100644 --- a/src/test/java/javax/time/TestLocalDateTime.java +++ b/src/test/java/javax/time/TestLocalDateTime.java @@ -95,7 +95,7 @@ public void setUp() { //----------------------------------------------------------------------- private void check(LocalDateTime dateTime, int y, int m, int d, int h, int mi, int s, int n) { assertEquals(dateTime.getYear(), y); - assertEquals(dateTime.getMonthOfYear().getValue(), m); + assertEquals(dateTime.getMonth().getValue(), m); assertEquals(dateTime.getDayOfMonth(), d); assertEquals(dateTime.getHourOfDay(), h); assertEquals(dateTime.getMinuteOfHour(), mi); @@ -185,7 +185,7 @@ public void now_Clock_allSecsInDay_utc() { Clock clock = Clock.fixed(instant, ZoneId.UTC); LocalDateTime test = LocalDateTime.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2)); assertEquals(test.getHourOfDay(), (i / (60 * 60)) % 24); assertEquals(test.getMinuteOfHour(), (i / 60) % 60); @@ -201,7 +201,7 @@ public void now_Clock_allSecsInDay_offset() { Clock clock = Clock.fixed(instant.minusSeconds(OFFSET_PONE.getTotalSeconds()), ZoneId.of(OFFSET_PONE)); LocalDateTime test = LocalDateTime.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60) ? 1 : 2); assertEquals(test.getHourOfDay(), (i / (60 * 60)) % 24); assertEquals(test.getMinuteOfHour(), (i / 60) % 60); @@ -218,7 +218,7 @@ public void now_Clock_allSecsInDay_beforeEpoch() { Clock clock = Clock.fixed(instant, ZoneId.UTC); LocalDateTime test = LocalDateTime.now(clock); assertEquals(test.getYear(), 1969); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); expected = expected.minusSeconds(1); assertEquals(test.toLocalTime(), expected); @@ -725,7 +725,7 @@ public void test_factory_CalendricalObject_null() { // public void test_parse(int y, int month, int d, int h, int m, int s, int n, String text) { // LocalDateTime t = LocalDateTime.parse(text); // assertEquals(t.getYear(), y); -// assertEquals(t.getMonthOfYear().getValue(), month); +// assertEquals(t.getMonth().getValue(), month); // assertEquals(t.getDayOfMonth(), d); // assertEquals(t.getHourOfDay(), h); // assertEquals(t.getMinuteOfHour(), m); @@ -886,7 +886,7 @@ Object[][] provider_sampleTimes() { public void test_get_dates(int y, int m, int d) { LocalDateTime a = LocalDateTime.of(y, m, d, 12, 30); assertEquals(a.getYear(), y); - assertEquals(a.getMonthOfYear(), Month.of(m)); + assertEquals(a.getMonth(), Month.of(m)); assertEquals(a.getDayOfMonth(), d); } @@ -1024,29 +1024,29 @@ public void test_withYear_int_adjustDay() { } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear_int_normal() { - LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonthOfYear(1); + public void test_withMonth_int_normal() { + LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonth(1); check(t, 2007, 1, 15, 12, 30, 40, 987654321); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_int_noChange() { - LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonthOfYear(7); + public void test_withMonth_int_noChange() { + LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMonth(7); assertSame(t.toLocalDate(), TEST_2007_07_15_12_30_40_987654321.toLocalDate()); assertSame(t.toLocalTime(), TEST_2007_07_15_12_30_40_987654321.toLocalTime()); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_int_invalid() { - TEST_2007_07_15_12_30_40_987654321.withMonthOfYear(13); + public void test_withMonth_int_invalid() { + TEST_2007_07_15_12_30_40_987654321.withMonth(13); } @Test(groups={"tck"}) - public void test_withMonthOfYear_int_adjustDay() { - LocalDateTime t = LocalDateTime.of(2007, 12, 31, 12, 30).withMonthOfYear(11); + public void test_withMonth_int_adjustDay() { + LocalDateTime t = LocalDateTime.of(2007, 12, 31, 12, 30).withMonth(11); LocalDateTime expected = LocalDateTime.of(2007, 11, 30, 12, 30); assertEquals(t, expected); } @@ -1102,7 +1102,7 @@ public void test_withDayOfYear_invalid() { } //----------------------------------------------------------------------- - // withDate(int,MonthOfYear,int) + // withDate(int,Month,int) //----------------------------------------------------------------------- @Test(groups={"tck"}) public void test_withDate_iMi() { diff --git a/src/test/java/javax/time/TestMonth.java b/src/test/java/javax/time/TestMonth.java index bca2fd02..6cbcbc4b 100644 --- a/src/test/java/javax/time/TestMonth.java +++ b/src/test/java/javax/time/TestMonth.java @@ -43,7 +43,7 @@ import org.testng.annotations.Test; /** - * Test MonthOfYear. + * Test Month. */ @Test public class TestMonth { @@ -106,17 +106,17 @@ public void test_factory_CalendricalObject_null() { //----------------------------------------------------------------------- // @Test(groups={"tck"}) // public void test_getText() { -// assertEquals(MonthOfYear.JANUARY.getText(TextStyle.SHORT, Locale.US), "Jan"); +// assertEquals(Month.JANUARY.getText(TextStyle.SHORT, Locale.US), "Jan"); // } // // @Test(expectedExceptions = NullPointerException.class, groups={"tck"}) // public void test_getText_nullStyle() { -// MonthOfYear.JANUARY.getText(null, Locale.US); +// Month.JANUARY.getText(null, Locale.US); // } // // @Test(expectedExceptions = NullPointerException.class, groups={"tck"}) // public void test_getText_nullLocale() { -// MonthOfYear.JANUARY.getText(TextStyle.FULL, null); +// Month.JANUARY.getText(TextStyle.FULL, null); // } //----------------------------------------------------------------------- diff --git a/src/test/java/javax/time/TestOffsetDate.java b/src/test/java/javax/time/TestOffsetDate.java index 265e6eab..ac83810c 100644 --- a/src/test/java/javax/time/TestOffsetDate.java +++ b/src/test/java/javax/time/TestOffsetDate.java @@ -154,7 +154,7 @@ public void now_Clock_allSecsInDay_utc() { Clock clock = Clock.fixed(instant, ZoneId.UTC); OffsetDate test = OffsetDate.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2)); assertEquals(test.getOffset(), ZoneOffset.UTC); } @@ -167,7 +167,7 @@ public void now_Clock_allSecsInDay_beforeEpoch() { Clock clock = Clock.fixed(instant, ZoneId.UTC); OffsetDate test = OffsetDate.now(clock); assertEquals(test.getYear(), 1969); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), (i >= -24 * 60 * 60 ? 31 : 30)); assertEquals(test.getOffset(), ZoneOffset.UTC); } @@ -181,7 +181,7 @@ public void now_Clock_offsets() { Clock clock = Clock.fixed(base.toInstant(), ZoneId.of(offset)); OffsetDate test = OffsetDate.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), i >= 12 ? 2 : 1); assertEquals(test.getOffset(), offset); } @@ -192,7 +192,7 @@ public void now_Clock_offsets() { //----------------------------------------------------------------------- void check(OffsetDate test, int y, int mo, int d, ZoneOffset offset) { assertEquals(test.getYear(), y); - assertEquals(test.getMonthOfYear().getValue(), mo); + assertEquals(test.getMonth().getValue(), mo); assertEquals(test.getDayOfMonth(), d); assertEquals(test.getOffset(), offset); } @@ -318,7 +318,7 @@ public void factory_ofInstant_allSecsInDay_utc() { Instant instant = Instant.ofEpochSecond(i); OffsetDate test = OffsetDate.ofInstant(instant, ZoneOffset.UTC); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2)); } } @@ -329,7 +329,7 @@ public void factory_ofInstant_allSecsInDay_offset() { Instant instant = Instant.ofEpochSecond(i); OffsetDate test = OffsetDate.ofInstant(instant.minusSeconds(OFFSET_PONE.getTotalSeconds()), OFFSET_PONE); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60) ? 1 : 2); } } @@ -340,7 +340,7 @@ public void factory_ofInstant_beforeEpoch() { Instant instant = Instant.ofEpochSecond(i); OffsetDate test = OffsetDate.ofInstant(instant, ZoneOffset.UTC); assertEquals(test.getYear(), 1969); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); } } @@ -395,7 +395,7 @@ public void test_factory_CalendricalObject_null() { // OffsetDate t = OffsetDate.parse(parsable); // assertNotNull(t, parsable); // assertEquals(t.getYear(), y, parsable); -// assertEquals(t.getMonthOfYear().getValue(), m, parsable); +// assertEquals(t.getMonth().getValue(), m, parsable); // assertEquals(t.getDayOfMonth(), d, parsable); // assertEquals(t.getOffset(), ZoneOffset.of(offsetId)); // } @@ -532,7 +532,7 @@ public void test_get_OffsetDate(int y, int m, int d, ZoneOffset offset) { OffsetDate a = OffsetDate.of(localDate, offset); assertEquals(a.getYear(), localDate.getYear()); - assertEquals(a.getMonthOfYear(), localDate.getMonthOfYear()); + assertEquals(a.getMonth(), localDate.getMonth()); assertEquals(a.getDayOfMonth(), localDate.getDayOfMonth()); assertEquals(a.getDayOfYear(), localDate.getDayOfYear()); assertEquals(a.getDayOfWeek(), localDate.getDayOfWeek()); @@ -715,28 +715,28 @@ public void test_withYear_int_adjustDay() { } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear_int_normal() { - OffsetDate t = TEST_2007_07_15_PONE.withMonthOfYear(1); + public void test_withMonth_int_normal() { + OffsetDate t = TEST_2007_07_15_PONE.withMonth(1); assertEquals(t, OffsetDate.of(2007, 1, 15, OFFSET_PONE)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_int_noChange() { - OffsetDate t = TEST_2007_07_15_PONE.withMonthOfYear(7); + public void test_withMonth_int_noChange() { + OffsetDate t = TEST_2007_07_15_PONE.withMonth(7); assertSame(t, TEST_2007_07_15_PONE); } @Test(expectedExceptions=CalendricalException.class, groups={"tck"}) - public void test_withMonthOfYear_int_invalid() { - TEST_2007_07_15_PONE.withMonthOfYear(13); + public void test_withMonth_int_invalid() { + TEST_2007_07_15_PONE.withMonth(13); } @Test(groups={"tck"}) - public void test_withMonthOfYear_int_adjustDay() { - OffsetDate t = OffsetDate.of(2007, 12, 31, OFFSET_PONE).withMonthOfYear(11); + public void test_withMonth_int_adjustDay() { + OffsetDate t = OffsetDate.of(2007, 12, 31, OFFSET_PONE).withMonth(11); OffsetDate expected = OffsetDate.of(2007, 11, 30, OFFSET_PONE); assertEquals(t, expected); } diff --git a/src/test/java/javax/time/TestOffsetDateTime.java b/src/test/java/javax/time/TestOffsetDateTime.java index ba3fa825..660858e9 100644 --- a/src/test/java/javax/time/TestOffsetDateTime.java +++ b/src/test/java/javax/time/TestOffsetDateTime.java @@ -150,7 +150,7 @@ public void now_Clock_allSecsInDay_utc() { Clock clock = Clock.fixed(instant, ZoneId.UTC); OffsetDateTime test = OffsetDateTime.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2)); assertEquals(test.getHourOfDay(), (i / (60 * 60)) % 24); assertEquals(test.getMinuteOfHour(), (i / 60) % 60); @@ -167,7 +167,7 @@ public void now_Clock_allSecsInDay_offset() { Clock clock = Clock.fixed(instant.minusSeconds(OFFSET_PONE.getTotalSeconds()), ZoneId.of(OFFSET_PONE)); OffsetDateTime test = OffsetDateTime.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60) ? 1 : 2); assertEquals(test.getHourOfDay(), (i / (60 * 60)) % 24); assertEquals(test.getMinuteOfHour(), (i / 60) % 60); @@ -185,7 +185,7 @@ public void now_Clock_allSecsInDay_beforeEpoch() { Clock clock = Clock.fixed(instant, ZoneId.UTC); OffsetDateTime test = OffsetDateTime.now(clock); assertEquals(test.getYear(), 1969); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); expected = expected.minusSeconds(1); assertEquals(test.toLocalTime(), expected); @@ -213,7 +213,7 @@ public void now_Clock_offsets() { //----------------------------------------------------------------------- private void check(OffsetDateTime test, int y, int mo, int d, int h, int m, int s, int n, ZoneOffset offset) { assertEquals(test.getYear(), y); - assertEquals(test.getMonthOfYear().getValue(), mo); + assertEquals(test.getMonth().getValue(), mo); assertEquals(test.getDayOfMonth(), d); assertEquals(test.getHourOfDay(), h); assertEquals(test.getMinuteOfHour(), m); @@ -426,7 +426,7 @@ public void test_factory_Calendricals_null() { // public void test_parse(int y, int month, int d, int h, int m, int s, int n, String offsetId, String text) { // OffsetDateTime t = OffsetDateTime.parse(text); // assertEquals(t.getYear(), y); -// assertEquals(t.getMonthOfYear().getValue(), month); +// assertEquals(t.getMonth().getValue(), month); // assertEquals(t.getDayOfMonth(), d); // assertEquals(t.getHourOfDay(), h); // assertEquals(t.getMinuteOfHour(), m); @@ -537,7 +537,7 @@ public void test_get(int y, int o, int d, int h, int m, int s, int n, ZoneOffset OffsetDateTime a = OffsetDateTime.of(localDateTime, offset); assertEquals(a.getYear(), localDate.getYear()); - assertEquals(a.getMonthOfYear(), localDate.getMonthOfYear()); + assertEquals(a.getMonth(), localDate.getMonth()); assertEquals(a.getDayOfMonth(), localDate.getDayOfMonth()); assertEquals(a.getDayOfYear(), localDate.getDayOfYear()); assertEquals(a.getDayOfWeek(), localDate.getDayOfWeek()); @@ -753,19 +753,19 @@ public void test_withYear_noChange() { } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear_normal() { + public void test_withMonth_normal() { OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, OFFSET_PONE); - OffsetDateTime test = base.withMonthOfYear(1); + OffsetDateTime test = base.withMonth(1); assertEquals(test, OffsetDateTime.of(2008, 1, 30, 11, 30, 59, OFFSET_PONE)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_noChange() { + public void test_withMonth_noChange() { OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, OFFSET_PONE); - OffsetDateTime test = base.withMonthOfYear(6); + OffsetDateTime test = base.withMonth(6); assertSame(test, base); } diff --git a/src/test/java/javax/time/TestOffsetDateTime_instants.java b/src/test/java/javax/time/TestOffsetDateTime_instants.java index da658155..75eff7e5 100644 --- a/src/test/java/javax/time/TestOffsetDateTime_instants.java +++ b/src/test/java/javax/time/TestOffsetDateTime_instants.java @@ -50,7 +50,7 @@ public class TestOffsetDateTime_instants { //----------------------------------------------------------------------- private void check(OffsetDateTime test, int y, int mo, int d, int h, int m, int s, int n, ZoneOffset offset) { assertEquals(test.getYear(), y); - assertEquals(test.getMonthOfYear().getValue(), mo); + assertEquals(test.getMonth().getValue(), mo); assertEquals(test.getDayOfMonth(), d); assertEquals(test.getHourOfDay(), h); assertEquals(test.getMinuteOfHour(), m); @@ -88,7 +88,7 @@ public void factory_ofInstant_allSecsInDay() { Instant instant = Instant.ofEpochSecond(i); OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_PONE); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), 1 + (i >= 23 * 60 * 60 ? 1 : 0)); assertEquals(test.getHourOfDay(), ((i / (60 * 60)) + 1) % 24); assertEquals(test.getMinuteOfHour(), (i / 60) % 60); @@ -149,7 +149,7 @@ public void factory_ofInstant_minWithMinOffset() { Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L - OFFSET_MIN.getTotalSeconds()); OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_MIN); assertEquals(test.getYear(), Year.MIN_YEAR); - assertEquals(test.getMonthOfYear().getValue(), 1); + assertEquals(test.getMonth().getValue(), 1); assertEquals(test.getDayOfMonth(), 1); assertEquals(test.getOffset(), OFFSET_MIN); assertEquals(test.getHourOfDay(), 0); @@ -165,7 +165,7 @@ public void factory_ofInstant_minWithMaxOffset() { Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L - OFFSET_MAX.getTotalSeconds()); OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_MAX); assertEquals(test.getYear(), Year.MIN_YEAR); - assertEquals(test.getMonthOfYear().getValue(), 1); + assertEquals(test.getMonth().getValue(), 1); assertEquals(test.getDayOfMonth(), 1); assertEquals(test.getOffset(), OFFSET_MAX); assertEquals(test.getHourOfDay(), 0); @@ -181,7 +181,7 @@ public void factory_ofInstant_maxWithMinOffset() { Instant instant = Instant.ofEpochSecond((days + 1) * 24L * 60L * 60L - 1 - OFFSET_MIN.getTotalSeconds()); OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_MIN); assertEquals(test.getYear(), Year.MAX_YEAR); - assertEquals(test.getMonthOfYear().getValue(), 12); + assertEquals(test.getMonth().getValue(), 12); assertEquals(test.getDayOfMonth(), 31); assertEquals(test.getOffset(), OFFSET_MIN); assertEquals(test.getHourOfDay(), 23); @@ -197,7 +197,7 @@ public void factory_ofInstant_maxWithMaxOffset() { Instant instant = Instant.ofEpochSecond((days + 1) * 24L * 60L * 60L - 1 - OFFSET_MAX.getTotalSeconds()); OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_MAX); assertEquals(test.getYear(), Year.MAX_YEAR); - assertEquals(test.getMonthOfYear().getValue(), 12); + assertEquals(test.getMonth().getValue(), 12); assertEquals(test.getDayOfMonth(), 31); assertEquals(test.getOffset(), OFFSET_MAX); assertEquals(test.getHourOfDay(), 23); @@ -263,7 +263,7 @@ private void doTest_factory_ofInstant_all(long minYear, long maxYear) { // Instant instant = Instant.instant(i * 24L * 60L * 60L); // try { // cal.setTimeInMillis(instant.getEpochSecond() * 1000L); -// assertEquals(cal.get(GregorianCalendar.MONTH), expected.getMonthOfYear().getValue() - 1); +// assertEquals(cal.get(GregorianCalendar.MONTH), expected.getMonth().getValue() - 1); // assertEquals(cal.get(GregorianCalendar.DAY_OF_MONTH), expected.getDayOfMonth().getValue()); // expected = expected.plusDays(1); // } catch (RuntimeException ex) { diff --git a/src/test/java/javax/time/TestZonedDateTime.java b/src/test/java/javax/time/TestZonedDateTime.java index f3a57bcd..05918499 100644 --- a/src/test/java/javax/time/TestZonedDateTime.java +++ b/src/test/java/javax/time/TestZonedDateTime.java @@ -132,7 +132,7 @@ public void now_Clock_allSecsInDay_utc() { Clock clock = Clock.fixed(instant, ZoneId.UTC); ZonedDateTime test = ZonedDateTime.now(clock); assertEquals(test.getYear(), 1970); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2)); assertEquals(test.getHourOfDay(), (i / (60 * 60)) % 24); assertEquals(test.getMinuteOfHour(), (i / 60) % 60); @@ -163,7 +163,7 @@ public void now_Clock_allSecsInDay_beforeEpoch() { Clock clock = Clock.fixed(instant, ZoneId.UTC); ZonedDateTime test = ZonedDateTime.now(clock); assertEquals(test.getYear(), 1969); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); expected = expected.minusSeconds(1); assertEquals(test.toLocalTime(), expected); @@ -193,7 +193,7 @@ public void now_Clock_offsets() { //----------------------------------------------------------------------- void check(ZonedDateTime test, int y, int m, int d, int h, int min, int s, int n, ZoneOffset offset, ZoneId zone) { assertEquals(test.getYear(), y); - assertEquals(test.getMonthOfYear().getValue(), m); + assertEquals(test.getMonth().getValue(), m); assertEquals(test.getDayOfMonth(), d); assertEquals(test.getHourOfDay(), h); assertEquals(test.getMinuteOfHour(), min); @@ -580,7 +580,7 @@ public void test_factory_CalendricalObject_null() { // public void test_parse(int y, int month, int d, int h, int m, int s, int n, String zoneId, String text) { // ZonedDateTime t = ZonedDateTime.parse(text); // assertEquals(t.getYear(), y); -// assertEquals(t.getMonthOfYear().getValue(), month); +// assertEquals(t.getMonth().getValue(), month); // assertEquals(t.getDayOfMonth(), d); // assertEquals(t.getHourOfDay(), h); // assertEquals(t.getMinuteOfHour(), m); @@ -669,7 +669,7 @@ public void test_get(int y, int o, int d, int h, int m, int s, int n, ZoneId zon ZonedDateTime a = ZonedDateTime.of(localDateTime, zone); assertEquals(a.getYear(), localDate.getYear()); - assertEquals(a.getMonthOfYear(), localDate.getMonthOfYear()); + assertEquals(a.getMonth(), localDate.getMonth()); assertEquals(a.getDayOfMonth(), localDate.getDayOfMonth()); assertEquals(a.getDayOfYear(), localDate.getDayOfYear()); assertEquals(a.getDayOfWeek(), localDate.getDayOfWeek()); @@ -1277,18 +1277,18 @@ public void test_withYear_noChange() { } //----------------------------------------------------------------------- - // with(MonthOfYear) + // with(Month) //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear_MonthOfYear_normal() { + public void test_withMonth_Month_normal() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.with(JANUARY); - assertEquals(test, ZonedDateTime.of(ldt.withMonthOfYear(1), ZONE_0100)); + assertEquals(test, ZonedDateTime.of(ldt.withMonth(1), ZONE_0100)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_MonthOfYear_noChange() { + public void test_withMonth_Month_noChange() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.with(JUNE); @@ -1296,28 +1296,28 @@ public void test_withMonthOfYear_MonthOfYear_noChange() { } @Test(expectedExceptions = NullPointerException.class, groups={"tck"}) - public void test_withMonthOfYear_MonthOfYear_null() { + public void test_withMonth_Month_null() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); base.with((Month) null); } //----------------------------------------------------------------------- - // withMonthOfYear() + // withMonth() //----------------------------------------------------------------------- @Test(groups={"tck"}) - public void test_withMonthOfYear_normal() { + public void test_withMonth_normal() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); - ZonedDateTime test = base.withMonthOfYear(1); - assertEquals(test, ZonedDateTime.of(ldt.withMonthOfYear(1), ZONE_0100)); + ZonedDateTime test = base.withMonth(1); + assertEquals(test, ZonedDateTime.of(ldt.withMonth(1), ZONE_0100)); } @Test(groups={"implementation"}) - public void test_withMonthOfYear_noChange() { + public void test_withMonth_noChange() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); - ZonedDateTime test = base.withMonthOfYear(6); + ZonedDateTime test = base.withMonth(6); assertSame(test, base); } diff --git a/src/test/java/javax/time/calendrical/TestDateAdjusters.java b/src/test/java/javax/time/calendrical/TestDateAdjusters.java index de8291e1..24bc3100 100644 --- a/src/test/java/javax/time/calendrical/TestDateAdjusters.java +++ b/src/test/java/javax/time/calendrical/TestDateAdjusters.java @@ -120,7 +120,7 @@ public void test_firstDayOfMonth_nonLeap() { LocalDate date = date(2007, month, i); LocalDate test = DateAdjusters.firstDayOfMonth().adjustDate(date); assertEquals(test.getYear(), 2007); - assertEquals(test.getMonthOfYear(), month); + assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), 1); } } @@ -133,7 +133,7 @@ public void test_firstDayOfMonth_leap() { LocalDate date = date(2008, month, i); LocalDate test = DateAdjusters.firstDayOfMonth().adjustDate(date); assertEquals(test.getYear(), 2008); - assertEquals(test.getMonthOfYear(), month); + assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), 1); } } @@ -173,7 +173,7 @@ public void test_lastDayOfMonth_nonLeap() { LocalDate date = date(2007, month, i); LocalDate test = DateAdjusters.lastDayOfMonth().adjustDate(date); assertEquals(test.getYear(), 2007); - assertEquals(test.getMonthOfYear(), month); + assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), month.lengthInDays(false)); } } @@ -186,7 +186,7 @@ public void test_lastDayOfMonth_leap() { LocalDate date = date(2008, month, i); LocalDate test = DateAdjusters.lastDayOfMonth().adjustDate(date); assertEquals(test.getYear(), 2008); - assertEquals(test.getMonthOfYear(), month); + assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), month.lengthInDays(true)); } } @@ -226,7 +226,7 @@ public void test_firstDayOfNextMonth_nonLeap() { LocalDate date = date(2007, month, i); LocalDate test = DateAdjusters.firstDayOfNextMonth().adjustDate(date); assertEquals(test.getYear(), month == DECEMBER ? 2008 : 2007); - assertEquals(test.getMonthOfYear(), month.next()); + assertEquals(test.getMonth(), month.next()); assertEquals(test.getDayOfMonth(), 1); } } @@ -239,7 +239,7 @@ public void test_firstDayOfNextMonth_leap() { LocalDate date = date(2008, month, i); LocalDate test = DateAdjusters.firstDayOfNextMonth().adjustDate(date); assertEquals(test.getYear(), month == DECEMBER ? 2009 : 2008); - assertEquals(test.getMonthOfYear(), month.next()); + assertEquals(test.getMonth(), month.next()); assertEquals(test.getDayOfMonth(), 1); } } @@ -279,7 +279,7 @@ public void test_firstDayOfYear_nonLeap() { LocalDate date = date(2007, month, i); LocalDate test = DateAdjusters.firstDayOfYear().adjustDate(date); assertEquals(test.getYear(), 2007); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), 1); } } @@ -292,7 +292,7 @@ public void test_firstDayOfYear_leap() { LocalDate date = date(2008, month, i); LocalDate test = DateAdjusters.firstDayOfYear().adjustDate(date); assertEquals(test.getYear(), 2008); - assertEquals(test.getMonthOfYear(), Month.JANUARY); + assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), 1); } } @@ -332,7 +332,7 @@ public void test_lastDayOfYear_nonLeap() { LocalDate date = date(2007, month, i); LocalDate test = DateAdjusters.lastDayOfYear().adjustDate(date); assertEquals(test.getYear(), 2007); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); } } @@ -345,7 +345,7 @@ public void test_lastDayOfYear_leap() { LocalDate date = date(2008, month, i); LocalDate test = DateAdjusters.lastDayOfYear().adjustDate(date); assertEquals(test.getYear(), 2008); - assertEquals(test.getMonthOfYear(), Month.DECEMBER); + assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); } } @@ -385,7 +385,7 @@ public void test_firstDayOfNextYear_nonLeap() { LocalDate date = date(2007, month, i); LocalDate test = DateAdjusters.firstDayOfNextYear().adjustDate(date); assertEquals(test.getYear(), 2008); - assertEquals(test.getMonthOfYear(), JANUARY); + assertEquals(test.getMonth(), JANUARY); assertEquals(test.getDayOfMonth(), 1); } } @@ -398,7 +398,7 @@ public void test_firstDayOfNextYear_leap() { LocalDate date = date(2008, month, i); LocalDate test = DateAdjusters.firstDayOfNextYear().adjustDate(date); assertEquals(test.getYear(), 2009); - assertEquals(test.getMonthOfYear(), JANUARY); + assertEquals(test.getMonth(), JANUARY); assertEquals(test.getDayOfMonth(), 1); } } @@ -473,7 +473,7 @@ public void test_dayOfWeekInMonth_firstToForth() { for (int ordinal = 1; ordinal <= 4; ordinal++) { LocalDate test = DateAdjusters.dayOfWeekInMonth(ordinal, dow).adjustDate(date); assertEquals(test.getYear(), 2007); - assertEquals(test.getMonthOfYear(), month); + assertEquals(test.getMonth(), month); assertTrue(test.getDayOfMonth() > (ordinal - 1) * 7); assertTrue(test.getDayOfMonth() < ordinal * 7 + 1); assertEquals(test.getDayOfWeek(), dow); @@ -494,7 +494,7 @@ public void test_dayOfWeekInMonth_fifth() { assertEquals(test.getDayOfWeek(), dow); - if (test.getMonthOfYear() == month) { + if (test.getMonth() == month) { assertEquals(test.getYear(), 2007); assertTrue(test.getDayOfMonth() > 28); } else { @@ -509,7 +509,7 @@ public void test_dayOfWeekInMonth_fifth() { "; " + dow); } - assertSame(month.next(), test.getMonthOfYear()); + assertSame(month.next(), test.getMonth()); if (test.getYear() != 2007) { assertSame(month, Month.DECEMBER); @@ -576,7 +576,7 @@ public void test_firstInMonth() { for (DayOfWeek dow : DayOfWeek.values()) { LocalDate test = DateAdjusters.firstInMonth(dow).adjustDate(date); assertEquals(test.getYear(), 2007); - assertEquals(test.getMonthOfYear(), month); + assertEquals(test.getMonth(), month); assertTrue(test.getDayOfMonth() < 8); assertEquals(test.getDayOfWeek(), dow); } @@ -648,7 +648,7 @@ public void test_next() { assertSame(month, Month.DECEMBER); assertTrue(date.getDayOfMonth() > 24); assertEquals(test.getYear(), 2008); - assertSame(test.getMonthOfYear(), Month.JANUARY); + assertSame(test.getMonth(), Month.JANUARY); assertTrue(test.getDayOfMonth() < 8); } } @@ -723,7 +723,7 @@ public void test_nextOrCurrent() { assertSame(month, Month.DECEMBER); assertTrue(date.getDayOfMonth() > 24); assertEquals(test.getYear(), 2008); - assertSame(test.getMonthOfYear(), Month.JANUARY); + assertSame(test.getMonth(), Month.JANUARY); assertTrue(test.getDayOfMonth() < 8); } } @@ -795,7 +795,7 @@ public void test_previous() { assertSame(month, Month.JANUARY); assertTrue(date.getDayOfMonth() < 8); assertEquals(test.getYear(), 2006); - assertSame(test.getMonthOfYear(), Month.DECEMBER); + assertSame(test.getMonth(), Month.DECEMBER); assertTrue(test.getDayOfMonth() > 24); } } @@ -870,7 +870,7 @@ public void test_previousOrCurrent() { assertSame(month, Month.JANUARY); assertTrue(date.getDayOfMonth() < 7); assertEquals(test.getYear(), 2006); - assertSame(test.getMonthOfYear(), Month.DECEMBER); + assertSame(test.getMonth(), Month.DECEMBER); assertTrue(test.getDayOfMonth() > 25); } }