forked from se-edu/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/V0.4' into enhanced-search
# Conflicts: # src/main/java/seedu/manager/model/Model.java # src/main/java/seedu/manager/model/ModelManager.java # src/test/java/seedu/manager/logic/LogicManagerTest.java
- Loading branch information
Showing
11 changed files
with
283 additions
and
25 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package seedu.manager.commons.core; | ||
|
||
public class CommandWord { | ||
|
||
public enum Commands { | ||
ADD("add"), EDIT("edit"), DELETE("delete"), UNDO("undo"), | ||
FIND("find"), STORAGE("storage"), CLEAR("clear"), DONE("done"), | ||
EXIT("exit"), HELP("help"), LIST("list"), SORT("sort"), ALIAS("alias"); | ||
|
||
private String commandRep; | ||
|
||
private Commands(String commandRep) { | ||
this.commandRep = commandRep; | ||
} | ||
|
||
public String toString() { | ||
return commandRep; | ||
} | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/seedu/manager/commons/events/storage/UserPrefsChangedEvent.java
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,19 @@ | ||
package seedu.manager.commons.events.storage; | ||
|
||
import seedu.manager.commons.events.BaseEvent; | ||
import seedu.manager.model.UserPrefs; | ||
|
||
public class UserPrefsChangedEvent extends BaseEvent { | ||
|
||
public UserPrefs userPrefs; | ||
|
||
public UserPrefsChangedEvent(UserPrefs userPrefs) { | ||
this.userPrefs = userPrefs; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "User Preferences have changed"; | ||
} | ||
|
||
} |
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
30 changes: 30 additions & 0 deletions
30
src/main/java/seedu/manager/logic/commands/AliasCommand.java
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,30 @@ | ||
package seedu.manager.logic.commands; | ||
|
||
import seedu.manager.commons.exceptions.IllegalValueException; | ||
|
||
public class AliasCommand extends Command { | ||
|
||
public static final String MESSAGE_SUCCESS = "Old command %1$s changed to %2$s"; | ||
public static final String MESSAGE_WRONG_NUM_ARGS = "Alias command should have exactly 2 parameters"; | ||
public static final String MESSAGE_NO_MATCH = "I cannot recognise the command you want to alias"; | ||
public static final String MESSAGE_ALIAS_TAKEN = "This alias is already taken by the %1$s command"; | ||
|
||
private final String oldCommand; | ||
private final String alias; | ||
|
||
public AliasCommand(String oldCommand, String alias) { | ||
this.oldCommand = oldCommand; | ||
this.alias = alias; | ||
} | ||
|
||
@Override | ||
public CommandResult execute() { | ||
try { | ||
model.setSingleCommandWord(oldCommand, alias, MESSAGE_NO_MATCH, MESSAGE_ALIAS_TAKEN); | ||
|
||
return new CommandResult(String.format(MESSAGE_SUCCESS, oldCommand, alias)); | ||
} catch (IllegalValueException e) { | ||
return new CommandResult(e.getMessage()); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.