gpt4 book ai didi

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

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

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

YearMonthDay.isValidDate介绍

[英]Indicates whether the year, month, and day are a valid representation.
[中]

代码示例

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

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



* @param year The year.
* @param month The month of the year (in the range 1 through 12)
* @param day The day of the month (in the range 1 through the number of
days in {@code month})
* @exception ArgumentException 
Thrown when the {@code year}, {@code month}, or
{@code day} is outside of its acceptable range.
*/
public YearMonthDay(int year, int month, int day) {
  if (!isValidDate(year, month, day)) {
    throw new ArgumentException(CesiumLocalization.getYearMonthDayInvalidArgument());
  }
  // fields are stored zero-indexed
  m_year = year - 1;
  m_month = month - 1;
  m_day = day - 1;
}

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

m_month--;
m_day--;
if (!isValidDate(m_year + 1, m_month + 1, m_day + 1)) {
  throw new ArgumentOutOfRangeException(CesiumLocalization.getYearMonthDayInvalidArgument());

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

Assert.assertFalse(YearMonthDay.isValidDate(2000, 0, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 1, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 2, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 3, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 4, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 5, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 6, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 7, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 8, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 9, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 10, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 11, 1));
Assert.assertTrue(YearMonthDay.isValidDate(2000, 12, 1));
Assert.assertFalse(YearMonthDay.isValidDate(2000, 13, 1));
for (int month = 1; month < 13; ++month) {
  int daysInMonth = YearMonthDay.daysInMonth(2000, month);
  Assert.assertFalse(YearMonthDay.isValidDate(2000, month, 0));
  for (int day = 1; day < daysInMonth + 1; ++day) {
    Assert.assertTrue(YearMonthDay.isValidDate(2000, month, day));
  Assert.assertFalse(YearMonthDay.isValidDate(2000, month, daysInMonth + 1));

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

return false;
if (!YearMonthDay.isValidDate(year, month, day)) {
  return false;

代码示例来源: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());
  }
}

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