tempCollection$0.add(new LeapSecond(2441317.5, 10D)); tempCollection$0.add(new LeapSecond(2441499.5, 11D)); tempCollection$0.add(new LeapSecond(2441683.5, 12D)); tempCollection$0.add(new LeapSecond(2442048.5, 13D)); tempCollection$0.add(new LeapSecond(2442413.5, 14D)); tempCollection$0.add(new LeapSecond(2442778.5, 15D)); tempCollection$0.add(new LeapSecond(2443144.5, 16D)); tempCollection$0.add(new LeapSecond(2443509.5, 17D)); tempCollection$0.add(new LeapSecond(2443874.5, 18D)); tempCollection$0.add(new LeapSecond(2444239.5, 19D)); tempCollection$0.add(new LeapSecond(2444786.5, 20D)); tempCollection$0.add(new LeapSecond(2445151.5, 21D)); tempCollection$0.add(new LeapSecond(2445516.5, 22D)); tempCollection$0.add(new LeapSecond(2446247.5, 23D)); tempCollection$0.add(new LeapSecond(2447161.5, 24D)); tempCollection$0.add(new LeapSecond(2447892.5, 25D)); tempCollection$0.add(new LeapSecond(2448257.5, 26D)); tempCollection$0.add(new LeapSecond(2448804.5, 27D)); tempCollection$0.add(new LeapSecond(2449169.5, 28D)); tempCollection$0.add(new LeapSecond(2449534.5, 29D)); tempCollection$0.add(new LeapSecond(2450083.5, 30D)); tempCollection$0.add(new LeapSecond(2450630.5, 31D)); tempCollection$0.add(new LeapSecond(2451179.5, 32D)); tempCollection$0.add(new LeapSecond(2453736.5, 33D)); tempCollection$0.add(new LeapSecond(2454832.5, 34D)); tempCollection$0.add(new LeapSecond(2456109.5, 35D)); tempCollection$0.add(new LeapSecond(2457204.5, 36D)); tempCollection$0.add(new LeapSecond(2457754.5, 37D)); m_leapSeconds = tempCollection$0;
/** * Determines if a given day contains a leap second. * @param julianDayNumber The day, specified as a Julian day number. * @return true if the day contains a leap second, otherwise false. */ public final boolean doesDayHaveLeapSecond(int julianDayNumber) { LeapSecond potentialLeapSecond = new LeapSecond(new JulianDate(julianDayNumber, 43200D, TimeStandard.COORDINATED_UNIVERSAL_TIME), 0.0); return Collections.binarySearch(m_leapSeconds, potentialLeapSecond, s_leapSecondComparer) >= 0; }
/** * Tests that JulianDate.GetHashCode returns something at least reasonably random. */ @Test public final void testGetHashCode() { LeapSecond leapSecond1 = new LeapSecond(2451545.0, 100.0); LeapSecond leapSecond2 = new LeapSecond(2451545.0, 100.0); LeapSecond leapSecond3 = new LeapSecond(2451545.0, 101.0); Assert.assertEquals((int) leapSecond1.hashCode(), (int) leapSecond2.hashCode()); AssertHelper.assertNotEqual(leapSecond1.hashCode(), leapSecond3.hashCode()); }
/** * Tests equality between leap second instances. */ @Test public final void testEquality() { LeapSecond leapSecond1 = new LeapSecond(2451545.0, 100.0); LeapSecond leapSecond2 = new LeapSecond(2451545.0, 100.0); LeapSecond leapSecond3 = new LeapSecond(2451545.0, 101.0); LeapSecond leapSecond4 = new LeapSecond(2451546.0, 101.0); AssertHelper.assertEquals(leapSecond1, leapSecond2); Assert.assertTrue(LeapSecond.equals(leapSecond1, leapSecond2)); AssertHelper.assertNotEqual(leapSecond1, leapSecond3); Assert.assertTrue(LeapSecond.notEquals(leapSecond1, leapSecond3)); AssertHelper.assertNotEqual(leapSecond1, 5); AssertHelper.assertNotEqual(leapSecond3, leapSecond4); }
/** * Tests that negative leap seconds are supported. */ @Test public final void testNegativeLeapSecond() { ArrayList<cesiumlanguagewriter.LeapSecond> newList = new ArrayList<cesiumlanguagewriter.LeapSecond>(); newList.add(new LeapSecond(2451545.0, 11D)); newList.add(new LeapSecond(2451555.0, 12D)); newList.add(new LeapSecond(2451565.0, 11D)); newList.add(new LeapSecond(2451575.0, 10D)); LeapSeconds leapSeconds = new LeapSeconds(newList); Assert.assertEquals(11, leapSeconds.getTaiMinusUtc(new JulianDate(2451545.5, TimeStandard.COORDINATED_UNIVERSAL_TIME)), 0d); Assert.assertEquals(12, leapSeconds.getTaiMinusUtc(new JulianDate(2451555.5, TimeStandard.COORDINATED_UNIVERSAL_TIME)), 0d); Assert.assertEquals(11, leapSeconds.getTaiMinusUtc(new JulianDate(2451565.5, TimeStandard.COORDINATED_UNIVERSAL_TIME)), 0d); Assert.assertEquals(10, leapSeconds.getTaiMinusUtc(new JulianDate(2451575.5, TimeStandard.COORDINATED_UNIVERSAL_TIME)), 0d); }
public final boolean tryConvertTaiToUtc(@Nonnull JulianDate date, @Nonnull JulianDate[] result) { LeapSecond toFind = new LeapSecond(date.getTotalDays(), 0.0); int index = Collections.binarySearch(m_leapSeconds, toFind, s_leapSecondComparer); if (index < 0) {
LeapSecond toFind = new LeapSecond(date, 0.0);
@Test public final void testConstructorRequiresUTC() { ExpectedExceptionHelper.expectException(getRule$expectedException(), ArgumentException.class, "The given date must be in the UTC time standard", MessageMatch.CONTAINS); // ReSharper disable once UnusedVariable cesiumlanguagewriter.LeapSecond leapSecond = new LeapSecond(new JulianDate(2451545.0, TimeStandard.INTERNATIONAL_ATOMIC_TIME), 100.0); }
/** * Tests the ToString of LeapSecond. */ @Test public final void testToString() { LeapSecond leapSecond = new LeapSecond(2451545.0, 100.0); String expected = StringHelper.format("2451545:0 UTC ({0}), 100", new GregorianDate(new JulianDate(2451545.0, TimeStandard.COORDINATED_UNIVERSAL_TIME))); Assert.assertEquals(expected, leapSecond.toString()); }
@Test public final void testConstructor() { LeapSecond leapSecond = new LeapSecond(2451545.0, 100.0); Assert.assertEquals(2451545.0, leapSecond.getDate().getTotalDays(), 0d); Assert.assertEquals(100.0, leapSecond.getTotalTaiOffsetFromUtc(), 0d); AssertHelper.assertEquals(TimeStandard.COORDINATED_UNIVERSAL_TIME, leapSecond.getDate().getStandard()); }