Skip to content

Commit

Permalink
Merge pull request nus-cs2113-AY2223S2#52 from Zemdalk/fix-edit-index
Browse files Browse the repository at this point in the history
Resolve merge conflict in nus-cs2113-AY2223S2#51
  • Loading branch information
Zemdalk authored Mar 16, 2023
2 parents ad65ed5 + fdb10aa commit 526caa5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/seedu/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.Arrays;

// import javax.swing.plaf.basic.BasicTreeUI.SelectionModelPropertyChangeHandler;

public class Parser {

private static final int OFFSET = 1;
Expand Down Expand Up @@ -160,7 +158,6 @@ private static void parseEditCommand(String remainder, EventList eventList) thro
} else {
reviseTimeInfoUsingIndex(information, eventList);
}
Ui.editSuccessMsg(eventList.getDescription(eventIndex), eventList.getTime(eventIndex));
}
}
private static void addFormatChecker(String[] information) throws NPExceptions {
Expand All @@ -172,6 +169,7 @@ private static void addFormatChecker(String[] information) throws NPExceptions {
throw new NPExceptions("Please use correct command format!");
}
}

private static void reviseTimeInfoUsingIndex(String[] information, EventList eventList) throws NPExceptions{
int eventIndex = -1;
try{
Expand All @@ -190,12 +188,18 @@ private static void reviseTimeInfoUsingIndex(String[] information, EventList eve
} else {
eventList.reviseTimeInfo(eventIndex, information[1], information[2]);
}

Ui.editSuccessMsg(eventList.getDescription(eventIndex), eventList.getTime(eventIndex));
}

private static void reviseTimeInfoUsingName(String[] information, EventList eventList) throws NPExceptions{
if(!information[4].equals("")) {
eventList.reviseTimeInfo(information[0], information[1], information[2], information[3], information[4]);
} else {
eventList.reviseTimeInfo(information[0], information[1], information[2]);
}

int eventIndex = eventList.searchTaskIndex(information[0]);
Ui.editSuccessMsg(eventList.getDescription(eventIndex), eventList.getTime(eventIndex));
}
}

0 comments on commit 526caa5

Please sign in to comment.