https://issues.apache.org/bugzilla/show_bug.cgi?id=50209
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #5 from Yegor Kozlov <[email protected]> 2011-07-25 16:19:00 UTC --- (In reply to comment #4) > Created attachment 27118 [details] > patch Fixed in r1150673 The fix is based on the proposed patch, but I chose a bit different strategy. Instead of pulling DoubleList and iteration logic from MultiOperandNumericFunction and thus duplicating code, it is better to inject this logic right into MultiOperandNumericFunction.collectValues. I think I found an elegant way how to do that. P.S. You patch assumes that the last ptg in nested cells is FuncVarPtg: + public int getFunctionIndex( EvaluationCell srcCell ){ + Ptg[] ptgs = _workbook.getFormulaTokens(srcCell); + int index = -1; + if( ptgs.length > 0 && ptgs[ptgs.length-1] instanceof FuncVarPtg){ + FuncVarPtg fVar = (FuncVarPtg)ptgs[ptgs.length-1]; + index = fVar.getFunctionIndex(); + } + return index; + } It is not always so. Consider two use cases: SUBTOTAL(9, A1:A2) ptgs: [9, A1:A2, SUBTOTAL] SUBTOTAL(9, A1:A2) + 1 ptgs: [9, A1:A2, SUBTOTAL, 1, '+'] Your implementation ignores the second case which is wrong. The correct logic is to iterate over all ptgs and check if there is a FuncVarPtg for the SUBTOTAL function. Regards, Yegor -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
