public virtual void coverage_builder() { BusinessDayAdjustment test = BusinessDayAdjustment.builder().convention(MODIFIED_FOLLOWING).calendar(SAT_SUN).build(); assertEquals(test.Convention, MODIFIED_FOLLOWING); assertEquals(test.Calendar, SAT_SUN); }
private AdjustableDate(LocalDate unadjusted, BusinessDayAdjustment adjustment) { JodaBeanUtils.notNull(unadjusted, "unadjusted"); JodaBeanUtils.notNull(adjustment, "adjustment"); this.unadjusted = unadjusted; this.adjustment = adjustment; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "convention", dataProviderClass = BusinessDayConventionTest.class) public void test_adjustDate(BusinessDayConvention convention, java.time.LocalDate input, java.time.LocalDate expected) public virtual void test_adjustDate(BusinessDayConvention convention, LocalDate input, LocalDate expected) { BusinessDayAdjustment test = BusinessDayAdjustment.of(convention, SAT_SUN); assertEquals(test.adjust(input, REF_DATA), expected); assertEquals(test.resolve(REF_DATA).adjust(input), expected); }
public virtual void test_basics() { BusinessDayAdjustment test = BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN); assertEquals(test.Convention, MODIFIED_FOLLOWING); assertEquals(test.Calendar, SAT_SUN); assertEquals(test.ToString(), "ModifiedFollowing using calendar Sat/Sun"); }
public virtual void test_noAdjust_factory() { BusinessDayAdjustment test = BusinessDayAdjustment.of(BusinessDayConventions.NO_ADJUST, NO_HOLIDAYS); assertEquals(test.Convention, BusinessDayConventions.NO_ADJUST); assertEquals(test.Calendar, NO_HOLIDAYS); assertEquals(test.ToString(), "NoAdjust"); }
public virtual void test_noAdjust_normalized() { BusinessDayAdjustment test = BusinessDayAdjustment.of(BusinessDayConventions.NO_ADJUST, SAT_SUN); assertEquals(test.Convention, BusinessDayConventions.NO_ADJUST); assertEquals(test.Calendar, SAT_SUN); assertEquals(test.ToString(), "NoAdjust using calendar Sat/Sun"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testImmutableReferenceDataWithMergedHolidays() public virtual void testImmutableReferenceDataWithMergedHolidays() { HolidayCalendar hc = HolidayCalendars.FRI_SAT.combinedWith(HolidayCalendars.SAT_SUN); ImmutableReferenceData referenceData = ImmutableReferenceData.of(hc.Id, hc); LocalDate date = BusinessDayAdjustment.of(BusinessDayConventions.PRECEDING, hc.Id).adjust(LocalDate.of(2016, 8, 20), referenceData); assertEquals(LocalDate.of(2016, 8, 18), date); }
private DaysAdjustment(int days, HolidayCalendarId calendar, BusinessDayAdjustment adjustment) { JodaBeanUtils.notNull(days, "days"); JodaBeanUtils.notNull(calendar, "calendar"); JodaBeanUtils.notNull(adjustment, "adjustment"); this.days = days; this.calendar = calendar; this.adjustment = adjustment; }
private TenorAdjustment(Tenor tenor, PeriodAdditionConvention additionConvention, BusinessDayAdjustment adjustment) { JodaBeanUtils.notNull(tenor, "tenor"); JodaBeanUtils.notNull(additionConvention, "additionConvention"); JodaBeanUtils.notNull(adjustment, "adjustment"); this.tenor = tenor; this.additionConvention = additionConvention; this.adjustment = adjustment; validate(); }
private PeriodAdjustment(Period period, PeriodAdditionConvention additionConvention, BusinessDayAdjustment adjustment) { JodaBeanUtils.notNull(period, "period"); JodaBeanUtils.notNull(additionConvention, "additionConvention"); JodaBeanUtils.notNull(adjustment, "adjustment"); this.period = period; this.additionConvention = additionConvention; this.adjustment = adjustment; validate(); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { BusinessDayAdjustment other = (BusinessDayAdjustment)obj; return(JodaBeanUtils.equal(convention, other.convention) && JodaBeanUtils.equal(calendar, other.calendar)); } return(false); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 482476551: // unadjusted this.unadjusted = (LocalDate)newValue; break; case 1977085293: // adjustment this.adjustment = (BusinessDayAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 110246592: // tenor this.tenor_Renamed = (Tenor)newValue; break; case 1652975501: // additionConvention this.additionConvention_Renamed = (PeriodAdditionConvention)newValue; break; case 1977085293: // adjustment this.adjustment_Renamed = (BusinessDayAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3076183: // days this.days_Renamed = (int?)newValue.Value; break; case -178324674: // calendar this.calendar_Renamed = (HolidayCalendarId)newValue; break; case 1977085293: // adjustment this.adjustment_Renamed = (BusinessDayAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Obtains an instance that can adjust a date by a specific number of business days. /// <para> /// When adjusting a date, the specified number of business days is added. /// This is equivalent to repeatedly finding the next business day. /// </para> /// <para> /// The business day adjustment is applied to the result of the addition. /// /// </para> /// </summary> /// <param name="numberOfDays"> the number of days </param> /// <param name="holidayCalendar"> the calendar that defines holidays and business days </param> /// <param name="adjustment"> the business day adjustment to apply to the result of the addition </param> /// <returns> the days adjustment </returns> public static DaysAdjustment ofBusinessDays(int numberOfDays, HolidayCalendarId holidayCalendar, BusinessDayAdjustment adjustment) { return(new DaysAdjustment(numberOfDays, holidayCalendar, adjustment)); }
/// <summary> /// Obtains an instance that can adjust a date by a specific number of calendar days. /// <para> /// When adjusting a date, the specified number of calendar days is added. /// Holidays and weekends are not taken into account in the calculation. /// </para> /// <para> /// The business day adjustment is applied to the result of the addition. /// /// </para> /// </summary> /// <param name="numberOfDays"> the number of days </param> /// <param name="adjustment"> the business day adjustment to apply to the result of the addition </param> /// <returns> the days adjustment </returns> public static DaysAdjustment ofCalendarDays(int numberOfDays, BusinessDayAdjustment adjustment) { return(new DaysAdjustment(numberOfDays, HolidayCalendarIds.NO_HOLIDAYS, adjustment)); }
public virtual void test_serialization() { assertSerialization(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN)); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(PeriodAdjustment beanToCopy) { this.period_Renamed = beanToCopy.Period; this.additionConvention_Renamed = beanToCopy.AdditionConvention; this.adjustment_Renamed = beanToCopy.Adjustment; }
//------------------------------------------------------------------------- public virtual void coverage() { coverImmutableBean(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN)); }
/// <summary> /// Obtains an instance that can adjust a date by the specified tenor using the /// last business day of month convention. /// <para> /// When adjusting a date, the specified tenor is added to the input date. /// The business day adjustment will then be used to ensure the result is a valid business day. /// </para> /// <para> /// The period must consist only of months and/or years. /// /// </para> /// </summary> /// <param name="tenor"> the tenor to add to the input date </param> /// <param name="adjustment"> the business day adjustment to apply to the result of the addition </param> /// <returns> the tenor adjustment </returns> public static TenorAdjustment ofLastBusinessDay(Tenor tenor, BusinessDayAdjustment adjustment) { return(new TenorAdjustment(tenor, PeriodAdditionConventions.LAST_BUSINESS_DAY, adjustment)); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(TenorAdjustment beanToCopy) { this.tenor_Renamed = beanToCopy.Tenor; this.additionConvention_Renamed = beanToCopy.AdditionConvention; this.adjustment_Renamed = beanToCopy.Adjustment; }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance that can adjust a date by the specified tenor. /// <para> /// When adjusting a date, the specified tenor is added to the input date. /// The business day adjustment will then be used to ensure the result is a valid business day. /// /// </para> /// </summary> /// <param name="tenor"> the tenor to add to the input date </param> /// <param name="additionConvention"> the convention used to perform the addition </param> /// <param name="adjustment"> the business day adjustment to apply to the result of the addition </param> /// <returns> the tenor adjustment </returns> public static TenorAdjustment of(Tenor tenor, PeriodAdditionConvention additionConvention, BusinessDayAdjustment adjustment) { return(new TenorAdjustment(tenor, additionConvention, adjustment)); }
/// <summary> /// Obtains an instance that can adjust a date by the specified period using the /// last business day of month convention. /// <para> /// When adjusting a date, the specified period is added to the input date. /// The business day adjustment will then be used to ensure the result is a valid business day. /// </para> /// <para> /// The period must consist only of months and/or years. /// /// </para> /// </summary> /// <param name="period"> the period to add to the input date </param> /// <param name="adjustment"> the business day adjustment to apply to the result of the addition </param> /// <returns> the period adjustment </returns> public static PeriodAdjustment ofLastBusinessDay(Period period, BusinessDayAdjustment adjustment) { return(new PeriodAdjustment(period, PeriodAdditionConventions.LAST_BUSINESS_DAY, adjustment)); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(DaysAdjustment beanToCopy) { this.days_Renamed = beanToCopy.Days; this.calendar_Renamed = beanToCopy.Calendar; this.adjustment_Renamed = beanToCopy.Adjustment; }
/// <summary> /// Obtains an instance with a business day adjustment. /// <para> /// This creates an adjustable date from the unadjusted date and business day adjustment. /// The adjusted date is accessible via <seealso cref="#adjusted(ReferenceData)"/>. /// /// </para> /// </summary> /// <param name="unadjusted"> the unadjusted date </param> /// <param name="adjustment"> the business day adjustment to apply to the unadjusted date </param> /// <returns> the adjustable date </returns> public static AdjustableDate of(LocalDate unadjusted, BusinessDayAdjustment adjustment) { return(new AdjustableDate(unadjusted, adjustment)); }
/// <summary> /// Sets the business day adjustment that is performed to the result of the addition. /// <para> /// This adjustment is applied to the result of the period addition calculation. /// If the addition is performed using business days then any adjustment here is expected to /// have a different holiday calendar to that used during addition. /// </para> /// <para> /// If no adjustment is required, use the 'None' business day adjustment. /// </para> /// <para> /// See the class-level documentation for more information. /// </para> /// </summary> /// <param name="adjustment"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder adjustment(BusinessDayAdjustment adjustment) { JodaBeanUtils.notNull(adjustment, "adjustment"); this.adjustment_Renamed = adjustment; return(this); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance that can adjust a date by the specified period. /// <para> /// When adjusting a date, the specified period is added to the input date. /// The business day adjustment will then be used to ensure the result is a valid business day. /// /// </para> /// </summary> /// <param name="period"> the period to add to the input date </param> /// <param name="additionConvention"> the convention used to perform the addition </param> /// <param name="adjustment"> the business day adjustment to apply to the result of the addition </param> /// <returns> the period adjustment </returns> public static PeriodAdjustment of(Period period, PeriodAdditionConvention additionConvention, BusinessDayAdjustment adjustment) { return(new PeriodAdjustment(period, additionConvention, adjustment)); }