Merge pull request #472 from FoxAhead/optimization

Optimization
This commit is contained in:
Ivan 2017-01-24 10:14:48 -06:00 committed by GitHub
commit d1169189e9

View File

@ -1362,6 +1362,9 @@ ENDMETHOD.</source>
lv_module TYPE int4,
lv_column TYPE zexcel_cell_column.
STATICS: sv_prev_in LIKE lv_column,
sv_prev_out LIKE ep_column.
* Propagate zcx_excel if error occurs &quot; issue #155 - less restrictive typing for ip_column
lv_column = convert_column2int( ip_column ). &quot; issue #155 - less restrictive typing for ip_column
@ -1375,6 +1378,17 @@ ENDMETHOD.</source>
error = &apos;Index out of bounds&apos;.
ENDIF.
*--------------------------------------------------------------------*
* Look up for previous succesfull cached result
*--------------------------------------------------------------------*
IF lv_column = sv_prev_in AND sv_prev_out IS NOT INITIAL.
ep_column = sv_prev_out.
RETURN.
ELSE.
CLEAR sv_prev_out.
sv_prev_in = lv_column.
ENDIF.
*--------------------------------------------------------------------*
* Build alpha representation of column
*--------------------------------------------------------------------*
@ -1390,6 +1404,11 @@ ENDMETHOD.</source>
ENDWHILE.
*--------------------------------------------------------------------*
* Save succesfull output into cache
*--------------------------------------------------------------------*
sv_prev_out = ep_column.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZCL_EXCEL_COMMON" CMPNAME="CONVERT_COLUMN2INT" VERSION="1" LANGU="E" DESCRIPT="Convert column indicator to Integer" EXPOSURE="2" STATE="1" EDITORDER="4 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="1" MTDNEWEXC="X" BCMTDCAT="00" BCMTDSYN="0">
@ -1423,6 +1442,8 @@ ENDMETHOD.</source>
lv_errormessage TYPE string, &quot; Can&apos;t pass &apos;...&apos;(abc) to exception-class
lv_modulo TYPE i.
STATICS: sv_prev_in LIKE lv_column_c,
sv_prev_out LIKE ep_column.
*--------------------------------------------------------------------*
* This module tries to identify which column a user wants to access
* Numbers as input are just passed back, anything else will be converted
@ -1447,6 +1468,17 @@ ENDMETHOD.</source>
syst_at_raise = syst.
ENDIF.
*--------------------------------------------------------------------*
* Look up for previous succesfull cached result
*--------------------------------------------------------------------*
IF lv_column_c = sv_prev_in AND sv_prev_out IS NOT INITIAL.
ep_column = sv_prev_out.
RETURN.
ELSE.
CLEAR sv_prev_out.
sv_prev_in = lv_column_c.
ENDIF.
*--------------------------------------------------------------------*
* If a number gets passed, just convert it to an integer and return
* the converted value
@ -1484,6 +1516,7 @@ ENDMETHOD.</source>
syst_at_raise = syst.
ENDIF.
DO 1 TIMES. &quot;Because of using CHECK
*--------------------------------------------------------------------*
* Interpret input as number to base 26 with A=1, ... Z=26
* Raise error if unexpected character turns up
@ -1537,6 +1570,7 @@ ENDMETHOD.</source>
syst_at_raise = syst.
ENDIF.
ep_column = 26 * ep_column + lv_modulo. &quot; if third digit is present first digit is for 26^2 and second digit for 26^1
ENDDO.
*--------------------------------------------------------------------*
* Maximum column for EXCEL: XFD = 16384 &quot; if anyone has a reference for this information - please add here instead of this comment
@ -1548,6 +1582,10 @@ ENDMETHOD.</source>
error = lv_errormessage.
ENDIF.
*--------------------------------------------------------------------*
* Save succesfull output into cache
*--------------------------------------------------------------------*
sv_prev_out = ep_column.
ENDMETHOD.</source>
</method>