Summary: | Implementation of the RANK function | ||
---|---|---|---|
Product: | POI | Reporter: | rubin wang <roadlit> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 3.8-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows Vista | ||
Attachments: |
implemenation of RANK
FormulaEvalTestData.xls (tests for RANK added) Rank.java FunctionEval.java |
Any chance you could upload a unit test for your implementation? How to test: - open ./test-data/spreadsheet/FormulaEvalTestData.xls and fill the placeholder for RANK. Just follow the pattern that other functions use. The formula testing framework will find and run this test automatically. - It is a good idea to test against the example from MS Office online help: http://office.microsoft.com/en-us/excel-help/rank-function-HP010062535.aspx?CTT=5&origin=HA010277524. Also check that your implementation follows the spec and correctly handles ordered/unordered lists, duplicates, not numbers, etc. Yegor Created attachment 28417 [details]
FormulaEvalTestData.xls (tests for RANK added)
Test case
Created attachment 28418 [details] Rank.java Implementation of RANK(ARG1, ARG2, ARG3). Based on the description in http://office.microsoft.com/en-us/excel-help/rank-function-HP010062535.aspx?CTT=5&origin=HA010277524. The algorithm is as follows: 1) throw EvaluationException(ErrorEval.NUM_ERROR) if either ARG0 does not contain a number or ARG3 does not contain 0 or 1. 2) set rank=0, search each cell in the range specified by ARG2, if the cell contains a number greater than ARG0 and ARG3 is 0, or lower than ARG0 and ARG3 is 1, then rank++; If the cell does not contain a number, then ignore this cell. 3) return the value of rank Created attachment 28419 [details]
FunctionEval.java
Add one line "retval[216] = new Rank();" to the function "private static Function[] produceFunctions()" This is the only change.
|
Created attachment 28414 [details] implemenation of RANK I could not find the implementation of RANK in POI3.8, so I proceed to create one. See attachment. I also "add retval[216] = new Rank();" to private static Function[] produceFunctions(). Thanks