forked from AY2324S1-CS2103T-T13-0/tp
-
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.
Merge pull request AY2324S1-CS2103T-T13-0#108 from marquestye/info-co…
…mmand Info command and checkstyle fixes
- Loading branch information
Showing
36 changed files
with
304 additions
and
192 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
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
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
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
70 changes: 70 additions & 0 deletions
70
src/main/java/seedu/address/logic/commands/InfoCommand.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,70 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.commons.util.ToStringBuilder; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.module.ModuleCode; | ||
|
||
/** | ||
* Displays information of a module identified using it's module code. | ||
*/ | ||
public class InfoCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "info"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Shows information on the module identified by the module code. " | ||
+ "Example: " + COMMAND_WORD + " " + "CS1101S "; | ||
public static final String MESSAGE_INFO_MODULE_SUCCESS = "%1$s: %2$s \n" | ||
+ "%3$s \n" | ||
+ "%4$s \n"; | ||
public static final String MESSAGE_INFO_MODULE_SUCCESS_SAMPLE = "CS1101S : Programming Methodology \n" | ||
+ "4MCs \n" | ||
+ "This course introduces the concepts of programming and computational problem solving. " | ||
+ "Starting from a small core of fundamental abstractions, the course introduces" | ||
+ " programming as a method for communicating computational processes. \n"; | ||
|
||
public static final String MESSAGE_NOT_FOUND_MODULE = "This module is not found."; | ||
|
||
private final ModuleCode moduleCode; | ||
|
||
/** | ||
* @param moduleCode of the module to be shown | ||
*/ | ||
public InfoCommand(ModuleCode moduleCode) { | ||
this.moduleCode = moduleCode; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
||
// TODO: Call a method in model to get the module information | ||
|
||
return new CommandResult(MESSAGE_INFO_MODULE_SUCCESS_SAMPLE); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == this) { | ||
return true; | ||
} | ||
|
||
// instanceof handles nulls | ||
if (!(other instanceof InfoCommand)) { | ||
return false; | ||
} | ||
|
||
InfoCommand otherInfoCommand = (InfoCommand) other; | ||
return moduleCode.equals(otherInfoCommand.moduleCode); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this) | ||
.add("moduleCode", moduleCode) | ||
.toString(); | ||
} | ||
} |
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
8 changes: 5 additions & 3 deletions
8
src/main/java/seedu/address/logic/parser/AddCommandParser.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
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.