question: private static int convertSpanToSparseGrid ( int curIx , int span , TreeSet < Integer > indexes ) { int lastIx = curIx + span ; int retSpan = 1 ; for ( Integer ix : indexes ) { if ( ix <= curIx ) continue ; if ( ix >= lastIx ) break ; retSpan ++ ; } return retSpan ; }
target:  Spanning is specified in the uncompressed grid number. They can for instance be more than 60000 for the outer edge dock grid cells. When the grid is compressed and indexed after only the cells that area occupied the span is erratic. This method use the row/col indexes and corrects the span to be correct for the compressed grid.