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

Give code reuse credits #306

Merged
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
5 changes: 4 additions & 1 deletion docs/team/hmuumyatmoe.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Given below are my contributions to the project.
and the app provides a convenient way to record down and get an overview of their tasks.
* Credits: Code is adapted from [AddressBook-Level3 project](https://github.com/nus-cs2103-AY2223S2/tp) created by the [SE-EDU initiative](https://se-education.org)
<br><br>
* Added the ability to edit existing tasks and list tasks.
* Added the ability to edit existing tasks.
* What it does:
* Allows users to edit existing tasks so that they can keep tasks details correct and up to date.
* Justification: This feature improves the product because users may sometimes key in the wrong info
Expand All @@ -31,8 +31,11 @@ Given below are my contributions to the project.
and may wish to quickly find out which orders or tasks are more urgent at one glance.
This feature provides a convenient way for the home business owners to do so.
* Highlights: Users are able to sort the tasks or orders based on various criterias (Task Name, Task Deadline, Task Status, Time added, Task Status and Deadline)
* Credits: Code is adapted from [AddressBook-Level3 project](https://github.com/nus-cs2103-AY2223S2/tp) created by the [SE-EDU initiative](https://se-education.org)
<br><br>
* **Code contributed**: [RepoSense link](https://nus-cs2103-ay2223s2.github.io/tp-dashboard/?search=hmuumyatmoe&breakdown=true)
<br>All the functional and test codes reused or adapted are reused from and adapated from [AddressBook-Level3 project](https://github.com/nus-cs2103-AY2223S2/tp) created by the [SE-EDU initiative](https://se-education.org).
<br>Code used for rake symbol used in Edit Command Activity Diagram in the DG is reused from [this Plant Uml forum](https://forum.plantuml.net/195/is-there-any-support-for-subactivity-or-the-rake-symbol).
<br><br>
* **Project management**:
* Managed project documentation (UG & DG)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/trackr/logic/commands/AddItemCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public T getItemToAdd() {

/**
* Adds the item {@code toAdd} to its respective item list.
*
* @param model {@code Model} which the command should operate on.
* @return Success message of the add operation for display.
* @throws CommandException If item to be added is considered to be duplicates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/**
* Sorts all orders in the order list using a criteria given.
*/
//Solution below adapted from AB3
public class SortOrdersCommand extends Command {
public static final String COMMAND_WORD = "sort_order";
public static final String COMMAND_WORD_SHORTCUT = "sort_o";
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/trackr/logic/commands/task/AddTaskCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* Adds a task to the task list.
*/
public class AddTaskCommand extends AddItemCommand<Task> {
//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public static final String COMMAND_WORD = "add_task";
public static final String COMMAND_WORD_SHORTCUT = "add_t";

Expand All @@ -23,6 +25,7 @@ public class AddTaskCommand extends AddItemCommand<Task> {
+ PREFIX_NAME + "Sort Inventory "
+ PREFIX_DEADLINE + "01/01/2024 "
+ PREFIX_STATUS + "N ";
//@@author

/**
* Creates an AddTaskCommand to add the specified {@code Task}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* Edits the details of an existing task in the task list.
*/
public class EditTaskCommand extends EditItemCommand<Task> {

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public static final String COMMAND_WORD = "edit_task";
public static final String COMMAND_WORD_SHORTCUT = "edit_t";

Expand Down Expand Up @@ -57,4 +58,5 @@ protected Task createEditedItem(Task itemToEdit, ItemDescriptor<? super Task> it

return new Task(updatedTaskName, updatedTaskDeadline, updatedTaskStatus);
}
//@@author
}
3 changes: 3 additions & 0 deletions src/main/java/trackr/logic/commands/task/ListTaskCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
*/
public class ListTaskCommand extends ListItemCommand<Task> {

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public static final String COMMAND_WORD = "list_task";
public static final String COMMAND_WORD_SHORTCUT = "list_t";
//@@author

/**
* Creates a ListTaskCommand to list all the tasks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/**
* Sorts all task in task list using a criteria given.
*/
//Solution below adapted from AB3
public class SortTasksCommand extends Command {
public static final String COMMAND_WORD = "sort_task";
public static final String COMMAND_WORD_SHORTCUT = "sort_t";
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/trackr/logic/parser/ArgumentMultimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class ArgumentMultimap {
/** Prefixes mapped to their respective arguments **/
private final Map<Prefix, List<String>> argMultimap = new HashMap<>();

//@@author HmuuMyatMoe-reused
//Reused from
//`https://github.com/nus-cs2103-AY2223S2/tp/blob/master/src/main/java/seedu/address/logic/parser
// /ArgumentMultimap.java`
/**
* Associates the specified argument value with {@code prefix} key in this map.
* If the map previously contained a mapping for the key,
Expand All @@ -26,6 +30,7 @@ public class ArgumentMultimap {
* @param prefix Prefix key with which the specified argument value is to be associated.
* @param argValue Argument value to be associated with the specified prefix key.
*/
//@@author
public void put(Prefix prefix, String argValue) {
List<String> argValues = getAllValues(prefix);
argValues.add(argValue);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/trackr/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public static Set<Tag> parseTags(Collection<String> tags) throws ParseException
return tagSet;
}

//Solution below adapted from AB3.
/**
* Parses a {@code Optional<String> criteria} into a {@code CriteriaEnum}.
*
Expand All @@ -161,6 +162,8 @@ public static CriteriaEnum parseSortingCriteria(Optional<String> criteria) throw

//========================Parse those related to task==================================

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
/**
* Parses a {@code String taskName} into a {@code TaskName}.
* Leading and trailing whitespaces will be trimmed.
Expand Down Expand Up @@ -190,7 +193,9 @@ public static TaskDeadline parseTaskDeadline(String taskDeadline) throws ParseEx
}
return new TaskDeadline(trimmedTaskDeadline);
}
//@@author

//Solution below adapted from AB3 with some reuse.
/**
* Parses a {@code String taskStatus} into a {@code TaskStatus}.
* Leading and trailing whitespaces will be trimmed.
Expand All @@ -203,11 +208,14 @@ public static TaskStatus parseTaskStatus(Optional<String> taskStatus) throws Par
return new TaskStatus();
}

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
String trimmedTaskStatus = taskStatus.get().trim();
if (!TaskStatus.isValidStatus(trimmedTaskStatus, TaskStatus.STATUSES)) {
throw new ParseException(TaskStatus.MESSAGE_CONSTRAINTS);
}
return new TaskStatus(trimmedTaskStatus);
//@@author
}
//========================Parse those related to menu item==================================

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/trackr/logic/parser/TrackrParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class TrackrParser {
*/
private static final Pattern BASIC_COMMAND_FORMAT = Pattern.compile("(?<commandWord>\\S+)(?<arguments>.*)");

//Solution below is adapted from AB3 with some parts reused from AB3 with modification
/**
* Parses user input into command for execution.
*
Expand Down Expand Up @@ -94,9 +95,12 @@ public Command parseCommand(String userInput) throws ParseException {
case AddSupplierCommand.COMMAND_WORD_SHORTCUT:
return new AddSupplierCommandParser().parse(arguments);

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
case AddTaskCommand.COMMAND_WORD:
case AddTaskCommand.COMMAND_WORD_SHORTCUT:
return new AddTaskCommandParser().parse(arguments);
//@@author

case AddMenuItemCommand.COMMAND_WORD:
case AddMenuItemCommand.COMMAND_WORD_SHORTCUT:
Expand All @@ -106,9 +110,12 @@ public Command parseCommand(String userInput) throws ParseException {
case EditSupplierCommand.COMMAND_WORD_SHORTCUT:
return new EditSupplierCommandParser().parse(arguments);

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
case EditTaskCommand.COMMAND_WORD:
case EditTaskCommand.COMMAND_WORD_SHORTCUT:
return new EditTaskCommandParser().parse(arguments);
//@@author

case EditMenuItemCommand.COMMAND_WORD:
case EditMenuItemCommand.COMMAND_WORD_SHORTCUT:
Expand Down Expand Up @@ -176,21 +183,27 @@ public Command parseCommand(String userInput) throws ParseException {
case ListOrderCommand.COMMAND_WORD_SHORTCUT:
return new ListOrderCommand();

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
case ListTaskCommand.COMMAND_WORD:
case ListTaskCommand.COMMAND_WORD_SHORTCUT:
return new ListTaskCommand();
//@@author

case ListMenuItemCommand.COMMAND_WORD:
case ListMenuItemCommand.COMMAND_WORD_SHORTCUT:
return new ListMenuItemCommand();

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
case SortTasksCommand.COMMAND_WORD:
case SortTasksCommand.COMMAND_WORD_SHORTCUT:
return new SortTasksCommandParser().parse(arguments);

case SortOrdersCommand.COMMAND_WORD:
case SortOrdersCommand.COMMAND_WORD_SHORTCUT:
return new SortOrdersCommandParser().parse(arguments);
//@@author

case TabCommand.COMMAND_WORD:
return new TabCommandParser().parse(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class UploadCsvCommandParser implements Parser<UploadCsvCommand> {
* Parses the given {@code String} of arguments in the context of the UploadCsvCommand
* and returns an UploadCsvCommand object for execution.
*/
//@@author
public UploadCsvCommand parse(String args) throws ParseException {
String[] raw = args.split(",");
String[] components = Arrays.copyOfRange(raw, 1, raw.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import trackr.model.task.TaskName;
import trackr.model.task.TaskStatus;

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
/**
* Parses input arguments and creates a new AddTaskCommand object.
*/

public class AddTaskCommandParser implements Parser<AddTaskCommand> {

/**
Expand Down Expand Up @@ -57,3 +58,4 @@ private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Pre
}

}
//@@author
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import trackr.logic.parser.exceptions.ParseException;
import trackr.model.task.TaskDescriptor;

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
/**
* Parses input arguments and creates a new EditTaskCommand object.
*/
Expand Down Expand Up @@ -63,3 +65,4 @@ public EditTaskCommand parse(String args) throws ParseException {
}

}
//@@author
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import trackr.logic.parser.exceptions.ParseException;
import trackr.model.task.SortTasksComparator;

//Solution below is adapted from AB3
/**
* Parses input arguments and creates a new SortTasksCommand object.
*/
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/trackr/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public interface Model {
void sortFilteredOrderList(Comparator<Order> comparator);

// ===================================================== Task =====================================================

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
/**
* Returns the TaskList.
*/
Expand All @@ -154,6 +155,7 @@ public interface Model {
* Returns an unmodifiable view of the filtered task list.
*/
ObservableList<Task> getFilteredTaskList();
//@@author

/**
* Sorts the filtered task list.
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/trackr/model/ObservableTabIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public static final void updateToTab(int target) {
targetTabIndex.set(target);
}

//@@author arkarsg
public static final int getTargetTab() {
return targetTabIndex.getValue();
}
//@@author
}
3 changes: 3 additions & 0 deletions src/main/java/trackr/model/ReadOnlyTaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import trackr.model.item.ReadOnlyItemList;
import trackr.model.task.Task;

//@@author HmuuMyatMoe-reused
// with minor modifications
/**
* Unmodifiable view of a task list.
*/
//@@author liumc-sg-reused
public interface ReadOnlyTaskList extends ReadOnlyItemList<Task> {
}
//@@author
3 changes: 3 additions & 0 deletions src/main/java/trackr/model/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import trackr.model.item.ItemList;
import trackr.model.task.Task;

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
/**
* Wraps all data at the task-list level.
* Duplicates are not allowed (by .isSameItem comparison).
Expand All @@ -20,3 +22,4 @@ public TaskList(ReadOnlyTaskList toBeCopied) {
super(toBeCopied);
}
}
//@@author
4 changes: 3 additions & 1 deletion src/main/java/trackr/model/menu/ItemName.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
*/
public class ItemName extends Name {

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public static final String MESSAGE_CONSTRAINTS =
"Item names should only contain alphanumeric characters and spaces, and it should not be blank";

//@@author

/**
* Constructs an {@code ItemName}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public OrderContainsKeywordsPredicate() {
* with the same keywords of order details as the
* {@code OrderContainsKeywordsPredicate} object specified.
* @param toCopy The {@code OrderContainsKeywordsPredicate} object
* to copy the order name keywords from.
* to copy the order keywords from.
*/
public OrderContainsKeywordsPredicate(OrderContainsKeywordsPredicate toCopy) {
setOrderNameKeywords(toCopy.orderNameKeywords);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/trackr/model/order/OrderDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ public Optional<OrderStatus> getOrderStatus() {
return Optional.ofNullable(orderStatus);
}

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public void setOrderItem(MenuItem orderItem) {
this.orderItem = orderItem;
}

public Optional<MenuItem> getOrderItem() {
return Optional.ofNullable(orderItem);
}
//@@author

@Override
public boolean equals(Object other) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/trackr/model/order/OrderName.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
*/
public class OrderName extends Name {

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public static final String MESSAGE_CONSTRAINTS =
"Order names should only contain alphanumeric characters and spaces, and it should not be blank";
//@@author

/**
* Constructs a {@code OrderName}.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/trackr/model/order/OrderQuantity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static boolean isValidQuantity(String test) {
}

/**
* Returns a quantity value in the form of an int from a string value.
* Returns an order quantity value in the form of an int from a string value.
*
* @return {@code int} form of value string.
*/
Expand All @@ -43,7 +43,7 @@ public int getOrderQuantity() {
}

/**
* Returns a quantity value in the form of a string.
* Returns an order quantity value in the form of a string.
*
* @return value in the form of a string.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/trackr/model/person/PersonName.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
*/
public class PersonName extends Name {

//@@author HmuuMyatMoe-reused
//Reused from AB3 with minor modifications
public static final String MESSAGE_CONSTRAINTS =
"Person (Customer / Supplier) names should only contain "
+ "alphanumeric characters and spaces, and it should not be blank";
//@@author

/**
* Constructs a {@code PersonName}.
Expand Down
Loading