code: public double getValueWithGivenSpreadOverCurve(double evaluationTime,Curve referenceCurve, double spread, AnalyticModel model) {
  		double value=0;
  		for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods();periodIndex++) {
  			double paymentDate	= schedule.getPayment(periodIndex);
  			value+= paymentDate>evaluationTime ? getCouponPayment(periodIndex,model)*Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate): 0.0;
  		}
  
  		double paymentDate	= schedule.getPayment(schedule.getNumberOfPeriods()-1);
  		return paymentDate>evaluationTime ? value+Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate):0.0;
  	}
docs: Returns the value of the sum of discounted cash flows of the bond where
  the discounting is done with the given reference curve and an additional spread.
  This method can be used for optimizer.
  
  @param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered.
  @param referenceCurve The reference curve used for discounting the coupon payments.
  @param spread The spread which should be added to the discount curve.
  @param model The model under which the product is valued.
  @return The value of the bond for the given curve and spread.