cesiumlanguagewriter.YearMonthDay.getYear()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中cesiumlanguagewriter.YearMonthDay.getYear()方法的一些代码示例,展示了YearMonthDay.getYear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDay.getYear()方法的具体详情如下:
包路径:cesiumlanguagewriter.YearMonthDay
类名称:YearMonthDay
方法名:getYear

YearMonthDay.getYear介绍

[英]Gets the year.
[中]获得年度最佳成绩。

代码示例

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. * Gets the year.
  3. */
  4. public final int getYear() {
  5. return m_yearMonthDay.getYear();
  6. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. * Gets the day of the year (in the range 1 through the number of days in the year).
  3. */
  4. public final int getDayOfYear() {
  5. int[] cumulativeMonthTable = getCumulativeMonthTable(getYear());
  6. return getDay() + cumulativeMonthTable[m_month];
  7. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. * Gets the Julian day number for this {@link YearMonthDay} instance,
  3. assuming noon on this day.
  4. */
  5. public final int getJulianDayNumber() {
  6. // Algorithm from page 604 of the Explanatory Supplement to the
  7. // Astronomical Almanac (Seidelmann 1992).
  8. int a = (getMonth() - 14) / 12;
  9. int b = getYear() + 4800 + a;
  10. return 1461 * b / 4 + 367 * (getMonth() - 2 - 12 * a) / 12 - 3 * ((b + 100) / 100) / 4 + getDay() - 32075;
  11. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. * Gets the day of the week represented by this instance.
  3. * @return A {@code DayOfWeek} ({@link #getDayOfWeek get}) enumerated constant that indicates the day
  4. of the week. This property value ranges from zero, indicating Sunday, to six,
  5. indicating Saturday.
  6. */
  7. @Nonnull
  8. public final DayOfWeek getDayOfWeek() {
  9. return DateTimeHelper.create(getYear(), getMonth(), getDay()).getDayOfWeek();
  10. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Returns a string formatted as Year:Month:Day
  4. * @return The string.
  5. */
  6. @Override
  7. public String toString() {
  8. return StringHelper.format(CultureInfoHelper.getCurrentCulture(), "{0}:{1}:{2}", getYear(), getMonth(), getDay());
  9. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. * Convert this {@link GregorianDate} to a {@link ZonedDateTime}.
  3. The {@link ZonedDateTime} will be in UTC.
  4. * @return A {@link ZonedDateTime} representing this date.
  5. */
  6. @CS2JWarning("Unhandled attribute removed: Pure")
  7. @Nonnull
  8. public final ZonedDateTime toDateTime() {
  9. ZonedDateTime date = DateTimeHelper.create(m_yearMonthDay.getYear(), m_yearMonthDay.getMonth(), m_yearMonthDay.getDay());
  10. final long ticksPerHour = 36000000000L;
  11. final long ticksPerMinute = 600000000L;
  12. final long ticksPerSecond = 10000000L;
  13. long ticks = DateTimeHelper.getTicks(date);
  14. ticks += m_hour * ticksPerHour;
  15. ticks += m_minute * ticksPerMinute;
  16. ticks += (long) Math.rint(m_second * ticksPerSecond);
  17. return DateTimeHelper.create(ticks, ZoneOffset.UTC);
  18. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Tests that initialization of and access to the structure elements is performed correctly.
  4. */
  5. @Test
  6. public final void testRetainValue() {
  7. YearMonthDay date = new YearMonthDay(2000, 1, 1);
  8. Assert.assertEquals((int) 2000, (int) date.getYear());
  9. Assert.assertEquals((int) 1, (int) date.getMonth());
  10. Assert.assertEquals((int) 1, (int) date.getDay());
  11. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Tests the constructor overload that takes a {@link JulianDate}.
  4. */
  5. @Test
  6. public final void testConstructFromJulianDate() {
  7. ZonedDateTime dt = DateTimeHelper.create(2008, 10, 23, 12, 0, 0);
  8. JulianDate jd = new JulianDate(dt);
  9. YearMonthDay ymd = new YearMonthDay(jd);
  10. Assert.assertEquals((int) 2008, (int) ymd.getYear());
  11. Assert.assertEquals((int) 10, (int) ymd.getMonth());
  12. Assert.assertEquals((int) 23, (int) ymd.getDay());
  13. dt = DateTimeHelper.create(2008, 10, 23, 0, 0, 0);
  14. jd = new JulianDate(dt);
  15. ymd = new YearMonthDay(jd);
  16. Assert.assertEquals((int) 2008, (int) ymd.getYear());
  17. Assert.assertEquals((int) 10, (int) ymd.getMonth());
  18. Assert.assertEquals((int) 23, (int) ymd.getDay());
  19. dt = DateTimeHelper.create(2008, 10, 23, 23, 59, 59);
  20. jd = new JulianDate(dt);
  21. ymd = new YearMonthDay(jd);
  22. Assert.assertEquals((int) 2008, (int) ymd.getYear());
  23. Assert.assertEquals((int) 10, (int) ymd.getMonth());
  24. Assert.assertEquals((int) 23, (int) ymd.getDay());
  25. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. @Test
  2. public final void testDefaultConstructedIsValid() {
  3. YearMonthDay ymd = new YearMonthDay();
  4. YearMonthDay ymd2 = new YearMonthDay(ymd.getYear(), ymd.getMonth(), ymd.getDay());
  5. AssertHelper.assertEquals(ymd, ymd2);
  6. AssertHelper.assertEquals(ymd.getDayOfWeek(), ymd2.getDayOfWeek());
  7. Assert.assertEquals((int) ymd.getDayOfYear(), (int) ymd2.getDayOfYear());
  8. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. Assert.assertEquals((int) year, (int) ymd.getYear());
  2. Assert.assertEquals((int) month, (int) ymd.getMonth());
  3. Assert.assertEquals((int) 1, (int) ymd.getDay());
  4. Assert.assertEquals((int) year, (int) ymd.getYear());
  5. Assert.assertEquals((int) month, (int) ymd.getMonth());
  6. Assert.assertEquals((int) daysInMonth, (int) ymd.getDay());

相关文章