public double relativeFill ( ) { double acc = 0.0 ; final int cols = widths . size ( ) ; final int rows = heights . size ( ) ; { for ( int y = 0 ; y < rows ; y ++ ) { for ( int x = 0 ; x < cols ; x ++ ) { if ( usage . get ( y ) . get ( x ) != null ) { acc += widths . get ( x ) * heights . get ( y ) ; } } } } return acc / ( twidth * theight ) ; }
Compute the relative fill . Useful for triggering a relayout if the relative fill is not satisfactory .