private static void createInputDirectory(FileSystem fs, 
                                           Path dir,
                                           Pentomino pent,
                                           int depth
                                           ) throws IOException {
    fs.mkdirs(dir);
    List<int[]> splits = pent.getSplits(depth);
    PrintStream file = 
      new PrintStream(new BufferedOutputStream
                      (fs.create(new Path(dir, "part1")), 64*1024));
    for(int[] prefix: splits) {
      for(int i=0; i < prefix.length; ++i) {
        if (i != 0) {
          file.print(',');          
        }
        file.print(prefix[i]);
      }
      file.print('\n');
    }
    file.close();
  }
private static void createInputDirectory ( FileSystem fs , Path dir , Pentomino pent , int depth ) throws IOException { fs . mkdirs ( dir ) ; List < int [ ] > splits = pent . getSplits ( depth ) ; PrintStream file = new PrintStream ( new BufferedOutputStream ( fs . create ( new Path ( dir , "part1" ) ) , 64 * 1024 ) ) ; for ( int [ ] prefix : splits ) { for ( int i = 0 ; i < prefix . length ; ++ i ) { if ( i != 0 ) { file . print ( ',' ) ; } file . print ( prefix [ i ] ) ; } file . print ( '\n' ) ; } file . close ( ) ; }
Create the input file with all of the possible combinations of the
given depth.
@param fs the filesystem to write into
@param dir the directory to write the input file into
@param pent the puzzle
@param depth the depth to explore when generating prefixes