public static double calculate(double pStartDateVal, double pEndDateVal, int basis) throws EvaluationException {if (basis < 0 || basis >= 5) {throw new EvaluationException(ErrorEval.NUM_ERROR);}int startDateVal = (int) Math.floor(pStartDateVal);int endDateVal = (int) Math.floor(pEndDateVal);if (startDateVal == endDateVal) {return 0;}if (startDateVal > endDateVal) {int temp = startDateVal;startDateVal = endDateVal;endDateVal = temp;}switch (basis) {case 0: return basis0(startDateVal, endDateVal);case 1: return basis1(startDateVal, endDateVal);case 2: return basis2(startDateVal, endDateVal);case 3: return basis3(startDateVal, endDateVal);case 4: return basis4(startDateVal, endDateVal);}throw new IllegalStateException("cannot happen");}
public static double Calculate(double pStartDateVal, double pEndDateVal, int basis){if (basis < 0 || basis >= 5){throw new EvaluationException(ErrorEval.NUM_ERROR);}int startDateVal = (int)Math.Floor(pStartDateVal);int endDateVal = (int)Math.Floor(pEndDateVal);if (startDateVal == endDateVal){return 0;}if (startDateVal > endDateVal){int temp = startDateVal;startDateVal = endDateVal;endDateVal = temp;}switch (basis){case 0: return Basis0(startDateVal, endDateVal);case 1: return Basis1(startDateVal, endDateVal);case 2: return Basis2(startDateVal, endDateVal);case 3: return Basis3(startDateVal, endDateVal);case 4: return Basis4(startDateVal, endDateVal);}throw new InvalidOperationException("cannot happen");}