forked from nus-cs2103-AY2021S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
281 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ test { | |
} | ||
|
||
application { | ||
mainClassName = "seedu.duke.Duke" | ||
mainClassName = "Duke" | ||
} | ||
|
||
shadowJar { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import java.io.IOException; | ||
|
||
public class AddFriendCommand extends Command{ | ||
|
||
private Friend friend; | ||
|
||
/** | ||
* Constructor for the class. | ||
* @param friend | ||
*/ | ||
public AddFriendCommand(Friend friend) { | ||
this.friend = friend; | ||
} | ||
|
||
/** | ||
* Generate a list of tasks to user. | ||
* @param friends | ||
* @param ui | ||
* @param storage | ||
* @return a String to reply user. | ||
* @throws IOException | ||
*/ | ||
public String execute(FriendList friends, Ui ui, Storage storage) throws IOException { | ||
friends.add(friend); | ||
return ui.addFriend(this.friend); | ||
} | ||
|
||
/** | ||
* Empty execution. | ||
* @param tasks | ||
* @param ui | ||
* @param storage | ||
* @return null value as there is no tasks | ||
* @throws IOException | ||
*/ | ||
@Override | ||
public String execute(TaskList tasks, Ui ui, Storage storage) throws IOException { | ||
return null; | ||
} | ||
|
||
/** | ||
* To check if the command is an exit command | ||
* @return a false | ||
*/ | ||
public boolean isExit() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import java.io.IOException; | ||
|
||
public class DeleteFriendCommand extends Command { | ||
|
||
private int i; | ||
|
||
/** | ||
* Constructor for the class. | ||
* @param i | ||
*/ | ||
public DeleteFriendCommand(int i) { | ||
this.i = i; | ||
} | ||
|
||
/** | ||
* Generate a list of tasks to user. | ||
* @param friends | ||
* @param ui | ||
* @param storage | ||
* @return a String to reply user. | ||
* @throws IOException | ||
*/ | ||
public String execute(FriendList friends, Ui ui, Storage storage) throws IOException { | ||
Friend deletedFriend = friends.getList().get(this.i - 1); | ||
friends.delete(this.i - 1); | ||
return ui.deleteFriend(deletedFriend); | ||
} | ||
|
||
/** | ||
* Empty execution. | ||
* @param tasks | ||
* @param ui | ||
* @param storage | ||
* @return null value as there is no tasks | ||
* @throws IOException | ||
*/ | ||
@Override | ||
public String execute(TaskList tasks, Ui ui, Storage storage) throws IOException { | ||
return null; | ||
} | ||
|
||
/** | ||
* To check if the command is an exit command | ||
* @return a false | ||
*/ | ||
public boolean isExit() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class EmptyInputException extends Exception { | ||
|
||
public EmptyInputException(String e) { | ||
super("☹ OOPS!!! The description of a " + e + " cannot be empty."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import java.io.IOException; | ||
|
||
public class FriendListCommand extends Command { | ||
|
||
/** | ||
* Generate a list of tasks to user. | ||
* @param friends | ||
* @param ui | ||
* @param storage | ||
* @return a String to reply user. | ||
* @throws IOException | ||
*/ | ||
public String execute(FriendList friends, Ui ui, Storage storage) throws IOException { | ||
return ui.generateFriendList(friends); | ||
} | ||
|
||
/** | ||
* Empty execution. | ||
* @param tasks | ||
* @param ui | ||
* @param storage | ||
* @return null value as there is no tasks | ||
* @throws IOException | ||
*/ | ||
@Override | ||
public String execute(TaskList tasks, Ui ui, Storage storage) throws IOException { | ||
return null; | ||
} | ||
|
||
/** | ||
* To check if the command is an exit command | ||
* @return a false | ||
*/ | ||
public boolean isExit() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
public class IncorrectInputException extends Exception { | ||
public class IncorrectInputException extends Throwable { | ||
|
||
public IncorrectInputException(String e) { | ||
super(e); | ||
public IncorrectInputException(String s) { | ||
super(s); | ||
} | ||
} |
Oops, something went wrong.