示例#1
0
        public virtual void test_plusDaysM1()
        {
            LocalDate date = LocalDate.of(2012, 1, 1);

            for (int i = 0; i < 366 * 4; i++)
            {
                assertEquals(LocalDateUtils.plusDays(date, -1), date.plusDays(-1));
                date = date.plusDays(1);
            }
        }
        /// <summary>
        /// Resolves this adjustment using the specified reference data, returning an adjuster.
        /// <para>
        /// This returns a <seealso cref="DateAdjuster"/> that performs the same calculation as this adjustment.
        /// It binds the holiday calendar, looked up from the reference data, into the result.
        /// As such, there is no need to pass the reference data in again.
        /// </para>
        /// <para>
        /// The resulting adjuster will be <seealso cref="#normalized() normalized"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="refData">  the reference data, used to find the holiday calendar </param>
        /// <returns> the adjuster, bound to a specific holiday calendar </returns>
        public DateAdjuster resolve(ReferenceData refData)
        {
            HolidayCalendar holCalAdj = adjustment.Calendar.resolve(refData);

            if (calendar == HolidayCalendarIds.NO_HOLIDAYS)
            {
                BusinessDayConvention adjustmentConvention = adjustment.Convention;
                return(date => adjustmentConvention.adjust(LocalDateUtils.plusDays(date, days), holCalAdj));
            }
            HolidayCalendar       holCalAdd            = calendar.resolve(refData);
            BusinessDayConvention adjustmentConvention = adjustment.Convention;

            return(date => adjustmentConvention.adjust(holCalAdd.shift(date, days), holCalAdj));
        }