]> source.dussan.org Git - poi.git/commitdiff
add VARPA and STDEVPA functions
authorPJ Fanning <fanningpj@apache.org>
Fri, 27 May 2022 00:02:18 +0000 (00:02 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 27 May 2022 00:02:18 +0000 (00:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901301 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java

index b8379bc5eafca2e56e17acef2b066b24822e6079..41ba43cb6a87572fdf8b62849bfca4d4383fde91 100644 (file)
@@ -145,7 +145,11 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction {
     }
 
     protected AggregateFunction() {
-        super(false, false);
+        this(false);
+    }
+
+    protected AggregateFunction(boolean isReferenceBoolCounted) {
+        super(isReferenceBoolCounted, false);
     }
 
     /**
@@ -195,12 +199,18 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction {
             return MathX.average(values);
         }
     };
-    public static final Function AVERAGEA = new AggregateFunction() {
+    abstract static class AggregateFunctionA extends AggregateFunction {
+
+        protected AggregateFunctionA() {
+            super(true);
+        }
+
         @Override
         protected boolean handleLogicalValues() {
             return true;
         }
-
+    }
+    public static final Function AVERAGEA = new AggregateFunctionA() {
         @Override
         protected double evaluate(double[] values) throws EvaluationException {
             if (values.length < 1) {
@@ -251,12 +261,7 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction {
             return StatsLib.stdevp(values);
         }
     };
-    public static final Function STDEVA = new AggregateFunction() {
-        @Override
-        protected boolean handleLogicalValues() {
-            return true;
-        }
-
+    public static final Function STDEVA = new AggregateFunctionA() {
         @Override
         protected double evaluate(double[] values) throws EvaluationException {
             if (values.length < 1) {
@@ -265,12 +270,7 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction {
             return StatsLib.stdev(values);
         }
     };
-    public static final Function STDEVPA = new AggregateFunction() {
-        @Override
-        protected boolean handleLogicalValues() {
-            return true;
-        }
-
+    public static final Function STDEVPA = new AggregateFunctionA() {
         @Override
         protected double evaluate(double[] values) throws EvaluationException {
             if (values.length < 1) {
@@ -305,12 +305,7 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction {
             return StatsLib.varp(values);
         }
     };
-    public static final Function VARA = new AggregateFunction() {
-        @Override
-        protected boolean handleLogicalValues() {
-            return true;
-        }
-
+    public static final Function VARA = new AggregateFunctionA() {
         @Override
         protected double evaluate(double[] values) throws EvaluationException {
             if (values.length < 1) {
@@ -319,12 +314,7 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction {
             return StatsLib.var(values);
         }
     };
-    public static final Function VARPA = new AggregateFunction() {
-        @Override
-        protected boolean handleLogicalValues() {
-            return true;
-        }
-
+    public static final Function VARPA = new AggregateFunctionA() {
         @Override
         protected double evaluate(double[] values) throws EvaluationException {
             if (values.length < 1) {