Bug 55037 - [PATCH] patch for missing function DELTA
[PATCH] patch for missing function DELTA
Status: RESOLVED FIXED
Product: POI
Classification: Unclassified
Component: POI Overall
3.10-dev
PC All
: P2 normal (vote)
: ---
Assigned To: POI Developers List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2013-05-31 17:37 UTC by Cédric Walter
Modified: 2013-10-07 09:43 UTC (History)
0 users



Attachments
new function delta + testcases (1.79 KB, application/gzip)
2013-05-31 17:37 UTC, Cédric Walter
Details
This spreadsheet contains various test cases for the functions: DELTA (27.00 KB, patch)
2013-06-02 18:08 UTC, Cédric Walter
Details | Diff
This spreadsheet contains various test cases for the functions: DELTA (27.00 KB, application/vnd.ms-excel)
2013-06-02 18:09 UTC, Cédric Walter
Details
patch : TestDeltaFunctionsFromSpreadsheet.java Delta.java AnalysisToolPak.java (5.36 KB, text/plain)
2013-06-03 07:18 UTC, Cédric Walter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cédric Walter 2013-05-31 17:37:43 UTC
Created attachment 30351 [details]
new function delta + testcases

new function delta + testcases
Comment 1 Yegor Kozlov 2013-06-02 15:54:01 UTC
Patch applied in r1488730 but there is some work to do . 

DELTA is a function from the Excel Analysis Toolpack . It needs to implement FreeRefFunction and be registered in org.apache.poi.ss.formula.atp.AnalysisToolPak. Otherwise the formula evaluator will not find it. 

What you need to do:

(1) Declare DELTA as implementing FreeRefFunction . There is one method to implement and you need to simply delegate it to the existing implementation:

    public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
        if (args.length != 2) {
            return ErrorEval.VALUE_INVALID;
        }
        return evaluate(ec.getRowIndex(), ec.getColumnIndex(), args[0], args[1]);    
    }

(2) register DELTA in AnalysisToolPack, see how other functions are registered and follow the pattern.

(3) Provide a test(s) that evaluate functions from a real excel file. Attach the modified test workbook to this bug report.

Yegor
Comment 2 Cédric Walter 2013-06-02 18:08:40 UTC
Created attachment 30365 [details]
This spreadsheet contains various test cases for the functions: DELTA
Comment 3 Cédric Walter 2013-06-02 18:09:29 UTC
Created attachment 30366 [details]
This spreadsheet contains various test cases for the functions: DELTA
Comment 4 Yegor Kozlov 2013-06-02 23:08:25 UTC
You seem to attached the test spreadsheet instead of the patch. Please re-attach.

Yegor
Comment 5 Cédric Walter 2013-06-03 07:18:24 UTC
Created attachment 30380 [details]
patch : TestDeltaFunctionsFromSpreadsheet.java Delta.java AnalysisToolPak.java
Comment 6 Cédric Walter 2013-10-07 09:43:40 UTC
Add missing TestDeltaFunctionsFromSpreadsheet and register Delta in AnalysisToolPak in r1529809