\r
package org.apache.poi.ss.formula.functions;\r
\r
+import org.apache.poi.ss.formula.OperationEvaluationContext;\r
import org.apache.poi.ss.formula.eval.*;\r
\r
import java.math.BigDecimal;\r
*\r
* @author cedric dot walter @ gmail dot com\r
*/\r
-public final class Delta extends Fixed2ArgFunction {\r
+public final class Delta extends Fixed2ArgFunction implements FreeRefFunction {\r
+\r
+ public static final FreeRefFunction instance = new Delta();\r
\r
private final static NumberEval ONE = new NumberEval(1);\r
private final static NumberEval ZERO = new NumberEval(0);\r
return result == 0 ? ONE : ZERO;\r
}\r
\r
+ public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {\r
+ if (args.length == 2) {\r
+ return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1]);\r
+ }\r
+\r
+ return ErrorEval.VALUE_INVALID;\r
+ }\r
}
\ No newline at end of file
--- /dev/null
+package org.apache.poi.ss.formula.functions;\r
+\r
+/**\r
+* Tests DELTA() as loaded from a test data spreadsheet.<p/>\r
+*\r
+* @author cedric dot walter @ gmail dot com\r
+*/\r
+public class TestDeltaFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet {\r
+\r
+ protected String getFilename() {\r
+ return "DeltaFunctionTestCaseData.xls";\r
+ }\r
+}\r