Skip to content

Commit

Permalink
Fix minor issues to align with coding standards and improve coding qu…
Browse files Browse the repository at this point in the history
…ality
  • Loading branch information
RiyaMehta2211 committed Sep 22, 2023
1 parent 94c43a3 commit 516539c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class Parser {
* Default constructor to initialize the Parser class.
*/
public Parser() {
//empty constructor to initialize class objects
}
static String temp = "";
private static void updateTask(String str, TaskList tasks) throws InvalidInputException, EmptyInputException, TaskTypeMismatchException {
Expand Down Expand Up @@ -180,10 +179,7 @@ else if (str.equals("list")) {
*/
private static void addToDo(String str, TaskList tasks) throws ToDoCommandUseException {
String todo = str.substring(4);
//remove any leading and trailing whitespace characters and
//check whether there is a task after the instruction
if (todo.trim().isEmpty()) {
//this would mean the instruction is incomplete
throw new ToDoCommandUseException(str);
}
String string = str.substring(5);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void addTask(Task task){
* @param index The index of the task to be removed.
* @return The removed task.
*/
public Task removeTask(int index){
public Task removeTask(int index) {
assert index < this.tasks.size() && index >= 0;
return this.tasks.remove(index);
}
Expand All @@ -42,7 +42,7 @@ public Task removeTask(int index){
* @param index The index of the task to be retrieved.
* @return The retrieved task.
*/
public Task getTask(int index){
public Task getTask(int index) {
assert index < this.tasks.size() && index >= 0;
return this.tasks.get(index);
}
Expand Down

0 comments on commit 516539c

Please sign in to comment.