Author: fanningpj
Date: Fri Apr 29 20:12:12 2022
New Revision: 1900395
URL: http://svn.apache.org/viewvc?rev=1900395&view=rev
Log:
reformat
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AverageIf.java
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AverageIf.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AverageIf.java?rev=1900395&r1=1900394&r2=1900395&view=diff
==============================================================================
---
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AverageIf.java
(original)
+++
poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AverageIf.java
Fri Apr 29 20:12:12 2022
@@ -29,7 +29,6 @@ import org.apache.poi.ss.formula.functio
* the generic AverageIfs version.
*/
public class AverageIf extends Baseifs {
-
public static final FreeRefFunction instance = new Averageifs();
@Override
@@ -62,18 +61,17 @@ public class AverageIf extends Baseifs {
protected ValueEval aggregateMatchingCells(Aggregator aggregator, AreaEval
sumRange, AreaEval testRange, I_MatchPredicate mp)
throws EvaluationException {
- int height = testRange.getHeight();
- int width = testRange.getWidth();
+ final int height = testRange.getHeight();
+ final int width = testRange.getWidth();
for (int r = 0; r < height; r++) {
for (int c = 0; c < width; c++) {
ValueEval _testValue = testRange.getRelativeValue(r, c);
- ;
-
ValueEval _sumValue = sumRange.getRelativeValue(r, c);
- if (mp != null && mp.matches(_testValue)) { // aggregate only
if all of the corresponding criteria specified are true for that cell.
+ if (mp != null && mp.matches(_testValue)) {
+ // aggregate only if all of the corresponding criteria
specified are true for that cell.
if (_testValue instanceof ErrorEval) {
throw new EvaluationException((ErrorEval) _testValue);
}
@@ -89,10 +87,8 @@ public class AverageIf extends Baseifs {
return false;
}
-
@Override
protected Aggregator createAggregator() {
-
return new Aggregator() {
Double sum = 0.0;
Integer count = 0;
@@ -102,7 +98,7 @@ public class AverageIf extends Baseifs {
if (!(value instanceof NumberEval)) return;
- double d = ((NumberEval) value).getNumberValue();
+ final double d = ((NumberEval) value).getNumberValue();
sum += d;
count++;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]