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

[W5][T11-2]Teo Xuan Wei #56

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ Deletes the 2nd person in the address book.
`delete 1` +
Deletes the 1st person in the results of the `find` command.

== Pseudo Sorting : `dummysort`

Psuedo sorts the address book in alphabetical order (mimics how a sort would be implemented by laying out the skeletal structure as well as pinpoint the files within the project to be updated.)
Format: `dummysort`

****
Supposedly takes all the entries of the address book and sorts the names in alphabetical order.
****

Examples:

* `dummysort` +

== View non-private details of a person : `view`

Displays the non-private details of the specified person. +
Expand Down
4 changes: 2 additions & 2 deletions src/seedu/addressbook/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
* Initializes the application and starts the interaction with the user.
*/
public class Main {

// test commit

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is not relevant to the enhancement. you may wish to remove this.

/** Version info of the program. */
public static final String VERSION = "AddressBook Level 2 - Version 1.0";
public static final String VERSION = "AddressBook Level 2 - Version 1.1";

private TextUi ui;
private StorageFile storage;
Expand Down
32 changes: 32 additions & 0 deletions src/seedu/addressbook/commands/DummySortCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package seedu.addressbook.commands;

import java.util.HashSet;
import java.util.Set;

import seedu.addressbook.data.exception.IllegalValueException;
import seedu.addressbook.data.person.Address;
import seedu.addressbook.data.person.Email;
import seedu.addressbook.data.person.Name;
import seedu.addressbook.data.person.Person;
import seedu.addressbook.data.person.Phone;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.person.UniquePersonList;
import seedu.addressbook.data.tag.Tag;

/**
* Adds a person to the address book.
*/
public class DuummySortCommand extends Command {

public static final String COMMAND_WORD = "dummysort";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Psuedo sorts contacts in the address book in alphabetical order.\n"
+ "Example: " + COMMAND_WORD;

public static final String MESSAGE_SUCCESS = "Address book is sorted in alphabetical order! ^^";

@Override

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing header comment. All non-trivial methods should have java doc format header comments.

public CommandResult execute() {
return new CommandResult(MESSAGE_SUCCESS);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if you have also attempted the actual sort logic, instead of returning a print statement.
Note that you are not performing a pseudo-sort here, unlike what is written in your documentation. Only a success statement is printed.

}
}
1 change: 1 addition & 0 deletions src/seedu/addressbook/commands/HelpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class HelpCommand extends Command {
public CommandResult execute() {
return new CommandResult(
AddCommand.MESSAGE_USAGE
+ "\n" + DummySortCommand.MESSAGE_USAGE
+ "\n" + DeleteCommand.MESSAGE_USAGE
+ "\n" + ClearCommand.MESSAGE_USAGE
+ "\n" + FindCommand.MESSAGE_USAGE
Expand Down
5 changes: 4 additions & 1 deletion src/seedu/addressbook/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public Command parseCommand(String userInput) {
case DeleteCommand.COMMAND_WORD:
return prepareDelete(arguments);

case ClearCommand.COMMAND_WORD:
case DummySortCommand.COMMAND_WORD:
return new DummySortCommand();

case ClearCommand.COMMAND_WORD
return new ClearCommand();

case FindCommand.COMMAND_WORD:
Expand Down