private String createForwardCurve(ScheduleInterface swapTenorDefinition, String forwardCurveName) {

		/*
		 * Temporary "hack" - we try to infer index maturity codes from curve name.
		 */
		String indexMaturityCode = null;
		if(forwardCurveName.contains("_12M") || forwardCurveName.contains("-12M") || forwardCurveName.contains(" 12M")) {
			indexMaturityCode = "12M";
		}
		if(forwardCurveName.contains("_1M")	|| forwardCurveName.contains("-1M")	|| forwardCurveName.contains(" 1M")) {
			indexMaturityCode = "1M";
		}
		if(forwardCurveName.contains("_6M")	|| forwardCurveName.contains("-6M")	|| forwardCurveName.contains(" 6M")) {
			indexMaturityCode = "6M";
		}
		if(forwardCurveName.contains("_3M") || forwardCurveName.contains("-3M") || forwardCurveName.contains(" 3M")) {
			indexMaturityCode = "3M";
		}

		if(forwardCurveName == null || forwardCurveName.isEmpty()) {
			return null;
		}

		// Check if the curves exists, if not create it
		CurveInterface	curve = model.getCurve(forwardCurveName);

		CurveInterface	forwardCurve = null;
		if(curve == null) {
			// Create a new forward curve
			if(isUseForwardCurve) {
				curve = new ForwardCurve(forwardCurveName, swapTenorDefinition.getReferenceDate(), indexMaturityCode, ForwardCurve.InterpolationEntityForward.FORWARD, null);
			}
			else {
				// Alternative: Model the forward curve through an underlying discount curve.
				curve = DiscountCurve.createDiscountCurveFromDiscountFactors(forwardCurveName, new double[] { 0.0 }, new double[] { 1.0 });
				model = model.addCurves(curve);
			}
		}

		// Check if the curve is a discount curve, if yes - create a forward curve wrapper.
		if(DiscountCurveInterface.class.isInstance(curve)) {
			/*
			 *  If the specified forward curve exits as a discount curve, we generate a forward curve
			 *  by wrapping the discount curve and calculating the
			 *  forward from discount factors using the formula (df(T)/df(T+Delta T) - 1) / Delta T).
			 *
			 *  If no index maturity is used, the forward curve is interpreted "single curve", i.e.
			 *  T+Delta T is always the payment.
			 */
			forwardCurve = new ForwardCurveFromDiscountCurve(curve.getName(), swapTenorDefinition.getReferenceDate(), indexMaturityCode);
		}
		else {
			// Use a given forward curve
			forwardCurve = curve;
		}

		model = model.addCurves(forwardCurve);

		return forwardCurve.getName();
	}
private String createForwardCurve ( ScheduleInterface swapTenorDefinition , String forwardCurveName ) { String indexMaturityCode = null ; if ( forwardCurveName . contains ( "_12M" ) || forwardCurveName . contains ( "-12M" ) || forwardCurveName . contains ( " 12M" ) ) { indexMaturityCode = "12M" ; } if ( forwardCurveName . contains ( "_1M" ) || forwardCurveName . contains ( "-1M" ) || forwardCurveName . contains ( " 1M" ) ) { indexMaturityCode = "1M" ; } if ( forwardCurveName . contains ( "_6M" ) || forwardCurveName . contains ( "-6M" ) || forwardCurveName . contains ( " 6M" ) ) { indexMaturityCode = "6M" ; } if ( forwardCurveName . contains ( "_3M" ) || forwardCurveName . contains ( "-3M" ) || forwardCurveName . contains ( " 3M" ) ) { indexMaturityCode = "3M" ; } if ( forwardCurveName == null || forwardCurveName . isEmpty ( ) ) { return null ; } CurveInterface curve = model . getCurve ( forwardCurveName ) ; CurveInterface forwardCurve = null ; if ( curve == null ) { if ( isUseForwardCurve ) { curve = new ForwardCurve ( forwardCurveName , swapTenorDefinition . getReferenceDate ( ) , indexMaturityCode , ForwardCurve . InterpolationEntityForward . FORWARD , null ) ; } else { curve = DiscountCurve . createDiscountCurveFromDiscountFactors ( forwardCurveName , new double [ ] { 0.0 } , new double [ ] { 1.0 } ) ; model = model . addCurves ( curve ) ; } } if ( DiscountCurveInterface . class . isInstance ( curve ) ) { forwardCurve = new ForwardCurveFromDiscountCurve ( curve . getName ( ) , swapTenorDefinition . getReferenceDate ( ) , indexMaturityCode ) ; } else { forwardCurve = curve ; } model = model . addCurves ( forwardCurve ) ; return forwardCurve . getName ( ) ; }
Get a forward curve from the model, if not existing create a forward curve.

@param swapTenorDefinition The swap tenor associated with the forward curve.
@param forwardCurveName The name of the forward curve to create.
@return The forward curve associated with the given name.