forked from se-edu/addressbook-level2
-
Notifications
You must be signed in to change notification settings - Fork 104
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
[W5.11][F10-3]Shreyas Kuthanoor Prakash #181
Open
ShreyasKp
wants to merge
30
commits into
nusCS2113-AY1819S1:master
Choose a base branch
from
CS2113-AY1819S1-F10-3:feature/top_five
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
fe9fe0f
Added confirm/cancel clear option to after clear command
iamputradanish 66db9a8
Merge pull request #1 from CS2113-AY1819S1-F10-3/confirm_cancel_clear…
iamputradanish f22df67
Update UserGuide
iamputradanish ff12999
Merge pull request #2 from CS2113-AY1819S1-F10-3/iamputradanish-patch-1
iamputradanish ffa8b03
Delete by name command
andyrobert3 d3d0e55
Added user guide for new delete_name command
andyrobert3 0bdbacb
Merge branch 'master' into feature/delete_name
andyrobert3 51c1830
Merge pull request #3 from CS2113-AY1819S1-F10-3/feature/delete_name
ShreyasKp 07b409a
added nonsense
ongweekeong 4971881
Merge commit '51c183064febaed0dea56ca2e129f40484781a94' into tutorial-4
ongweekeong b7c6185
Merge branch 'master' into feature/delete_name
andyrobert3 94bece0
Merge remote-tracking branch 'origin/feature/delete_name' into W5.11
andyrobert3 ba96540
deleted nonsense
ongweekeong 51af3c6
Merge remote-tracking branch 'origin/feature/delete_name' into W5.11
andyrobert3 2a5b474
added total command and edited user guide
muhdharun a47f7a8
Merge branch 'master' into w5.11
muhdharun 03bf4b6
Merge pull request #4 from muhdharun/w5.11
ongweekeong 871908b
Added further constraints to 'add' feature
ongweekeong 9eddf0d
Edited user guide
ongweekeong eec6c50
Merge branch 'W5.11' of https://github.com/CS2113-AY1819S1-F10-3/addr…
ongweekeong 99cf098
Merge pull request #5 from CS2113-AY1819S1-F10-3/W5.11
andyrobert3 7e71dca
Revert "[W5.11][CS2113-AY1819S1-F10-3]Ong Wee Keong"
andyrobert3 db25458
Merge pull request #6 from CS2113-AY1819S1-F10-3/revert-5-W5.11
andyrobert3 4ebc7f0
Added restrictions to 'add' command & removed duplicate labels
ongweekeong 9594a6f
Merge pull request #7 from CS2113-AY1819S1-F10-3/W_5.11
muhdharun f705fc0
add functionality to list top five persons
ShreyasKp a8529c5
update user guide and parser files
ShreyasKp 8fc7316
Merge branch 'master' of https://github.com/CS2113-AY1819S1-F10-3/add…
ShreyasKp 1ee73fa
update ParserTest
ShreyasKp 9951c42
remove ParserTest edit
ShreyasKp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,9 @@ items with `...` after them can have multiple instances. Order of parameters are | |
Put a `p` before the phone / email / address prefixes to mark it as `private`. `private` details can only | ||
be seen using the `viewall` command. | ||
|
||
Persons with duplicate primary key identity fields (Same name AND same phone number/email, or even different | ||
name with same phone number AND email) will not be allowed. | ||
|
||
Persons can have any number of tags (including 0). | ||
**** | ||
|
||
|
@@ -67,11 +70,21 @@ Examples: | |
* `add John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01` | ||
* `add Betsy Crowe pp/1234567 e/[email protected] pa/Newgate Prison t/criminal t/friend` | ||
|
||
== Showing current number of contacts : `total` | ||
|
||
Shows the current total number of contacts in the address book, without showing the names. + | ||
Format: `total` | ||
|
||
== Listing all persons : `list` | ||
|
||
Shows a list of all persons, along with their non-private details, in the address book. + | ||
Format: `list` | ||
|
||
== Listing first five persons : `topFive` | ||
|
||
Shows a list of the first five persons, along with their non-private details, in the address book. + | ||
Format: `topFive` | ||
|
||
== Finding all persons containing any keyword in their name: `find` | ||
|
||
Finds persons whose names contain any of the given keywords. + | ||
|
@@ -91,7 +104,7 @@ Returns `John Doe` but not `john`. | |
* `find Betsy Tim John` + | ||
Returns Any person having names `Betsy`, `Tim`, or `John`. | ||
|
||
== Deleting a person : `delete` | ||
== Deleting a person by index: `delete` | ||
|
||
Deletes the specified person from the address book. Irreversible. + | ||
Format: `delete INDEX` | ||
|
@@ -111,6 +124,27 @@ Deletes the 2nd person in the address book. | |
`delete 1` + | ||
Deletes the 1st person in the results of the `find` command. | ||
|
||
== Deleting a person by name: `delete_name` | ||
|
||
Deletes the specified person from the address book after indexing other commands. Irreversible. + | ||
Format: `delete NAME` | ||
|
||
**** | ||
Deletes the person by `NAME` not case sensitive. | ||
`NAME` refers to the full name of the person. | ||
**** | ||
|
||
Examples: | ||
|
||
* `list` + | ||
`delete_name Matthew Alexander` + | ||
Deletes the Matthew Alexander in the address book. | ||
|
||
* `find Betsy` + | ||
`delete_name Betsy` + | ||
Deletes the 1st person in the results of the `find` command. | ||
|
||
|
||
== View non-private details of a person : `view` | ||
|
||
Displays the non-private details of the specified person. + | ||
|
@@ -153,9 +187,19 @@ Views all details of the 1st person in the results of the `find` command. | |
|
||
== Clearing all entries : `clear` | ||
|
||
Clears all entries from the address book. + | ||
Gives user a warning prompt to confirm or cancel deletion of address book.+ | ||
Format: `clear` | ||
|
||
== Confirm Clear all entries : `yes` | ||
|
||
Clears all entries from the address book. + | ||
Format: `yes` | ||
|
||
== Cancel the clearing of all entries : `no` | ||
|
||
Informs user that the address book has not been cleared. + | ||
Format: `no` | ||
|
||
== Exiting the program : `exit` | ||
|
||
Exits the program. + | ||
|
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,14 @@ | ||
package seedu.addressbook.commands; | ||
|
||
public class CancelClearCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "no"; | ||
public static final String MESSAGE_CANCEL = "Address book has not been cleared."; | ||
|
||
public CancelClearCommand() {} | ||
|
||
@Override | ||
public CommandResult execute() { | ||
return new CommandResult(MESSAGE_CANCEL); | ||
} | ||
} |
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,15 @@ | ||
package seedu.addressbook.commands; | ||
|
||
public class ConfirmClearCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "yes"; | ||
public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; | ||
|
||
public ConfirmClearCommand() {} | ||
|
||
@Override | ||
public CommandResult execute() { | ||
addressBook.clear(); | ||
return new CommandResult(MESSAGE_SUCCESS); | ||
} | ||
} |
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,34 @@ | ||
package seedu.addressbook.commands; | ||
|
||
import seedu.addressbook.data.person.ReadOnlyPerson; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Lists the first five persons in the address book to the user. | ||
*/ | ||
|
||
public class TopFiveCommand extends Command{ | ||
public static final String COMMAND_WORD = "topFive"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Displays first five persons in the address book as a list with index numbers.\n" | ||
+ "Example: " + COMMAND_WORD; | ||
|
||
@Override | ||
public CommandResult execute() { | ||
List<ReadOnlyPerson> allPersons = addressBook.getAllPersons().immutableListView(); | ||
int size = allPersons.size(); | ||
if(size < 5) { | ||
return new CommandResult(getMessageForPersonListShownSummary(allPersons), allPersons); | ||
} | ||
else { | ||
List<ReadOnlyPerson> toBeDisplayed = new ArrayList<>(); | ||
for(int i = 0; i < 5; i++) { | ||
toBeDisplayed.add(i, allPersons.get(i)); | ||
} | ||
return new CommandResult(getMessageForPersonListShownSummary(toBeDisplayed), toBeDisplayed); | ||
} | ||
} | ||
} |
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,27 @@ | ||
package seedu.addressbook.commands; | ||
|
||
import seedu.addressbook.data.person.ReadOnlyPerson; | ||
|
||
import java.util.List; | ||
|
||
|
||
/** | ||
* Shows current total number of contacts in book. | ||
*/ | ||
public class TotalCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "total"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Displays the current number of contacts in the AB.\n" | ||
+ "Example: " + COMMAND_WORD; | ||
|
||
public static final String MESSAGE_SUCCESS = " Contact(s) found"; | ||
|
||
|
||
@Override | ||
public CommandResult execute() { | ||
int TotalContacts = addressBook.total(); | ||
return new CommandResult(TotalContacts + "" + MESSAGE_SUCCESS); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe to keep the command word format consistent, you can use top_five instead of camelCase, or simply top might be more intuitive and user-friendly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively, you might want to allow the user to specify how many persons to list, so command like 'top 5'