private double getWeightForTenorRefinement(double periodStartPrevious, double periodEndPrevious, double periodStart, double periodEnd) {
		TimeDiscretization numeriareDiscretization = liborPeriodDiscretizations[0];

		int periodStartPreviousIndex = numeriareDiscretization.getTimeIndex(periodStartPrevious);
		int periodEndPreviousIndex = numeriareDiscretization.getTimeIndex(periodEndPrevious);
		int periodStartIndex = numeriareDiscretization.getTimeIndex(periodStart);
		int periodEndIndex = numeriareDiscretization.getTimeIndex(periodEnd);

		/// @TODO Need to improve LIBOR interpolation if required
		if(periodStartIndex < 0) {
			periodStartIndex = -periodStartIndex-1;
		}
		if(periodEndIndex < 0) {
			periodEndIndex = -periodEndIndex-1-1;
		}

		double weight1 = 0.0;
		for(int periodIndex = periodStartPreviousIndex; periodIndex<periodEndPreviousIndex; periodIndex++) {
			double deltaT = covarianceModel.getScaledTenorTime(numeriareDiscretization.getTime(periodIndex), numeriareDiscretization.getTime(periodIndex+1));
			double deltaTSum = covarianceModel.getScaledTenorTime(periodStartPrevious, numeriareDiscretization.getTime(periodIndex+1));
			weight1 +=  deltaT * deltaTSum;
		}

		double weight2 = 0.0;
		for(int periodIndex = periodStartIndex; periodIndex<periodEndIndex; periodIndex++) {
			double deltaT = covarianceModel.getScaledTenorTime(numeriareDiscretization.getTime(periodIndex), numeriareDiscretization.getTime(periodIndex+1));
			double deltaTSum = covarianceModel.getScaledTenorTime(periodStartPrevious, numeriareDiscretization.getTime(periodIndex+1));
			weight2 +=  deltaT * deltaTSum;
		}

		if(weight1 > 0) {
			return weight2 / covarianceModel.getScaledTenorTime(periodStart, periodEnd) - weight1 / covarianceModel.getScaledTenorTime(periodStartPrevious, periodEndPrevious);
		} else {
			return weight2 / covarianceModel.getScaledTenorTime(periodStart, periodEnd);
		}
	}
private double getWeightForTenorRefinement ( double periodStartPrevious , double periodEndPrevious , double periodStart , double periodEnd ) { TimeDiscretization numeriareDiscretization = liborPeriodDiscretizations [ 0 ] ; int periodStartPreviousIndex = numeriareDiscretization . getTimeIndex ( periodStartPrevious ) ; int periodEndPreviousIndex = numeriareDiscretization . getTimeIndex ( periodEndPrevious ) ; int periodStartIndex = numeriareDiscretization . getTimeIndex ( periodStart ) ; int periodEndIndex = numeriareDiscretization . getTimeIndex ( periodEnd ) ; if ( periodStartIndex < 0 ) { periodStartIndex = - periodStartIndex - 1 ; } if ( periodEndIndex < 0 ) { periodEndIndex = - periodEndIndex - 1 - 1 ; } double weight1 = 0.0 ; for ( int periodIndex = periodStartPreviousIndex ; periodIndex < periodEndPreviousIndex ; periodIndex ++ ) { double deltaT = covarianceModel . getScaledTenorTime ( numeriareDiscretization . getTime ( periodIndex ) , numeriareDiscretization . getTime ( periodIndex + 1 ) ) ; double deltaTSum = covarianceModel . getScaledTenorTime ( periodStartPrevious , numeriareDiscretization . getTime ( periodIndex + 1 ) ) ; weight1 += deltaT * deltaTSum ; } double weight2 = 0.0 ; for ( int periodIndex = periodStartIndex ; periodIndex < periodEndIndex ; periodIndex ++ ) { double deltaT = covarianceModel . getScaledTenorTime ( numeriareDiscretization . getTime ( periodIndex ) , numeriareDiscretization . getTime ( periodIndex + 1 ) ) ; double deltaTSum = covarianceModel . getScaledTenorTime ( periodStartPrevious , numeriareDiscretization . getTime ( periodIndex + 1 ) ) ; weight2 += deltaT * deltaTSum ; } if ( weight1 > 0 ) { return weight2 / covarianceModel . getScaledTenorTime ( periodStart , periodEnd ) - weight1 / covarianceModel . getScaledTenorTime ( periodStartPrevious , periodEndPrevious ) ; } else { return weight2 / covarianceModel . getScaledTenorTime ( periodStart , periodEnd ) ; } }
@param periodStartPrevious
@param periodEndPrevious
@param periodStart
@param periodEnd
@return