forked from nus-cs2103-AY2223S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
526 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
@startuml | ||
!include style.puml | ||
|
||
box Logic LOGIC_COLOR_T1 | ||
participant ":LogicManager" as LogicManager LOGIC_COLOR | ||
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR | ||
participant "AddTxnCommandParser" as AddTxnCommandParser LOGIC_COLOR | ||
participant "a:AddTxnCommand" as AddTxnCommand LOGIC_COLOR | ||
participant ":CommandResult" as CommandResult LOGIC_COLOR | ||
end box | ||
|
||
box Model MODEL_COLOR_T1 | ||
participant ":Model" as Model MODEL_COLOR | ||
end box | ||
[-> LogicManager : execute("addtxn td/...") | ||
activate LogicManager | ||
|
||
LogicManager -> AddressBookParser : parseCommand("addtxn td/...") | ||
activate AddressBookParser | ||
|
||
AddressBookParser -> AddTxnCommandParser | ||
activate AddTxnCommandParser | ||
AddTxnCommandParser --> AddressBookParser | ||
deactivate AddTxnCommandParser | ||
|
||
AddressBookParser -> AddTxnCommandParser: parse("td/...") | ||
activate AddTxnCommandParser | ||
|
||
create AddTxnCommand | ||
AddressBookParser -> AddTxnCommand | ||
activate AddTxnCommand | ||
|
||
AddTxnCommand --> AddressBookParser: a | ||
deactivate AddTxnCommand | ||
|
||
AddTxnCommandParser --> AddressBookParser: a | ||
deactivate AddTxnCommandParser | ||
|
||
AddTxnCommandParser -[hidden]-> AddressBookParser | ||
deactivate AddTxnCommandParser | ||
|
||
AddressBookParser --> LogicManager: a | ||
deactivate AddressBookParser | ||
|
||
AddTxnCommand -> AddTxnCommandParser : execute() | ||
activate AddTxnCommand | ||
|
||
AddTxnCommand -> Model: addTransaction("td/...") | ||
activate Model | ||
|
||
Model --> AddTxnCommand | ||
deactivate Model | ||
|
||
create CommandResult | ||
AddTxnCommand -> CommandResult | ||
activate CommandResult | ||
|
||
CommandResult --> AddTxnCommand | ||
deactivate CommandResult | ||
|
||
AddTxnCommand --> LogicManager : result | ||
deactivate AddTxnCommand | ||
|
||
[<--LogicManager | ||
deactivate LogicManager | ||
@enduml |
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,35 @@ | ||
@startuml | ||
skinparam classAttributeIconSize 0 | ||
hide circle | ||
|
||
class Person | ||
class LeadStatus | ||
enum "<<enumeration>>\nLeadStatusName" as LeadStatusName | ||
|
||
LeadStatusName <-- LeadStatus | ||
LeadStatus <-- Person | ||
|
||
class Person { | ||
} | ||
|
||
class LeadStatus { | ||
-lastUpdateTime:LocalDateTime | ||
|
||
+update(LeadStatusName newStatus) | ||
+getTimestamp() | ||
} | ||
|
||
enum LeadStatusName { | ||
UNCONTACTED | ||
WORKING | ||
QUALIFIED | ||
UNQUALIFIED | ||
|
||
+SYMBOL_LEAD_STATUS_MAP:HashMap | ||
+STRING_LEAD_STATUS_MAP:HashMap | ||
|
||
+isValidStatusName(String) | ||
+get(String) | ||
} | ||
|
||
@enduml |
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,36 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
!include style.puml | ||
|
||
|
||
participant ":StatusCommand" as StatusCommand LOGIC_COLOR | ||
participant ":Model" as Model LOGIC_COLOR | ||
|
||
|
||
|
||
-> StatusCommand: execute() | ||
|
||
StatusCommand -> Model: getFilteredPersonList() | ||
Model --> StatusCommand: List<person> lastShownList | ||
|
||
alt index exceeds lastShownList.size() | ||
<--- StatusCommand: CommandException | ||
end | ||
|
||
StatusCommand -> Model: getZeroBased(index) | ||
StatusCommand <-- Model: toBeUpdated:Person | ||
|
||
alt lead status is the same as\nlead status of toBeUpdated | ||
<-- StatusCommand: CommandException | ||
end | ||
|
||
StatusCommand -> StatusCommand : createPersonWithNewStatus()\n return:updatedPerson | ||
|
||
StatusCommand -> Model : setPerson(updatedPerson) | ||
Model --> StatusCommand | ||
|
||
StatusCommand -> Model : updateFilteredPersonList() | ||
Model --> StatusCommand | ||
|
||
box | ||
@enduml |
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,13 @@ | ||
@startuml | ||
!include style.puml | ||
|
||
participant ":LogicManager" as LogicManager LOGIC_COLOR | ||
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR | ||
participant ":AddTxnTransaction" as AddTxnCommandParser LOGIC_COLOR | ||
participant "a:AddTxnCommand" as AddTxnCommand LOGIC_COLOR | ||
participant ":CommandResult" as CommandResult LOGIC_COLOR | ||
|
||
LogicManager -> AddressBookParser : execute("addtxn") | ||
|
||
|
||
@enduml |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
43 changes: 43 additions & 0 deletions
43
src/main/java/seedu/address/logic/commands/SortCommand.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,43 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.commons.core.Messages; | ||
import seedu.address.model.Model; | ||
|
||
/** | ||
* Sorts address book based on lead attribute. | ||
*/ | ||
public class SortCommand extends Command { | ||
public static final String COMMAND_WORD = "sort"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Sorts all persons based on a specific attribute " | ||
+ "the specified attribute (case-insensitive) and displays them as a list with index numbers.\n" | ||
+ "Parameters: ATTRIBUTE \n" | ||
+ "Example: " + COMMAND_WORD + " name"; | ||
private final String attribute; | ||
|
||
public SortCommand(String attribute) { | ||
this.attribute = attribute; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
requireNonNull(model); | ||
try { | ||
model.sortPersonList(attribute); | ||
return new CommandResult( | ||
String.format( | ||
Messages.MESSAGE_PERSONS_SORTED_OVERVIEW, attribute)); | ||
} catch (RuntimeException e) { | ||
return new CommandResult(e.getMessage()); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof SortCommand // instanceof handles nulls | ||
&& attribute.equals(((SortCommand) other).attribute)); // state check | ||
} | ||
} |
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.