Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenKangg committed Apr 7, 2024
1 parent 3d14f81 commit 8a51d8e
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/main/java/seedu/omnitravel/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.time.LocalDate;
import java.util.logging.Logger;

import static seedu.omnitravel.errorhandlers.CheckParameters.isNumeric;

public class Parser {

private static Logger logger = Logger.getLogger("ParserLogger");
Expand Down Expand Up @@ -81,7 +83,7 @@ public static void activityCommand(String line, TravelActivityList list) throws
System.out.println("I added a new accommodation");
break;
case "food":
activity = new Food(description, date, duration, tag, "");
activity = new Food(description, date, duration, tag, location, "");
System.out.println("I added a new food activity");
break;
case "landmark":
Expand Down Expand Up @@ -110,8 +112,8 @@ public static void activityCommand(String line, TravelActivityList list) throws
public static void addCommand(String line, TravelActivityList list) throws OmniException{
Ui.printLine();
String[] command = line.split("add | /date | /duration | /tag | /location");
logger.log(Level.INFO, command[0] + " // " + command[1]);
CheckParameters.addExceptions(command);
//logger.log(Level.INFO, command[0] + " // " + command[1]);
CheckParameters.addExceptions(command, "add", line);
String description = command[1].trim();
LocalDate date = LocalDate.parse(command[2]);
String duration = command[3].trim();
Expand Down Expand Up @@ -149,7 +151,7 @@ public static void addCommand(String line, TravelActivityList list) throws OmniE
* @throws OmniException if command.length != 2 && command[1] is not numeric
*/
public static void deleteCommand(String[] command, TravelActivityList list) throws OmniException {
if (command.length == 2 && CheckParameters.isNumeric(command[1])){
if (command.length == 2 && isNumeric(command[1])){
int listNumber = Integer.parseInt(command[1]);
list.removeTravelActivity(listNumber);
} else {
Expand All @@ -165,7 +167,7 @@ public static void deleteCommand(String[] command, TravelActivityList list) thro
* @throws OmniException if command.length != 2 && command[1] is not numeric
*/
public static void checkCommand(String[] command, TravelActivityList list) throws OmniException {
if (command.length == 2 && CheckParameters.isNumeric(command[1])){
if (command.length == 2 && isNumeric(command[1])){
int listNumber = Integer.parseInt(command[1]);
list.checkTravelActivity(listNumber);
} else {
Expand All @@ -181,7 +183,7 @@ public static void checkCommand(String[] command, TravelActivityList list) throw
* @throws OmniException if command.length != 2 && command[1] is not numeric
*/
public static void uncheckCommand(String[] command, TravelActivityList list) throws OmniException {
if (command.length == 2 && CheckParameters.isNumeric(command[1])){
if (command.length == 2 && isNumeric(command[1])){
int listNumber = Integer.parseInt(command[1]);

list.uncheckTravelActivity(listNumber);
Expand All @@ -200,7 +202,7 @@ public static void uncheckCommand(String[] command, TravelActivityList list) thr
*/
public static void tagCommand(String line, TravelActivityList list) throws OmniException {
String[] command = line.split(" ");
if (command.length >= 3 && CheckParameters.isNumeric(command[1])){
if (command.length >= 3 && isNumeric(command[1])){
String index = command[1];
String[] tagSplit = line.split(index);
String tag = tagSplit[1].trim();
Expand All @@ -221,7 +223,7 @@ public static void tagCommand(String line, TravelActivityList list) throws OmniE
* @throws OmniException if command.length != 2 && command[1] is not numeric
*/
public static void removeTagCommand(String[] command, TravelActivityList list) throws OmniException {
if (command.length == 2 && CheckParameters.isNumeric(command[1])) {
if (command.length == 2 && isNumeric(command[1])) {
int listNumber = Integer.parseInt(command[1]);
list.removeTag(listNumber);
} else {
Expand Down Expand Up @@ -306,7 +308,7 @@ public static void findCommand(String line, TravelActivityList list) throws Omni
*/
public static void expenseCommand(String line, TravelActivityList list) throws OmniException {
String[] command = line.split(" ");
if (command.length == 3 && CheckParameters.isNumeric(command[1])){
if (command.length == 3 && isNumeric(command[1])){
int listNumber = Integer.parseInt(command[1]);
String expense = command[2];
list.expenseActivity(listNumber, expense);
Expand All @@ -325,7 +327,7 @@ public static void expenseCommand(String line, TravelActivityList list) throws O
* @throws OmniException if command.length != 2 && command[1] is not numeric
*/
public static void removeExpenseCommand(String[] command, TravelActivityList list) throws OmniException {
if (command.length == 2 && CheckParameters.isNumeric(command[1])) {
if (command.length == 2 && isNumeric(command[1])) {
int listNumber = Integer.parseInt(command[1]);
list.removeExpense(listNumber);
} else {
Expand Down Expand Up @@ -410,7 +412,9 @@ public static void findLocationCommand(String line, TravelActivityList list) thr
} else {
list.findLocation(command[1].trim());
}
/**
}

/**
* Handles the case whereby the command is listtags
* @param command The command given by the user
* @param list The travel activity list
Expand Down

0 comments on commit 8a51d8e

Please sign in to comment.