/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(OvernightCompoundedRateComputation beanToCopy) { this.index = beanToCopy.getIndex(); this.fixingCalendar = beanToCopy.getFixingCalendar(); this.startDate = beanToCopy.getStartDate(); this.endDate = beanToCopy.getEndDate(); this.rateCutOffDays = beanToCopy.getRateCutOffDays(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 100346066: // index return ((OvernightCompoundedRateComputation) bean).getIndex(); case 394230283: // fixingCalendar return ((OvernightCompoundedRateComputation) bean).getFixingCalendar(); case -2129778896: // startDate return ((OvernightCompoundedRateComputation) bean).getStartDate(); case -1607727319: // endDate return ((OvernightCompoundedRateComputation) bean).getEndDate(); case -92095804: // rateCutOffDays return ((OvernightCompoundedRateComputation) bean).getRateCutOffDays(); } return super.propertyGet(bean, propertyName, quiet); }
private ObservationDetails(OvernightCompoundedRateComputation computation, OvernightIndexRates rates) { this.computation = computation; this.rates = rates; this.indexFixingDateSeries = rates.getFixings(); this.dayCount = computation.getIndex().getDayCount(); // Details of the cutoff period this.firstFixing = computation.getStartDate(); this.lastFixingP1 = computation.getEndDate(); this.lastFixing = computation.getFixingCalendar().previous(lastFixingP1); this.cutoffOffset = Math.max(computation.getRateCutOffDays(), 1); this.accrualFactorCutoff = new double[cutoffOffset - 1]; LocalDate currentFixing = lastFixing; for (int i = 0; i < cutoffOffset - 1; i++) { currentFixing = computation.getFixingCalendar().previous(currentFixing); LocalDate effectiveDate = computation.calculateEffectiveFromFixing(currentFixing); LocalDate maturityDate = computation.calculateMaturityFromEffective(effectiveDate); accrualFactorCutoff[i] = dayCount.yearFraction(effectiveDate, maturityDate); } this.lastFixingNonCutoff = currentFixing; LocalDate startUnderlyingPeriod = computation.calculateEffectiveFromFixing(firstFixing); LocalDate endUnderlyingPeriod = computation.calculateMaturityFromFixing(lastFixing); this.accrualFactorTotal = dayCount.yearFraction(startUnderlyingPeriod, endUnderlyingPeriod); }