private static List < Block > createBlocks ( int [ ] data , boolean debug ) { List < Block > blocks = new ArrayList <> ( ) ; Block current = null ; for ( int i = 0 ; i < data . length ; i ++ ) { EncodingMode mode = chooseMode ( data [ i ] ) ; if ( ( current != null && current . mode == mode ) && ( mode != EncodingMode . NUM || current . length < MAX_NUMERIC_COMPACTION_BLOCK_SIZE ) ) { current . length ++ ; } else { current = new Block ( mode ) ; blocks . add ( current ) ; } } if ( debug ) { System . out . println ( "Initial block pattern: " + blocks ) ; } smoothBlocks ( blocks ) ; if ( debug ) { System . out . println ( "Final block pattern: " + blocks ) ; } return blocks ; }
Determines the encoding block groups for the specified data .