public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {int nArgs = args.length;if (nArgs < 2) {return ErrorEval.VALUE_INVALID;}try {double rate = NumericFunction.singleOperandEvaluate(args[0], srcRowIndex, srcColumnIndex);ValueEval[] vargs = new ValueEval[args.length-1];System.arraycopy(args, 1, vargs, 0, vargs.length);double[] values = AggregateFunction.ValueCollector.collectValues(vargs);double result = FinanceLib.npv(rate, values);NumericFunction.checkValue(result);return new NumberEval(result);} catch (EvaluationException e) {return e.getErrorEval();}}
public ValueEval Evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex){int nArgs = args.Length;if (nArgs < 2){return ErrorEval.VALUE_INVALID;}try{double rate = NumericFunction.SingleOperandEvaluate(args[0], srcRowIndex, srcColumnIndex);ValueEval[] vargs = new ValueEval[args.Length - 1];Array.Copy(args, 1, vargs, 0, vargs.Length);double[] values = AggregateFunction.ValueCollector.CollectValues(vargs);double result = FinanceLib.npv(rate, values);NumericFunction.CheckValue(result);return new NumberEval(result);}catch (EvaluationException e){return e.GetErrorEval();}}