Skip to content

Commit

Permalink
Merge branch 'master' into remove-unused-codes
Browse files Browse the repository at this point in the history
  • Loading branch information
IanTeo committed Nov 5, 2016
2 parents 466ad85 + 5f92643 commit d345089
Show file tree
Hide file tree
Showing 28 changed files with 159 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class ViewTypeChangedEvent extends BaseEvent {

public final ViewCommand.ViewType viewType;
LocalDate date;
private LocalDate date;

public ViewTypeChangedEvent(ViewCommand.ViewType viewType, LocalDate date) {
this.viewType = viewType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Indicates that storage path location has changed
*/
public class PathLocationChangedEvent extends BaseEvent{
String pathLocation;
private String pathLocation;

public PathLocationChangedEvent(String pathLocation) {
this.pathLocation = pathLocation;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/taskitty/commons/util/TaskUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class TaskUtil {
*/
public static int getCategoryIndex(char category) {

category = Character.toLowerCase(category);
switch (category) {
char lowerCaseCategory = Character.toLowerCase(category);
switch (lowerCaseCategory) {

case (Task.TODO_CATEGORY_CHAR):
return Task.TODO_CATEGORY_INDEX;
Expand Down
24 changes: 18 additions & 6 deletions src/main/java/seedu/taskitty/logic/ToolTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class ToolTip {

public static final String TOOLTIP_DELIMITER = " | ";

private static final int COMMAND_WORD_POSITION = 0;
private static final String COMMAND_WORD_DELIMITER = " ";

Expand Down Expand Up @@ -47,8 +48,7 @@ public static ToolTip getInstance() {
/**
* Get the tooltip based on input
*
* @param input
* to determine the tooltip to be shown
* @param input to determine the tooltip to be shown
*/
public void createToolTip(String input) {
clearToolTip();
Expand Down Expand Up @@ -86,8 +86,7 @@ private boolean isSingleMatchFound() {
/**
* Finds the closest matching command and returns the appropriate tooltip
*
* @param command
* to determine which command tooltip to show
* @param command to determine which command tooltip to show
*/
private void getToolTipForCommand(String command) {
for (int i = 0; i < Command.ALL_COMMAND_WORDS.length; i++) {
Expand All @@ -100,8 +99,8 @@ private void getToolTipForCommand(String command) {
}

/**
* Returns a string representing the matched input, delimitered by
* TOOLTIP_DELIMITER
* Returns a string representing the matched input,
* delimitered by TOOLTIP_DELIMITER
*/
private void getToolTipForAllCommands() {
assert commands.size() != COMMAND_WORD_COUNT_NO_MATCH && commands.size() != COMMAND_WORD_COUNT_SINGLE_MATCH;
Expand Down Expand Up @@ -131,6 +130,19 @@ public String getMessage() {
public String getDecription() {
return description;
}

public boolean isUserInputValid() {
return !isMessageUnknownOrEmpty();
}

/**
* Returns true if the message of tooltip is null, empty or MESSAGE_UNKNOWN_COMMAND
*/
private boolean isMessageUnknownOrEmpty() {
return this.message == null
|| this.message.isEmpty()
|| this.message.equals(MESSAGE_UNKNOWN_COMMAND);
}

/**
* Sets the tooltip and description to the given parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class AddCommand extends Command {
+ " [name] [start] to [end] [#tag]...";
public static final String MESSAGE_USAGE = "This command adds a task to TasKitty, Meow!";

public static final String MESSAGE_SUCCESS = "New task added: %1$s";
public static final String MESSAGE_SUCCESS = "New task added:\n%1$s";
public static final String MESSAGE_DUPLICATE_TASK = "This task already exists in the task manager";

private final Task toAdd;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/taskitty/logic/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ public abstract class Command {
public static final String[] ALL_COMMAND_WORDS = { AddCommand.COMMAND_WORD, ViewCommand.COMMAND_WORD,
FindCommand.COMMAND_WORD, EditCommand.COMMAND_WORD, DeleteCommand.COMMAND_WORD, DoneCommand.COMMAND_WORD,
PathCommand.COMMAND_WORD, UndoCommand.COMMAND_WORD, ClearCommand.COMMAND_WORD, RedoCommand.COMMAND_WORD,
HelpCommand.COMMAND_WORD, ExitCommand.COMMAND_WORD, };
HelpCommand.COMMAND_WORD, ExitCommand.COMMAND_WORD };

public static final String[] ALL_COMMAND_MESSAGE_PARAMETER = { AddCommand.MESSAGE_PARAMETER,
ViewCommand.MESSAGE_PARAMETER, FindCommand.MESSAGE_PARAMETER, EditCommand.MESSAGE_PARAMETER,
DeleteCommand.MESSAGE_PARAMETER, DoneCommand.MESSAGE_PARAMETER, PathCommand.MESSAGE_PARAMETER,
UndoCommand.MESSAGE_PARAMETER, ClearCommand.MESSAGE_PARAMETER, RedoCommand.MESSAGE_PARAMETER,
HelpCommand.MESSAGE_PARAMETER, ExitCommand.MESSAGE_PARAMETER, };
HelpCommand.MESSAGE_PARAMETER, ExitCommand.MESSAGE_PARAMETER };

public static final String[] ALL_COMMAND_MESSAGE_USAGE = { AddCommand.MESSAGE_USAGE, ViewCommand.MESSAGE_USAGE,
FindCommand.MESSAGE_USAGE, EditCommand.MESSAGE_USAGE, DeleteCommand.MESSAGE_USAGE,
DoneCommand.MESSAGE_USAGE, PathCommand.MESSAGE_USAGE, UndoCommand.MESSAGE_USAGE, ClearCommand.MESSAGE_USAGE,
RedoCommand.MESSAGE_USAGE, HelpCommand.MESSAGE_USAGE, ExitCommand.MESSAGE_USAGE, };
RedoCommand.MESSAGE_USAGE, HelpCommand.MESSAGE_USAGE, ExitCommand.MESSAGE_USAGE };

public static final String MESSAGE_FORMAT = "Format: ";

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/seedu/taskitty/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public class FindCommand extends Command {

public static final String MESSAGE_PARAMETER = COMMAND_WORD
+ " [keyword] [more keywords]...";
public static final String MESSAGE_USAGE = "This command helps you find a task from TasKitty, Meow!";
public static final String MESSAGE_USAGE =
"This command helps you find a task from TasKitty, Meow!"
+ "\nUse # to find tags!";

private final Set<String> keywords;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/seedu/taskitty/logic/commands/PathCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class PathCommand extends Command {
public static final String MESSAGE_INVALID_FILEPATH = "Filepath is invalid. \n%1$s";
public static final String MESSAGE_INVALID_MISSING_FILEPATH = "Filepath is invalid. \n%1$s";

Config config = MainApp.getConfig();
Storage storage = MainApp.getStorage();
Model model = MainApp.getModel();
String configFile = Config.DEFAULT_CONFIG_FILE;
private Config config = MainApp.getConfig();
private Storage storage = MainApp.getStorage();
private Model model = MainApp.getModel();
private String configFile = Config.DEFAULT_CONFIG_FILE;

public final String filepath;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/taskitty/logic/commands/ViewCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class ViewCommand extends Command {

public static final String COMMAND_WORD = "view";

public static final String MESSAGE_PARAMETER = COMMAND_WORD + " [DATE/done/all]";
public static final String MESSAGE_USAGE = "This command shows upcoming tasks, Meow!\n"
+ " Use \"view [DATE]\" for dated tasks, \"view done\" for done tasks, \"view all\" for all tasks!";
public static final String MESSAGE_PARAMETER = COMMAND_WORD + " all | done | [date]";
public static final String MESSAGE_USAGE = "This command shows upcoming tasks, Meow!"
+ "\nUse \"view [DATE]\" for dated tasks, \"view done\" for done tasks, \"view all\" for all tasks!";
public static final String VIEW_ALL_MESSAGE_SUCCESS = "All tasks are listed, Meow!";
private LocalDate date;

Expand Down

0 comments on commit d345089

Please sign in to comment.