Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge V0.4-Refactor-And-Cleanup #71

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/main/java/seedu/savvytasker/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class MainApp extends Application {
private static final Logger logger = LogsCenter.getLogger(MainApp.class);

public static final Version VERSION = new Version(1, 0, 0, true);
public static final Version VERSION = new Version(0, 4, 0, true);

protected Ui ui;
protected Logic logic;
Expand All @@ -44,7 +44,7 @@ public MainApp() {}

@Override
public void init() throws Exception {
logger.info("=============================[ Initializing AddressBook ]===========================");
logger.info("=============================[ Initializing Savvy Tasker ]===========================");
super.init();

config = initConfig(getApplicationParameter("config"));
Expand Down Expand Up @@ -74,14 +74,14 @@ private Model initModelManager(Storage storage, UserPrefs userPrefs) {
try {
savvyTaskerOptional = storage.readSavvyTasker();
if(!savvyTaskerOptional.isPresent()){
logger.info("Data file not found. Will be starting with an empty AddressBook");
logger.info("Data file not found. Will be starting with an empty Savvy Tasker");
}
initialData = savvyTaskerOptional.orElse(new SavvyTasker());
} catch (DataConversionException e) {
logger.warning("Data file not in the correct format. Will be starting with an empty AddressBook");
logger.warning("Data file not in the correct format. Will be starting with an empty Savvy Tasker");
initialData = new SavvyTasker();
} catch (IOException e) {
logger.warning("Problem while reading from the file. . Will be starting with an empty AddressBook");
logger.warning("Problem while reading from the file. . Will be starting with an empty Savvy Tasker");
initialData = new SavvyTasker();
}

Expand Down Expand Up @@ -138,7 +138,7 @@ protected UserPrefs initPrefs(Config config) {
"Using default user prefs");
initializedPrefs = new UserPrefs();
} catch (IOException e) {
logger.warning("Problem while reading from the file. . Will be starting with an empty AddressBook");
logger.warning("Problem while reading from the file. . Will be starting with an empty Savvy Tasker");
initializedPrefs = new UserPrefs();
}

Expand All @@ -158,13 +158,13 @@ private void initEventsCenter() {

@Override
public void start(Stage primaryStage) {
logger.info("Starting AddressBook " + MainApp.VERSION);
logger.info("Starting Savvy Tasker " + MainApp.VERSION);
ui.start(primaryStage);
}

@Override
public void stop() {
logger.info("============================ [ Stopping Address Book ] =============================");
logger.info("============================ [ Stopping Savvy Tasker ] =============================");
ui.stop();
try {
storage.saveUserPrefs(userPrefs);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/seedu/savvytasker/commons/core/GuiSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
public class GuiSettings implements Serializable {

/**
* Generated serial
*/
private static final long serialVersionUID = -7442507632162266083L;
private static final double DEFAULT_HEIGHT = 600;
private static final double DEFAULT_WIDTH = 740;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public final SortedList<E> sorted(Comparator<E> comparator) {
public final SortedList<E> sorted() {
return sorted(Comparator.nullsFirst((o1, o2) -> {
if (o1 instanceof Comparable) {
return ((Comparable) o1).compareTo(o2);
return ((Comparable<E>) o1).compareTo(o2);
}
return Collator.getInstance().compare(o1.toString(), o2.toString());
}));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import seedu.savvytasker.commons.events.BaseEvent;

/**
* Indicates a request to jump to the list of persons
* Indicates a request to jump to the list of tasks
*/
public class JumpToListRequestEvent extends BaseEvent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.savvytasker.commons.events.ui;

import seedu.savvytasker.commons.events.BaseEvent;
import seedu.savvytasker.model.person.ReadOnlyTask;
import seedu.savvytasker.model.task.ReadOnlyTask;

/**
* Represents a selection change in the Person List Panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* Represents an error during conversion of data from one format to another
*/
public class DataConversionException extends Exception {
/**
* Generated serial
*/
private static final long serialVersionUID = -5908631495910190437L;

public DataConversionException(Exception cause) {
super(cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* Signals an error caused by duplicate data where there should be none.
*/
public abstract class DuplicateDataException extends IllegalValueException {
/**
* Generated serial
*/
private static final long serialVersionUID = 5045611929659070003L;

public DuplicateDataException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* Signals that some given data does not fulfill some constraints.
*/
public class IllegalValueException extends Exception {
/**
* Generated serial
*/
private static final long serialVersionUID = 193885632897265498L;

/**
* @param message should contain relevant information on the failed constraint(s)
*/
Expand Down
47 changes: 0 additions & 47 deletions src/main/java/seedu/savvytasker/commons/util/CollectionUtil.java

This file was deleted.

5 changes: 5 additions & 0 deletions src/main/java/seedu/savvytasker/commons/util/JsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
public class JsonUtil {
private static class LevelDeserializer extends FromStringDeserializer<Level> {

/**
* Generated serial
*/
private static final long serialVersionUID = 7901046138205615293L;

protected LevelDeserializer(Class<?> vc) {
super(vc);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/savvytasker/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import javafx.collections.ObservableList;
import seedu.savvytasker.logic.commands.CommandResult;
import seedu.savvytasker.model.person.ReadOnlyTask;
import seedu.savvytasker.model.task.ReadOnlyTask;

/**
* API of the Logic component
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/savvytasker/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import seedu.savvytasker.logic.commands.CommandResult;
import seedu.savvytasker.logic.parser.*;
import seedu.savvytasker.model.Model;
import seedu.savvytasker.model.person.ReadOnlyTask;
import seedu.savvytasker.model.task.ReadOnlyTask;
import seedu.savvytasker.storage.Storage;

import java.util.Stack;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package seedu.savvytasker.logic.commands;

import seedu.savvytasker.logic.commands.models.AddCommandModel;
import seedu.savvytasker.model.person.*;
import seedu.savvytasker.model.person.TaskList.DuplicateTaskException;
import seedu.savvytasker.model.task.Task;
import seedu.savvytasker.model.task.TaskList.DuplicateTaskException;

/**
* Adds a person to the address book.
Expand Down Expand Up @@ -42,7 +42,6 @@ public CommandResult execute() {
model.addTask(toAdd);
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
} catch (DuplicateTaskException e) {
assert false; // ModelManager will ensure no duplicated tasks
return new CommandResult(MESSAGE_DUPLICATE_TASK);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package seedu.savvytasker.logic.commands;

import seedu.savvytasker.logic.commands.models.AliasCommandModel;
import seedu.savvytasker.model.person.*;
import seedu.savvytasker.model.person.TaskList.DuplicateTaskException;
import seedu.savvytasker.model.task.Task;
import seedu.savvytasker.model.task.TaskList.DuplicateTaskException;

/**
* Command to create aliases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.commons.core.UnmodifiableObservableList;
import seedu.savvytasker.logic.commands.models.DeleteCommandModel;
import seedu.savvytasker.model.person.ReadOnlyTask;
import seedu.savvytasker.model.person.TaskList.TaskNotFoundException;
import seedu.savvytasker.model.task.ReadOnlyTask;
import seedu.savvytasker.model.task.TaskList.TaskNotFoundException;

/**
* Deletes a person identified using it's last displayed index from the address book.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.commons.core.UnmodifiableObservableList;
import seedu.savvytasker.logic.commands.models.ModifyCommandModel;
import seedu.savvytasker.model.person.*;
import seedu.savvytasker.model.person.TaskList.TaskNotFoundException;
import seedu.savvytasker.model.task.ReadOnlyTask;
import seedu.savvytasker.model.task.Task;
import seedu.savvytasker.model.task.TaskList.TaskNotFoundException;

/**
* Adds a person to the address book.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.commons.core.UnmodifiableObservableList;
import seedu.savvytasker.commons.events.ui.JumpToListRequestEvent;
import seedu.savvytasker.model.person.ReadOnlyTask;
import seedu.savvytasker.model.task.ReadOnlyTask;

/**
* Selects a person identified using it's last displayed index from the address book.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import seedu.savvytasker.commons.exceptions.IllegalValueException;
import seedu.savvytasker.logic.commands.models.AliasCommandModel;
import seedu.savvytasker.model.person.*;
import seedu.savvytasker.model.person.TaskList.DuplicateTaskException;
import seedu.savvytasker.model.task.Task;
import seedu.savvytasker.model.task.TaskList.DuplicateTaskException;

/**
* Command to remove aliases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import java.util.regex.Pattern;

import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.logic.commands.DeleteCommand;
import seedu.savvytasker.logic.commands.MarkCommand;
import seedu.savvytasker.logic.commands.models.DeleteCommandModel;

public class MarkCommandParser implements CommandParser<MarkCommand> {
private static final String HEADER = "mark";
Expand All @@ -33,7 +31,7 @@ public String getRequiredFormat() {
public MarkCommand parse(String commandText) throws ParseException {
Matcher matcher = REGEX_PATTERN.matcher(commandText);
if (matcher.matches()) {
int[] indices = parseIndices(matcher.group(REGEX_REF_INDICES));
parseIndices(matcher.group(REGEX_REF_INDICES));

// TODO: Integrate with MarkCommand properly
return new MarkCommand();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package seedu.savvytasker.logic.parser;

import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.logic.commands.ExitCommand;
import seedu.savvytasker.logic.commands.RedoCommand;
import seedu.savvytasker.logic.commands.UndoCommand;

public class RedoCommandParser implements CommandParser<RedoCommand> {
private static final String HEADER = "redo";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package seedu.savvytasker.logic.parser;

import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.logic.commands.ExitCommand;
import seedu.savvytasker.logic.commands.UndoCommand;

public class UndoCommandParser implements CommandParser<UndoCommand> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import java.util.regex.Pattern;

import seedu.savvytasker.commons.core.Messages;
import seedu.savvytasker.logic.commands.DeleteCommand;
import seedu.savvytasker.logic.commands.UnmarkCommand;
import seedu.savvytasker.logic.commands.models.DeleteCommandModel;

public class UnmarkCommandParser implements CommandParser<UnmarkCommand> {
private static final String HEADER = "unmark";
Expand All @@ -33,7 +31,7 @@ public String getRequiredFormat() {
public UnmarkCommand parse(String commandText) throws ParseException {
Matcher matcher = REGEX_PATTERN.matcher(commandText);
if (matcher.matches()) {
int[] indices = parseIndices(matcher.group(REGEX_REF_INDICES));
parseIndices(matcher.group(REGEX_REF_INDICES));

// TODO: Integrate UnmarkCommand properly!
return new UnmarkCommand();
Expand Down
Loading