Skip to content

Commit

Permalink
Merge pull request #112 from bryanwongweiheng/master
Browse files Browse the repository at this point in the history
Change XML file from the original person data to calendar event data, Fix SelectCommandSystemTest
  • Loading branch information
vig42 authored Nov 7, 2018
2 parents 2617d9e + 16dc654 commit e0895fd
Show file tree
Hide file tree
Showing 121 changed files with 957 additions and 885 deletions.
16 changes: 8 additions & 8 deletions src/main/java/seedu/address/AppParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ public class AppParameters {

private Path configPath;

public Path getConfigPath() {
return configPath;
}

public void setConfigPath(Path configPath) {
this.configPath = configPath;
}

/**
* Parses the application command-line parameters.
*/
Expand All @@ -43,6 +35,14 @@ public static AppParameters parse(Application.Parameters parameters) {
return appParameters;
}

public Path getConfigPath() {
return configPath;
}

public void setConfigPath(Path configPath) {
this.configPath = configPath;
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ public class MainApp extends Application {
protected Config config;
protected UserPrefs userPrefs;

public static void main(String[] args) {
launch(args);
}

@Override
public void init() throws Exception {
logger.info("=============================[ Initializing U-Schedule ]===========================");
logger.info("=============================[ Initializing U-Schedule ]=============================");
super.init();

AppParameters appParameters = AppParameters.parse(getParameters());
Expand Down Expand Up @@ -236,8 +239,4 @@ public void handleExitAppRequestEvent(ExitAppRequestEvent event) {
logger.info(LogsCenter.getEventHandlingLogMessage(event));
stop();
}

public static void main(String[] args) {
launch(args);
}
}
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/commons/core/LogsCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class LogsCenter {
private static final int MAX_FILE_SIZE_IN_BYTES = (int) (Math.pow(2, 20) * 5); // 5MB
private static final String LOG_FILE = "scheduler.log";
private static Level currentLogLevel = Level.INFO;
private static final Logger logger = LogsCenter.getLogger(LogsCenter.class);
private static FileHandler fileHandler;
private static ConsoleHandler consoleHandler;
private static final Logger logger = LogsCenter.getLogger(LogsCenter.class);

/**
* Initializes with a custom log level (specified in the {@code config} object)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/commons/core/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Messages {
public static final String MESSAGE_INVALID_CALENDAR_EVENTS_DISPLAYED_INDEX = "The calendar event index provided "
+ "is invalid";
public static final String MESSAGE_INVALID_TODOLIST_EVENTS_DISPLAYED_INDEX =
"The todo item index provided is invalid";
"The todo item index provided is invalid";
public static final String MESSAGE_CALENDAR_EVENTS_LISTED_OVERVIEW = "%1$d calendar events listed!";

}
32 changes: 16 additions & 16 deletions src/main/java/seedu/address/commons/core/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,6 @@ public Version(int major, int minor, int patch, boolean isEarlyAccess) {
this.isEarlyAccess = isEarlyAccess;
}

public int getMajor() {
return major;
}

public int getMinor() {
return minor;
}

public int getPatch() {
return patch;
}

public boolean isEarlyAccess() {
return isEarlyAccess;
}

/**
* Parses a version number string in the format V1.2.3.
*
Expand All @@ -65,6 +49,22 @@ public static Version fromString(String versionString) throws IllegalArgumentExc
versionMatcher.group(4) == null ? false : true);
}

public int getMajor() {
return major;
}

public int getMinor() {
return minor;
}

public int getPatch() {
return patch;
}

public boolean isEarlyAccess() {
return isEarlyAccess;
}

@JsonValue
public String toString() {
return String.format("V%d.%d.%d%s", major, minor, patch, isEarlyAccess ? "ea" : "");
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/seedu/address/commons/core/index/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ private Index(int zeroBasedIndex) {
this.zeroBasedIndex = zeroBasedIndex;
}

public int getZeroBased() {
return zeroBasedIndex;
}

public int getOneBased() {
return zeroBasedIndex + 1;
}

/**
* Creates a new {@code Index} using a zero-based index.
*/
Expand All @@ -45,6 +37,14 @@ public static Index fromOneBased(int oneBasedIndex) {
return new Index(oneBasedIndex - 1);
}

public int getZeroBased() {
return zeroBasedIndex;
}

public int getOneBased() {
return zeroBasedIndex + 1;
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/seedu/address/commons/events/ui/SwitchTabEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package seedu.address.commons.events.ui;

import seedu.address.commons.events.BaseEvent;

/**
* An event requesting to switch to the To Do List tab
*/
public class SwitchTabEvent extends BaseEvent {

@Override
public String toString() {
return getClass().getSimpleName();
}

}
16 changes: 8 additions & 8 deletions src/main/java/seedu/address/commons/util/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static boolean isNonZeroUnsignedInteger(String s) {
* Checks if {@code collection} of strings contains {@code string}
*
* @param collection collection to be checked
* @param string that is being searched for
* @param string that is being searched for
* @return whether words are similar within the tolerance
*/
public static boolean containsIgnoreCase(Collection<String> collection, String string) {
Expand All @@ -98,8 +98,8 @@ public static boolean containsIgnoreCase(Collection<String> collection, String s
* Checks if {@code sentence} contains {@code word}, or words similar to {@code word}
*
* @param tolerance higher tolerance means only very similar words will match, value between 0 to 100
* @param sentence sentence to be checked
* @param word that is being searched for, does not need to be single word
* @param sentence sentence to be checked
* @param word that is being searched for, does not need to be single word
* @return whether words are similar within the tolerance
*/
public static boolean containsWordFuzzy(String sentence, String word, int tolerance) {
Expand All @@ -113,7 +113,7 @@ public static boolean containsWordFuzzy(String sentence, String word, int tolera
String preppedSentence = sentence.toLowerCase();

return partialRatioTest(preppedSentence, preppedWord, tolerance)
|| tokenSetRatioTest(sentence, word, tolerance);
|| tokenSetRatioTest(sentence, word, tolerance);
}

/**
Expand All @@ -122,7 +122,7 @@ public static boolean containsWordFuzzy(String sentence, String word, int tolera
* Closer match would return a higher integer
*
* @param sentence sentence to be checked
* @param word that is being searched for, does not need to be single word
* @param word that is being searched for, does not need to be single word
* @return int between 0 and 100
*/
public static int fuzzyMatchScore(String sentence, String word) {
Expand All @@ -136,16 +136,16 @@ public static int fuzzyMatchScore(String sentence, String word) {
String preppedSentence = sentence.toLowerCase();

int score = Integer.max(computePartialRatio(preppedSentence, preppedWord),
computeTokenSetRatio(preppedSentence, preppedWord));
computeTokenSetRatio(preppedSentence, preppedWord));

return score;
}

/**
* Tests 2 strings if they are similar within the specified tolerance
* Uses partial ratio test to check similarity
* @param tolerance strings of higher similarity will return True
*
* @param tolerance strings of higher similarity will return True
* @return boolean of whether the strings are similar enough
*/
private static boolean partialRatioTest(String s1, String s2, int tolerance) {
Expand All @@ -155,8 +155,8 @@ private static boolean partialRatioTest(String s1, String s2, int tolerance) {
/**
* Tests 2 strings if they are similar within the specified tolerance
* Uses token set ratio test to check similarity
* @param tolerance strings of higher similarity will return True
*
* @param tolerance strings of higher similarity will return True
* @return boolean of whether the strings are similar enough
*/
private static boolean tokenSetRatioTest(String s1, String s2, int tolerance) {
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/seedu/address/logic/commands/AddToDoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public class AddToDoCommand extends Command {
public static final String COMMAND_WORD = "add todo";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a event to the todo list. "
+ "Parameters: "
+ PREFIX_TITLE + "TITLE "
+ PREFIX_DESCRIPTION + "DESCRIPTION "
+ PREFIX_PRIORITY + "PRIORITY "
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_TITLE + "CS2103 Final Exam "
+ PREFIX_DESCRIPTION + "Bring calculator "
+ PREFIX_PRIORITY + "H ";
+ "Parameters: "
+ PREFIX_TITLE + "TITLE "
+ PREFIX_DESCRIPTION + "DESCRIPTION "
+ PREFIX_PRIORITY + "PRIORITY "
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_TITLE + "CS2103 Final Exam "
+ PREFIX_DESCRIPTION + "Bring calculator "
+ PREFIX_PRIORITY + "H ";

public static final String MESSAGE_SUCCESS = "New todo event added: %1$s";
public static final String MESSAGE_DUPLICATE_TODO_EVENT = "This todo event already exists in the todolist";
Expand Down Expand Up @@ -66,8 +66,8 @@ public CommandResult execute(ModelToDo modelToDo, CommandHistory history) throws
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof AddToDoCommand // instanceof handles nulls
&& toAdd.equals(((AddToDoCommand) other).toAdd));
|| (other instanceof AddToDoCommand // instanceof handles nulls
&& toAdd.equals(((AddToDoCommand) other).toAdd));
}

}
7 changes: 3 additions & 4 deletions src/main/java/seedu/address/logic/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
*/
public abstract class Command {
public static final String MESSAGE_INCORRECT_MODEL_TODO =
"Incorrect Model: To Do Commands should operate on the ModelTodo";
"Incorrect Model: To Do Commands should operate on the ModelTodo";
public static final String MESSAGE_INCORRECT_MODEL_CALENDAR =
"Incorrect Model: Calendar Commands should operate on the Model";
"Incorrect Model: Calendar Commands should operate on the Model";

protected boolean isToDoCommand;

/**
* Returns whether command is a todolist command
*
*/
public boolean isToDoCommand() {
return isToDoCommand;
Expand All @@ -38,7 +37,7 @@ public boolean isToDoCommand() {
* Executes the todolist command and returns the result message.
*
* @param modelToDo {@code ModelToDo} which the todolist command should operate on.
* @param history {@code CommandHistory} which the todolist command should operate on.
* @param history {@code CommandHistory} which the todolist command should operate on.
* @return feedback message of the operation result for display
* @throws CommandException If an error occurs during command execution.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public class DeleteToDoCommand extends Command {
public static final String COMMAND_WORD = "delete todo";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the event identified by the index number used in the displayed todo list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";
+ ": Deletes the event identified by the index number used in the displayed todo list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_DELETE_TODOLIST_EVENT_SUCCESS = "Deleted ToDo Event: %1$s";

Expand Down Expand Up @@ -60,7 +60,7 @@ public CommandResult execute(ModelToDo modelToDo, CommandHistory history) throws
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof DeleteToDoCommand // instanceof handles nulls
&& targetIndex.equals(((DeleteToDoCommand) other).targetIndex)); // state check
|| (other instanceof DeleteToDoCommand // instanceof handles nulls
&& targetIndex.equals(((DeleteToDoCommand) other).targetIndex)); // state check
}
}
Loading

0 comments on commit e0895fd

Please sign in to comment.