docs: @Override
  	public double getDiscountFactor(AnalyticModel model, double maturity) {
  		ForwardCurve	forwardCurve;
  		if(this.forwardCurve != null) {
  			forwardCurve = this.forwardCurve;
  		} else {
  			forwardCurve = model.getForwardCurve(forwardCurveName);
  		}
  
  		if(forwardCurve == null) {
  			throw new IllegalArgumentException("No forward curve given and no forward curve found in the model under the name " + forwardCurveName + ".");
  		}
  
  		double	time			= 0;
  		double	discountFactor	= 1.0;
  		double paymentOffset = 0;
  		while(time < maturity) {
  			paymentOffset	= forwardCurve.getPaymentOffset(time);
  			if(paymentOffset <= 0) {
  				throw new RuntimeException("Trying to calculate a discount curve from a forward curve with non-positive payment offset.");
  			}
  			discountFactor /= 1.0 + forwardCurve.getForward(model, time) * Math.min(paymentOffset, maturity-time) * timeScaling;
  			time += paymentOffset;
  		}
  
  		return discountFactor;
  	}