gpt4 book ai didi

jgnash.engine.recurring.YearlyReminder类的使用及代码示例

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

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

YearlyReminder介绍

[英]A yearly reminder.
[中]每年一次的提醒。

代码示例

代码示例来源:origin: ccavanaugh/jgnash

@Override
  public LocalDate next() {
    if (isEnabled()) {
      base = base.plusYears(getIncrement());
      if (getStartDate().lengthOfYear() == getStartDate().getDayOfYear()) {
        base = base.withDayOfYear(base.lengthOfYear());
      } else {
        // adjust for actual target date, it could have been modified since the last date
        base = base.withDayOfYear(getStartDate().getDayOfYear());
      }
      if (getEndDate() == null || DateUtils.before(base, getEndDate())) {
        return base;
      }
    }
    return null;
  }
}

代码示例来源:origin: ccavanaugh/jgnash

YearlyIterator() {
  if (getLastDate() != null) {
    base = getLastDate();
    if (getStartDate().lengthOfYear() == getStartDate().getDayOfYear()) {
      base = base.withDayOfYear(base.lengthOfYear());
    } else {
      // adjust for actual target date, it could have been modified since the last date
      base = base.withDayOfYear(getStartDate().getDayOfYear());
    }
  } else {
    base = getStartDate().minusYears(getIncrement());
  }
}

代码示例来源:origin: ccavanaugh/jgnash

@Test
void yearEndTestTwo() {
  final YearlyReminder reminder = new YearlyReminder();
  final LocalDate startDate = LocalDate.ofYearDay(2012, 366);
  reminder.setIncrement(1);
  reminder.setStartDate(startDate);
  reminder.setEndDate(null);
  assertEquals(reminder.getReminderType(), ReminderType.YEARLY);
  final RecurringIterator iterator = reminder.getIterator();
  assertEquals(startDate, iterator.next());
  assertEquals(LocalDate.ofYearDay(2013, 365), iterator.next());
  assertEquals(LocalDate.ofYearDay(2014, 365), iterator.next());
  assertEquals(LocalDate.ofYearDay(2015, 365), iterator.next());
  assertEquals(LocalDate.ofYearDay(2016, 366), iterator.next());
  assertEquals(LocalDate.ofYearDay(2017, 365), iterator.next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2013, 365), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2014, 365), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2015, 365), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2016, 366), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2017, 365), reminder.getIterator().next());
}

代码示例来源:origin: ccavanaugh/jgnash

@Test
void simpleTest() {
  final YearlyReminder reminder = new YearlyReminder();
  reminder.setIncrement(1);
  reminder.setStartDate(startDate);
  reminder.setEndDate(LocalDate.ofYearDay(2017, 365));
  assertEquals(reminder.getReminderType(), ReminderType.YEARLY);
  final RecurringIterator iterator = reminder.getIterator();
  reminder.setLastDate();
  assertEquals(LocalDate.of(2012, Month.DECEMBER, 29), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2013, 364), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2014, 364), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2015, 364), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.of(2016, Month.DECEMBER, 29), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2017, 364), reminder.getIterator().next());

代码示例来源:origin: ccavanaugh/jgnash

@Test
void yearEndTestOne() {
  final YearlyReminder reminder = new YearlyReminder();
  final LocalDate startDate = LocalDate.ofYearDay(2011, 365);
  reminder.setIncrement(1);
  reminder.setStartDate(startDate);
  reminder.setEndDate(null);
  assertEquals(reminder.getReminderType(), ReminderType.YEARLY);
  final RecurringIterator iterator = reminder.getIterator();
  assertEquals(startDate, iterator.next());
  assertEquals(LocalDate.ofYearDay(2012, 366), iterator.next());
  assertEquals(LocalDate.ofYearDay(2013, 365), iterator.next());
  assertEquals(LocalDate.ofYearDay(2014, 365), iterator.next());
  assertEquals(LocalDate.ofYearDay(2015, 365), iterator.next());
  assertEquals(LocalDate.ofYearDay(2016, 366), iterator.next());
  assertEquals(LocalDate.ofYearDay(2017, 365), iterator.next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2012, 366), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2013, 365), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2014, 365), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2015, 365), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2016, 366), reminder.getIterator().next());
  reminder.setLastDate();
  assertEquals(LocalDate.ofYearDay(2017, 365), reminder.getIterator().next());
}

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