gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 14:05:31 24 4
gpt4 key购买 nike

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

YearMonthDay.daysInYear介绍

[英]Provides the number of days in the indicated year.
[中]提供指定年份中的天数。

代码示例

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

/**
*  
Tests that years divisible by 4, except for years which are both divisible
by 100 and not divisible by 400, have 366 days instead of 365.

*/
@Test
public final void testDaysInYear() {
  for (int i = 1; i < 10000; ++i) {
    if ((i % 4 == 0) && !((i % 100 == 0) && (i % 400 != 0))) {
      Assert.assertEquals((int) 366, (int) YearMonthDay.daysInYear(i));
    } else {
      Assert.assertEquals((int) 365, (int) YearMonthDay.daysInYear(i));
    }
  }
}

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

/**
*  
Initializes a {@link YearMonthDay} from the provided values.


* @param year The year.
* @param dayOfYear The day of the year
(in the range 1 through the number of days in the year).
*/
public YearMonthDay(int year, int dayOfYear) {
  if (dayOfYear > daysInYear(year)) {
    throw new ArgumentException(CesiumLocalization.getYearMonthDayInvalidArgument(), "dayOfYear");
  }
  // year is stored zero-indexed
  m_year = year - 1;
  int[] cumulativeMonthTable = getCumulativeMonthTable(year);
  // month is stored zero-indexed
  for (m_month = 11; m_month > 0; --m_month) {
    if (cumulativeMonthTable[m_month] < dayOfYear) {
      break;
    }
  }
  // day is stored zero-indexed
  m_day = dayOfYear - cumulativeMonthTable[m_month] - 1;
  if (!isValidDate(m_year + 1, m_month + 1, m_day + 1)) {
    throw new ArgumentException(CesiumLocalization.getYearMonthDayInvalidArgument());
  }
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com