private static String combinatorialPatternMaker ( String [ ] str , int str_size , int c ) { String comb_pattern = "" ; int curr_comb = 1 ; for ( int i = 0 ; i < str_size ; i ++ ) { if ( ( c & curr_comb ) != 0 ) { comb_pattern += str [ i ] + "\\s" ; } else { comb_pattern += "[\\w]+\\s" ; } curr_comb = curr_comb << 1 ; } //System.err.println(comb_pattern); return comb_pattern ; }
Makes patterns by replacing words in str with wildcards based on the binary value of c .