protected void addRedemptionsToCashflows(final List<Double> redemptions){
  calculateNotionalsFromCashflows();
  redemptions_.clear();
  for (int i=1; i < notionalSchedule_.size(); ++i) {
    final double R=i < redemptions.size() ? redemptions.get(i) : !redemptions.isEmpty() ? redemptions.get(redemptions.size() - 1) : 100.0;
    final double amount=(R / 100.0) * (notionals_.get(i - 1) - notionals_.get(i));
    final CashFlow redemption=new SimpleCashFlow(amount,notionalSchedule_.get(i));
    cashflows_.add(redemption);
    redemptions_.add(redemption);
  }
  Collections.sort(cashflows_,new EarlierThanCashFlowComparator());
}

protected void addRedemptionsToCashflows ( final List < Double > redemptions ) { calculateNotionalsFromCashflows ( ) ; redemptions_ . clear ( ) ; for ( int i = 1 ; i < notionalSchedule_ . size ( ) ; ++ i ) { final double R = i < redemptions . size ( ) ? redemptions . get ( i ) : ! redemptions . isEmpty ( ) ? redemptions . get ( redemptions . size ( ) - 1 ) : 100.0 ; final double amount = ( R / 100.0 ) * ( notionals_ . get ( i - 1 ) - notionals_ . get ( i ) ) ; final CashFlow redemption = new SimpleCashFlow ( amount , notionalSchedule_ . get ( i ) ) ; cashflows_ . add ( redemption ) ; redemptions_ . add ( redemption ) ; } Collections . sort ( cashflows_ , new EarlierThanCashFlowComparator ( ) ) ; }
this method can be called by derived classes in order to build redemption payments from the existing cash flows . it must be called after setting up the cashflows_ vector and will fill the notionalschedule_ , notionals_ , and redemptions_ data members . if given , the elements of the redemptions vector will multiply the amount of the redemption cash flow . the elements will be taken in base 100 , i . e . , a redemption equal to 100 does not modify the amount . the cashflows_ vector must contain at least one coupon and must be sorted by date .
