Skip to content
Browse files

Remove OffsetDate.atTime(OffsetTime) and (ints)

Reduce scope
  • Loading branch information...
1 parent 26f14d3 commit d2faeca24440df7829a79b39edefd98f88e3b187 @jodastephen jodastephen committed Nov 30, 2012
Showing with 0 additions and 276 deletions.
  1. +0 −98 src/main/java/javax/time/OffsetDate.java
  2. +0 −178 src/tck/java/javax/time/TCKOffsetDate.java
View
98 src/main/java/javax/time/OffsetDate.java
@@ -56,7 +56,6 @@
import javax.time.format.DateTimeParseException;
import javax.time.jdk8.DefaultInterfaceDateTimeAccessor;
import javax.time.jdk8.Jdk8Methods;
-import javax.time.zone.ZoneResolvers;
/**
* A date with an offset from UTC/Greenwich in the ISO-8601 calendar system,
@@ -838,23 +837,6 @@ public OffsetDate minusDays(long days) {
* <p>
* This merges the two objects - {@code this} and the specified time -
* to form an instance of {@code OffsetDateTime}.
- * If the offset of the time differs from the offset of the date, then the
- * result will have the offset of the date and the time will be adjusted to match.
- * <p>
- * This instance is immutable and unaffected by this method call.
- *
- * @param time the time to combine with, not null
- * @return the offset date-time formed from this date and the specified time, not null
- */
- public OffsetDateTime atTime(OffsetTime time) {
- return date.atTime(time.withOffsetSameInstant(offset));
- }
-
- /**
- * Returns an offset date-time formed from this date at the specified time.
- * <p>
- * This merges the two objects - {@code this} and the specified time -
- * to form an instance of {@code OffsetDateTime}.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -865,86 +847,6 @@ public OffsetDateTime atTime(LocalTime time) {
return OffsetDateTime.of(date, time, offset);
}
- /**
- * Returns an offset date-time formed from this date at the specified time.
- * <p>
- * This merges the three values - {@code this} and the specified time -
- * to form an instance of {@code OffsetDateTime}.
- * <p>
- * This instance is immutable and unaffected by this method call.
- *
- * @param hour the hour-of-day to use, from 0 to 23
- * @param minute the minute-of-hour to use, from 0 to 59
- * @return the offset date-time formed from this date and the specified time, not null
- * @throws DateTimeException if the value of any field is out of range
- */
- public OffsetDateTime atTime(int hour, int minute) {
- return atTime(LocalTime.of(hour, minute));
- }
-
- /**
- * Returns an offset date-time formed from this date at the specified time.
- * <p>
- * This merges the four values - {@code this} and the specified time -
- * to form an instance of {@code OffsetDateTime}.
- * <p>
- * This instance is immutable and unaffected by this method call.
- *
- * @param hour the hour-of-day to use, from 0 to 23
- * @param minute the minute-of-hour to use, from 0 to 59
- * @param second the second-of-minute to represent, from 0 to 59
- * @return the offset date-time formed from this date and the specified time, not null
- * @throws DateTimeException if the value of any field is out of range
- */
- public OffsetDateTime atTime(int hour, int minute, int second) {
- return atTime(LocalTime.of(hour, minute, second));
- }
-
- /**
- * Returns an offset date-time formed from this date at the specified time.
- * <p>
- * This merges the five values - {@code this} and the specified time -
- * to form an instance of {@code OffsetDateTime}.
- * <p>
- * This instance is immutable and unaffected by this method call.
- *
- * @param hour the hour-of-day to use, from 0 to 23
- * @param minute the minute-of-hour to use, from 0 to 59
- * @param second the second-of-minute to represent, from 0 to 59
- * @param nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999
- * @return the offset date-time formed from this date and the specified time, not null
- * @throws DateTimeException if the value of any field is out of range
- */
- public OffsetDateTime atTime(int hour, int minute, int second, int nanoOfSecond) {
- return atTime(LocalTime.of(hour, minute, second, nanoOfSecond));
- }
-
- /**
- * Returns a zoned date-time from this date at the earliest valid time according
- * to the rules in the time-zone ignoring the current offset.
- * <p>
- * Time-zone rules, such as daylight savings, mean that not every time on the
- * local time-line exists. If the local date is in a gap or overlap according to
- * the rules then a resolver is used to determine the resultant local time and offset.
- * This method uses the {@link ZoneResolvers#postGapPreOverlap() post-gap pre-overlap} resolver.
- * This selects the date-time immediately after a gap and the earlier offset in overlaps.
- * This combination chooses the earliest valid local time on the date, typically midnight.
- * <p>
- * To convert to a specific time in a given time-zone call {@link #atTime(LocalTime)}
- * followed by {@link OffsetDateTime#atZoneSimilarLocal(ZoneId)}.
- * <p>
- * The offset from this date is ignored during the conversion.
- * This ensures that the resultant date-time has the same date as this.
- * <p>
- * This instance is immutable and unaffected by this method call.
- *
- * @param zone the time-zone to use, not null
- * @return the zoned date-time formed from this date and the earliest valid time for the zone, not null
- */
- public ZonedDateTime atStartOfDay(ZoneId zone) {
- return ZonedDateTime.of(date, LocalTime.MIDNIGHT, zone, ZoneResolvers.postGapPreOverlap());
- }
-
//-----------------------------------------------------------------------
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
View
178 src/tck/java/javax/time/TCKOffsetDate.java
@@ -83,8 +83,6 @@
public class TCKOffsetDate extends AbstractDateTimeTest {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
- private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris");
- private static final ZoneId ZONE_GAZA = ZoneId.of("Asia/Gaza");
private OffsetDate TEST_2007_07_15_PONE;
@@ -1574,33 +1572,6 @@ public void test_minusDays_overflowTooSmall() {
// atTime()
//-----------------------------------------------------------------------
@Test(groups={"tck"})
- public void test_atTime_Offset_sameOffset() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- OffsetTime time = OffsetTime.of(11, 30, OFFSET_PTWO);
- assertEquals(t.atTime(time), OffsetDateTime.of(2008, 6, 30, 11, 30, OFFSET_PTWO));
- }
-
- @Test(groups={"tck"})
- public void test_atTime_Offset_differentOffset1() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- OffsetTime time = OffsetTime.of(11, 30, OFFSET_PONE); // 10:30Z, 12:30+02:00
- assertEquals(t.atTime(time), OffsetDateTime.of(2008, 6, 30, 12, 30, OFFSET_PTWO));
- }
-
- @Test(groups={"tck"})
- public void test_atTime_Offset_differentOffset2() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- OffsetTime time = OffsetTime.of(11, 30, 5, 6, ZoneOffset.ofHours(-3)); // 14:30Z, 16:30+02:00
- assertEquals(t.atTime(time), OffsetDateTime.of(2008, 6, 30, 16, 30, 5, 6, OFFSET_PTWO));
- }
-
- @Test(expectedExceptions=NullPointerException.class, groups={"tck"})
- public void test_atTime_Offset_nullOffsetTime() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime((OffsetTime) null);
- }
-
- @Test(groups={"tck"})
public void test_atTime_Local() {
OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
assertEquals(t.atTime(LocalTime.of(11, 30)), OffsetDateTime.of(2008, 6, 30, 11, 30, OFFSET_PTWO));
@@ -1612,155 +1583,6 @@ public void test_atTime_Local_nullLocalTime() {
t.atTime((LocalTime) null);
}
- @Test(groups={"tck"})
- public void test_atTime_int_int() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- assertEquals(t.atTime(11, 30), OffsetDateTime.of(2008, 6, 30, 11, 30, OFFSET_PTWO));
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_hourTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(-1, 30);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_hourTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(24, 30);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_minuteTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, -1);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_minuteTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 60);
- }
-
- @Test(groups={"tck"})
- public void test_atTime_int_int_int() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- assertEquals(t.atTime(11, 30, 40), OffsetDateTime.of(2008, 6, 30, 11, 30, 40, OFFSET_PTWO));
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_hourTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(-1, 30, 40);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_hourTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(24, 30, 40);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_minuteTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, -1, 40);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_minuteTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 60, 40);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_secondTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 30, -1);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_secondTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 30, 60);
- }
-
- @Test(groups={"tck"})
- public void test_atTime_int_int_int_int() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- assertEquals(t.atTime(11, 30, 40, 50), OffsetDateTime.of(2008, 6, 30, 11, 30, 40, 50, OFFSET_PTWO));
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_hourTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(-1, 30, 40, 50);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_hourTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(24, 30, 40, 50);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_minuteTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, -1, 40, 50);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_minuteTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 60, 40, 50);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_secondTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 30, -1, 50);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_secondTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 30, 60, 50);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_nanoTooSmall() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 30, 40, -1);
- }
-
- @Test(expectedExceptions=DateTimeException.class, groups={"tck"})
- public void test_atTime_int_int_int_int_nanoTooBig() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atTime(11, 30, 40, 1000000000);
- }
-
- //-----------------------------------------------------------------------
- // atStartOfDay()
- //-----------------------------------------------------------------------
- @Test(groups={"tck"})
- public void test_atStartOfDay() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- assertEquals(t.atStartOfDay(ZONE_PARIS),
- ZonedDateTime.of(LocalDateTime.of(2008, 6, 30, 0, 0), ZONE_PARIS));
- }
-
- @Test(groups={"tck"})
- public void test_atStartOfDay_dstGap() {
- OffsetDate t = OffsetDate.of(2007, 4, 1, OFFSET_PTWO);
- assertEquals(t.atStartOfDay(ZONE_GAZA),
- ZonedDateTime.of(LocalDateTime.of(2007, 4, 1, 1, 0), ZONE_GAZA));
- }
-
- @Test(expectedExceptions=NullPointerException.class, groups={"tck"})
- public void test_atStartOfDay_nullZoneOffset() {
- OffsetDate t = OffsetDate.of(2008, 6, 30, OFFSET_PTWO);
- t.atStartOfDay((ZoneId) null);
- }
-
//-----------------------------------------------------------------------
// getDate()
//-----------------------------------------------------------------------

0 comments on commit d2faeca

Please sign in to comment.
Something went wrong with that request. Please try again.