Skip to content
Snippets Groups Projects
Commit 52fc3b33 authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

Added new method for identifying new Budgets

parent 64aad8b7
No related branches found
No related tags found
1 merge request!43Merging frontend-testing into master
......@@ -34,7 +34,7 @@ public class FileHandlingBudget {
}
/**
* Method for checking if a .register file is empty.
* Method for checking if a .budget file is empty.
*
* @param fileTitle the name of the file you want to check
* @return true or false depending on if file is empty.
......@@ -46,6 +46,27 @@ public class FileHandlingBudget {
}
}
/**
* Method for checking if a .budget file is new (no categories)
* or old (has budget categories)
* @param fileTitle The name of the file
* @return True, if the budget is new. Else, returns false
* @throws IOException
*/
public boolean isNewBudget(String fileTitle) throws IOException {
try (BufferedReader br = new BufferedReader(
new FileReader(filePath + fileTitle + fileType))) {
for (int i = 0; i < 3; ++i)
br.readLine();
if (br.readLine() == null) {
return true;
}
}
return false;
}
/**
* Method for reading (getting) a Budget from a file.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment