summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorCédric Walter <cedricwalter@apache.org>2013-10-07 09:42:38 +0000
committerCédric Walter <cedricwalter@apache.org>2013-10-07 09:42:38 +0000
commit805d583babb63603041dab32eedee471bd0aad75 (patch)
tree14f99c3cc5b354ac48d2e93b0463732f7d4fe071 /src/java
parent927dc0ce1d49f221752cea6e997f1b59be4dd125 (diff)
downloadpoi-805d583babb63603041dab32eedee471bd0aad75.tar.gz
poi-805d583babb63603041dab32eedee471bd0aad75.zip
Bug 55037: patch for missing function DELTA
Add missing TestDeltaFunctionsFromSpreadsheet and register Delta in AnalysisToolPak git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1529809 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java2
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/Delta.java12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java b/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java
index 551ff75474..b866c61bf3 100644
--- a/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java
+++ b/src/java/org/apache/poi/ss/formula/atp/AnalysisToolPak.java
@@ -91,7 +91,7 @@ public final class AnalysisToolPak implements UDFFinder {
r(m, "DEC2BIN", null);
r(m, "DEC2HEX", null);
r(m, "DEC2OCT", null);
- r(m, "DELTA", null);
+ r(m, "DELTA", Delta.instance);
r(m, "DISC", null);
r(m, "DOLLARDE", null);
r(m, "DOLLARFR", null);
diff --git a/src/java/org/apache/poi/ss/formula/functions/Delta.java b/src/java/org/apache/poi/ss/formula/functions/Delta.java
index 8488189aa5..2f1bd88dfc 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Delta.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Delta.java
@@ -17,6 +17,7 @@
package org.apache.poi.ss.formula.functions;
+import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.*;
import java.math.BigDecimal;
@@ -37,7 +38,9 @@ import java.math.BigDecimal;
*
* @author cedric dot walter @ gmail dot com
*/
-public final class Delta extends Fixed2ArgFunction {
+public final class Delta extends Fixed2ArgFunction implements FreeRefFunction {
+
+ public static final FreeRefFunction instance = new Delta();
private final static NumberEval ONE = new NumberEval(1);
private final static NumberEval ZERO = new NumberEval(0);
@@ -72,4 +75,11 @@ public final class Delta extends Fixed2ArgFunction {
return result == 0 ? ONE : ZERO;
}
+ public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
+ if (args.length == 2) {
+ return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1]);
+ }
+
+ return ErrorEval.VALUE_INVALID;
+ }
} \ No newline at end of file