Example #1
0
 public void getWords(String fileName) throws IOException {
   this.word = new ArrayList<String>();
   BufferedReader buf = new BufferedReader(new FileReader(fileName));
   while (buf.ready()) {
     this.word.add(buf.readLine());
   }
 }
Example #2
0
 public void initialize(int rows, int cols, String fileName) throws IOException {
   mat = new String[rows][cols];
   matrixWidth = cols;
   // deltaX = this.dx*(3+matrixWidth);
   BufferedReader buffer = new BufferedReader(new FileReader(fileName));
   String s;
   for (int i = 0; i < rows; i++) {
     s = buffer.readLine();
     for (int j = 0; j < cols; j++) {
       mat[i][j] = s.substring(j, j + 1);
       if (!H.containsKey(mat[i][j])) {
         H.put(mat[i][j], new ArrayList<Coordinate>());
       }
       H.get(mat[i][j]).add(new Coordinate(i, j));
     }
   }
 }