Skip to content
Snippets Groups Projects
Commit a72342c1 authored by Tomas Beranek's avatar Tomas Beranek
Browse files

docs: docs written for new method

parent 4a613ada
No related branches found
No related tags found
2 merge requests!5Merging simulation branch with main branch,!4Merging Main branch with Simulation branch
package edu.ntnu.idatt2001.Wargames.battlesimulation.battle;
import edu.ntnu.idatt2001.Wargames.battlesimulation.controllers.SimulationSingleton;
import edu.ntnu.idatt2001.Wargames.battlesimulation.maintnance.PopupBoxes;
import edu.ntnu.idatt2001.Wargames.battlesimulation.specificunits.Unit;
import javafx.stage.FileChooser;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
......@@ -13,7 +11,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -120,6 +117,7 @@ public class ArmyFiles {
/**
* method used for checking for illegal characters which can corrupt a file
*
* @param lines a line from the file
* @return true if the line doesn't consist of illegal characters
* @throws IllegalArgumentException if an illegal character is found
......@@ -142,9 +140,8 @@ public class ArmyFiles {
* checks if string consist of numbers
*
* @param lines string to be checked
* @return true or false depending on outcome
*/
public boolean checkInputForIntegers(String lines) {
public void checkInputForIntegers(String lines) {
String chekIfInt = "[0-9]+";
Pattern pt = Pattern.compile(chekIfInt);
Matcher mt = pt.matcher(lines);
......@@ -152,6 +149,5 @@ public class ArmyFiles {
if (!mt.matches()) {
throw new IllegalArgumentException("Health value in file is a String, not a Integer");
}
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment