public void calc ( ) { if ( null != functionOccurences ) { Iterator iterator = functionOccurences . iterator ( ) ; while ( iterator . hasNext ( ) ) { int [ ] position = ( int [ ] ) iterator . next ( ) ; String functionString = ( ( String ) getXY ( position [ 0 ] , position [ 1 ] ) ) . trim ( ) ; // better use RegEx String name = functionString . substring ( 1 , functionString . indexOf ( "(" ) ) . trim ( ) . toLowerCase ( ) ; String range = functionString . substring ( functionString . indexOf ( "(" ) + 1 , functionString . indexOf ( ")" ) ) ; int colon = range . indexOf ( ":" ) ; String start = range . substring ( 0 , colon ) . trim ( ) ; String end = range . substring ( colon + 1 ) . trim ( ) ; int startX = start . charAt ( 0 ) - ' ' ; int startY = Integer . parseInt ( start . substring ( 1 ) ) - 1 ; int endX = end . charAt ( 0 ) - ' ' ; int endY = Integer . parseInt ( end . substring ( 1 ) ) - 1 ; // normalize range, start is left top, end is bottom right if ( startX > endX ) { int tmp = startX ; startX = endX ; endX = tmp ; } if ( startY > endY ) { int tmp = startY ; startY = endY ; endY = tmp ; } //Logger.debug("Calc: " + position[0] + " " + position[1] + " " + function + " " + start + " " + end); //Logger.debug("Calc: " + startX+","+startY+" - "+endX+","+endY); if ( functions . containsKey ( name ) ) { Function function = ( Function ) functions . get ( name ) ; function . execute ( this , position [ 0 ] , position [ 1 ] , startX , startY , endX , endY ) ; } } } return ; }
Recalculate all cells . Currently does nothing .