1.1 --- a/src/main/java/de/uapcore/sudoku/DocumentHandler.java Sat Jul 25 14:01:28 2020 +0200 1.2 +++ b/src/main/java/de/uapcore/sudoku/DocumentHandler.java Sat Jul 25 15:29:51 2020 +0200 1.3 @@ -32,12 +32,18 @@ 1.4 1.5 /** 1.6 * 1.7 - * @author mike 1.8 */ 1.9 public class DocumentHandler { 1.10 1.11 private String filename; 1.12 - 1.13 + 1.14 + /** 1.15 + * Loads data into the specified field. 1.16 + * 1.17 + * @param field the field to populated with the loaded data 1.18 + * @throws IOException if loading fails or no file name has been set before 1.19 + * @see #setFilename(String) 1.20 + */ 1.21 public void load(Field field) throws IOException { 1.22 if (!isFilenameSet()) { 1.23 throw new IOException("no filename supplied"); 1.24 @@ -72,7 +78,14 @@ 1.25 } 1.26 field.setAllCellsModified(false); 1.27 } 1.28 - 1.29 + 1.30 + /** 1.31 + * Saves the specified field to a file. 1.32 + * 1.33 + * @param field the field to save 1.34 + * @throws IOException if saving fails or the file name has not been set before 1.35 + * @see #setFilename(String) 1.36 + */ 1.37 public void save(Field field) throws IOException { 1.38 if (!isFilenameSet()) { 1.39 throw new IOException("no filename supplied"); 1.40 @@ -89,15 +102,28 @@ 1.41 } 1.42 } 1.43 } 1.44 - 1.45 + 1.46 + /** 1.47 + * Sets the file name for loading and saving data. 1.48 + * 1.49 + * @param filename the file name 1.50 + */ 1.51 public void setFilename(String filename) { 1.52 this.filename = filename; 1.53 } 1.54 - 1.55 + 1.56 + /** 1.57 + * Clears the file name. 1.58 + */ 1.59 public void clearFilename() { 1.60 filename = null; 1.61 } 1.62 - 1.63 + 1.64 + /** 1.65 + * Checks whether a file name has been set. 1.66 + * 1.67 + * @return true if a file name is known, false otherwise 1.68 + */ 1.69 public boolean isFilenameSet() { 1.70 return filename != null; 1.71 }