git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1900398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-04-29 20:47:25 +00:00
parent 22aa2922cc
commit 5a8ee02f3a
1 changed files with 7 additions and 7 deletions

View File

@ -32,21 +32,21 @@ public class AverageIf extends Baseifs {
public static final FreeRefFunction instance = new Averageifs(); public static final FreeRefFunction instance = new Averageifs();
@Override @Override
public ValueEval evaluate(ValueEval[] _args, OperationEvaluationContext _ec) { public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
if (_args.length < 2) { if (args.length < 2) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
try { try {
AreaEval sumRange = convertRangeArg(_args[0]); AreaEval sumRange = convertRangeArg(args[0]);
if (_args.length == 3) { if (args.length == 3) {
sumRange = convertRangeArg(_args[2]); sumRange = convertRangeArg(args[2]);
} }
// collect pairs of ranges and criteria // collect pairs of ranges and criteria
AreaEval ae = convertRangeArg(_args[0]); AreaEval ae = convertRangeArg(args[0]);
I_MatchPredicate mp = Countif.createCriteriaPredicate(_args[1], _ec.getRowIndex(), _ec.getColumnIndex()); I_MatchPredicate mp = Countif.createCriteriaPredicate(args[1], ec.getRowIndex(), ec.getColumnIndex());
if (mp instanceof Countif.ErrorMatcher) { if (mp instanceof Countif.ErrorMatcher) {
throw new EvaluationException(ErrorEval.valueOf(((Countif.ErrorMatcher) mp).getValue())); throw new EvaluationException(ErrorEval.valueOf(((Countif.ErrorMatcher) mp).getValue()));