You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/05/27 00:02:18 UTC

svn commit: r1901301 - /poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java

Author: fanningpj
Date: Fri May 27 00:02:18 2022
New Revision: 1901301

URL: http://svn.apache.org/viewvc?rev=1901301&view=rev
Log:
add VARPA and STDEVPA functions

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

Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java?rev=1901301&r1=1901300&r2=1901301&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/formula/functions/AggregateFunction.java Fri May 27 00:02:18 2022
@@ -145,7 +145,11 @@ public abstract class AggregateFunction
     }
 
     protected AggregateFunction() {
-        super(false, false);
+        this(false);
+    }
+
+    protected AggregateFunction(boolean isReferenceBoolCounted) {
+        super(isReferenceBoolCounted, false);
     }
 
     /**
@@ -195,12 +199,18 @@ public abstract class AggregateFunction
             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
             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
             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
             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
             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) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org