org.activityinfo.model.type.time.YearValue类的使用及代码示例

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

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

YearValue介绍

[英]Represents a specific calendar year in the ISO-8601 calendar.
[中]表示ISO-8601日历中的特定日历年。

代码示例

代码示例来源:origin: bedatadriven/activityinfo

@Override
  public double read(FieldValue value) {
    if(value instanceof YearValue) {
      return ((YearValue) value).getYear();
    }
    return Double.NaN;
  }
});

代码示例来源:origin: bedatadriven/activityinfo

@Override
public PeriodValue next() {
  return new YearValue(year + 1);
}

代码示例来源:origin: bedatadriven/activityinfo

/**
 *
 * @return an integer between 1 and 366 indicating which day of this year this date
 * falls.
 */
public int getDayOfYear() {
  int day = CUM_DAYS_IN_MONTH[monthOfYear - 1];
  if(monthOfYear > 2 && YearValue.isLeapYear(year)) {
    day++;
  }
  return day + dayOfMonth;
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public BlockManager visitYear(YearType yearType) {
  return new NumberBlock(fieldName, (IntReader) value -> ((YearValue) value).getYear());
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public PeriodValue previous() {
  return new YearValue(year - 1);
}

代码示例来源:origin: bedatadriven/activityinfo

public static int getLastDayOfMonth(int year, int month) {
  if(month == 2) {
    return YearValue.isLeapYear(year) ? 29 : 28;
  } else {
    return DAYS_IN_MONTH[month - 1];
  }
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public PeriodValue parseString(String string) {
  return new YearValue(Integer.parseInt(string));
}

代码示例来源:origin: bedatadriven/activityinfo

public static int daysBetween(LocalDate x, LocalDate y) {
  assert !x.after(y);
  int days = -x.getDayOfYear();
  int year = x.getYear();
  while(year < y.getYear()) {
    if(YearValue.isLeapYear(year)) {
      days += 366;
    } else {
      days += 365;
    }
    year++;
  }
  return days + y.getDayOfYear();
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
  public PeriodValue containingDate(LocalDate localDate) {
    return new YearValue(localDate.getYear());
  }
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public FieldValue parseJsonValue(JsonValue value) {
  return new YearValue(value.asInt());
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
public PeriodValue fromSubFormKey(RecordRef ref) {
  String subRecordId = ref.getRecordId().asString();
  String yearKey = subRecordId.substring(subRecordId.length() - 4);
  return new YearValue(Integer.parseInt(yearKey));
}

相关文章

YearValue类方法