void growCellArray ( int imageWidth , int imageHeight ) { cellCols = imageWidth / pixelsPerCell ; cellRows = imageHeight / pixelsPerCell ; if ( cellRows * cellCols > cells . length ) { Cell [ ] a = new Cell [ cellCols * cellRows ] ; System . arraycopy ( cells , 0 , a , 0 , cells . length ) ; for ( int i = cells . length ; i < a . length ; i ++ ) { a [ i ] = new Cell ( ) ; a [ i ] . histogram = new float [ orientationBins ] ; } cells = a ; } }
Determines if the cell array needs to grow . If it does a new array is declared . Old data is recycled when possible