Package org.threeten.bp

Examples of org.threeten.bp.LocalDate.plusDays()


    public void test_atDay_notLeapYear() {
        Year test = Year.of(2007);
        LocalDate expected = LocalDate.of(2007, 1, 1);
        for (int i = 1; i <= 365; i++) {
            assertEquals(test.atDay(i), expected);
            expected = expected.plusDays(1);
        }
    }

    @Test(expectedExceptions=DateTimeException.class)
    public void test_atDay_notLeapYear_day366() {
View Full Code Here


    public void test_atDay_leapYear() {
        Year test = Year.of(2008);
        LocalDate expected = LocalDate.of(2008, 1, 1);
        for (int i = 1; i <= 366; i++) {
            assertEquals(test.atDay(i), expected);
            expected = expected.plusDays(1);
        }
    }

    @Test(expectedExceptions=DateTimeException.class)
    public void test_atDay_day0() {
View Full Code Here

                if (dayOfWeek != null) {
                    date = date.with(nextOrSame(dayOfWeek));
                }
            }
            if (timeEndOfDay) {
                date = date.plusDays(1);
            }
            return date;
        }

        // no equals() or hashCode()
View Full Code Here

            if (dow != null) {
                date = date.with(nextOrSame(dow));
            }
        }
        if (timeEndOfDay) {
            date = date.plusDays(1);
        }
        LocalDateTime localDT = LocalDateTime.of(date, time);
        LocalDateTime transition = timeDefinition.createDateTime(localDT, standardOffset, offsetBefore);
        return new ZoneOffsetTransition(transition, offsetBefore, offsetAfter);
    }
View Full Code Here

        while (!holidayCalendar.isWorkingDay(lastFridayOfMonth)) {
          lastFridayOfMonth = lastFridayOfMonth.minusDays(1);
        }
        return lastFridayOfMonth;
      }
      date = date.plusDays(1);
    }
    LocalDate result = lastFridayOfMonth.with(PREVIOUS_FRIDAY_ADJUSTER);
    while (!holidayCalendar.isWorkingDay(result)) {
      result = result.minusDays(1);
    }
View Full Code Here

                .create();
            executionSequence.add(executionOptions);
          }
          previousWorkingDate = currentDate;
        }
        currentDate = currentDate.plusDays(1);
      }
      return new ArbitraryViewCycleExecutionSequence(executionSequence);
    }

    private MarketDataSpecification createMarketDataSpec(LocalDate previousHistoricalDate, LocalDate historicalDate, LocalDate valuationDate) {
View Full Code Here

  @Override
  public LocalDate adjustDate(final Calendar workingDays, final LocalDate date) {
    LocalDate result = date;
    while (!workingDays.isWorkingDay(result)) {
      result = result.plusDays(1);
    }
    return result;
  }

  @Override
View Full Code Here

    ArgumentChecker.notNull(holidayCalendar, "null holidayCalendar");

    int daysLeft = workingDaysToAdd;
    LocalDate temp = startDate;
    while (daysLeft > 0) {
      temp = temp.plusDays(1);
      if (holidayCalendar.isWorkingDay(temp)) {
        daysLeft--;
      }
    }
    return temp;
View Full Code Here

      return daysBetween / daysInYear;
    }
    final LocalDate[] schedule = ScheduleFactory.getSchedule(firstDate, secondDate, 1, true, true, false);
    LocalDate d = schedule[0];
    if (d.isLeapYear() && d.getMonth() == Month.FEBRUARY && d.getDayOfMonth() == 28) {
      d = d.plusDays(1);
    }
    return schedule.length + getDayCountFraction(firstDate, d);
  }

  @Override
View Full Code Here

  public double getDayCountFraction(final LocalDate firstDate, final LocalDate secondDate, final Calendar calendar) {
    testDates(firstDate, secondDate);
    ArgumentChecker.notNull(calendar, "calendar");
    LocalDate date = firstDate;
    while (!calendar.isWorkingDay(date)) {
      date = date.plusDays(1);
    }
    date = date.plusDays(1);
    int count = 0;
    while (!date.isAfter(secondDate)) {
      if (calendar.isWorkingDay(date)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.