Skip to content

Commit

Permalink
Merge branch 'master' into JarFile
Browse files Browse the repository at this point in the history
  • Loading branch information
deborahlow97 authored Mar 28, 2018
2 parents 513e709 + 8800c59 commit 86a90e6
Show file tree
Hide file tree
Showing 13 changed files with 525 additions and 27 deletions.
170 changes: 146 additions & 24 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ e.g. typing *`help`* and pressing kbd:[Enter] will open the help window.

Format: `help`

=== Adding a Friend: `add` [since v1.2]
=== Adding a person: `add OR a`

Adds a person to CollegeZone +
Format: `add n/NAME p/PHONE_NUMBER */LEVEL_OF_FRIENDSHIP b/BIRTHDAY u/UNIT_NUMBER [cca/CCA]... [t/TAG]...`

Format: `add n/NAME p/PHONE_NUMBER */LEVEL_OF_FRIENDSHIP b/BIRTHDAY u/UNIT_NUMBER [cca/CCA]... [t/TAG]...` +
`OR` +
`a n/NAME p/PHONE_NUMBER */LEVEL_OF_FRIENDSHIP b/BIRTHDAY u/UNIT_NUMBER [cca/CCA]... [t/TAG]...`
****
* `LEVEL_OF_FRIENDSHIP` must be a positive integer ranging from 1 to 10.
****
Expand All @@ -76,18 +78,21 @@ A person can have any number of CCAs (including 0)
Examples:

* `add n/John Doe p/98765432 */9 b/21 May 1997 u/#10-12 cca/Badminton cca/Volleyball t/workout buddy`
* `add n/Betsy Crowe t/friend b/21 12 1994 u/01-10 p/1234567 */1 t/OwesMoney`
* `a n/Betsy Crowe t/friend b/21 12 1994 u/01-10 p/1234567 */1 t/OwesMoney`

=== Listing all friends : `list`
=== Listing all Persons : `list OR l`

Shows a list of all persons in CollegeZone. +
Format: `list`

=== Editing a Friend : `edit` [since v1.2]
Format: `list OR l`

=== Editing a Person : `edit OR e` [since v1.2]

Edits an existing person in CollegeZone. +
Format: `edit INDEX [n/NAME] [p/PHONE] [u/UNIT_NUMBER] [*/LEVEL_OF_FRIENDSHIP] [b/BIRTHDAY] [cca/CCA]... [t/TAG]...`

Format: `edit INDEX [n/NAME] [p/PHONE] [u/UNIT_NUMBER] [*/LEVEL_OF_FRIENDSHIP] [b/BIRTHDAY] [cca/CCA]... [t/TAG]...` +
`OR` +
`e INDEX [n/NAME] [p/PHONE] [u/UNIT_NUMBER] [*/LEVEL_OF_FRIENDSHIP] [b/BIRTHDAY] [cca/CCA]... [t/TAG]...`
****
* Edits the person at the specified `INDEX`. The index refers to the index number shown in the last person listing. The index *must be a positive integer* 1, 2, 3, ...
* At least one of the optional fields must be provided.
Expand All @@ -100,10 +105,10 @@ Examples:

* `edit 1 p/91234567 */10` +
Edits the phone number and level of friendship of the 1st person to be `91234567` and `10` respectively.
* `edit 2 n/Betsy Crower t/` +
* `e 2 n/Betsy Crower t/` +
Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags.

=== Locating persons by name: `find` `[since v1.1]`
=== Locating Persons by name: `find OR f` `[since v1.1]`

Finds persons whose names contain any of the given keywords. +
Format: `find [n/KEYWORDS] [t/]` or `find [n/] [t/KEYWORDS]`
Expand All @@ -121,7 +126,7 @@ Examples:

* `find n/John t/` +
Returns `john` and `John Doe`
* `find n/Betsy Tim John t/` +
* `f n/Betsy Tim John t/` +
Returns any person having names `Betsy`, `Tim`, or `John`
* `find n/ t/friends` +
Returns any person having tags `friends`
Expand All @@ -145,7 +150,7 @@ Returns `John's RA`
* `find Betsy` +
Returns `Betsy's RA`

=== Deleting a person : `delete`
=== Deleting a person : `delete OR d`

Deletes the specified person from CollegeZone. +
Format: `delete INDEX`
Expand All @@ -162,10 +167,10 @@ Examples:
`delete 2` +
Deletes the 2nd person in CollegeZone.
* `find Betsy` +
`delete 1` +
`d 1` +
Deletes the 1st person in the results of the `find` command.

=== Selecting a person : `select`
=== Selecting a person : `select OR s`

Selects the person identified by the index number used in the last person listing. +
Format: `select INDEX`
Expand All @@ -182,10 +187,10 @@ Examples:
`select 2` +
Selects the 2nd person in CollegeZone.
* `find Betsy` +
`select 1` +
`s 1` +
Selects the 1st person in the results of the `find` command.

=== Meeting a person : `meet`
=== Meeting a person : `meet OR m`

Selects the person identified by the index number used in the last person listing. +
Format: `meet INDEX [d/MEETDATE]`
Expand Down Expand Up @@ -246,6 +251,103 @@ Edits the reminder text of the 4th reminder to be `CS2103 exam coming in 1 week`
Edits the reminder text and datetime of the 2nd person to be `water plants` and `tmr 7am` respectively.

=== Deleting a Reminder: `-r` [v1.4]


=== Adding a Goal: `+goal OR +g OR addgoal` [Coming v1.3]
Adds a goal to CollegeZone and is reflected in the Goals Page. +

Format: `+goal impt/IMPORTANCE_LEVEL text/GOAL_TEXT` +
`OR` +
`+g impt/IMPORTANCE_LEVEL text/GOAL_TEXT` +
`OR` +
`addgoal impt/IMPORTANCE_LEVEL text/GOAL_TEXT`

[TIP]
The `IMPORTANCE_LEVEL` can only be an integer between 1 to 3. It represents the importance level of the goal to add

Examples:

* `+goal impt/3 text/lose weight!`
* `+g impt/2 text/meetup with close friends more often =)`
* `addgoal impt/1 text/learn how to bake cheesecake`

=== Editing a Goal: `~goal OR ~g OR editgoal` [Coming v1.4]
Edits an existing goal in CollegeZone. +

Format: `~goal INDEX [impt/IMPORTANCE_LEVEL] [text/GOAL_TEXT]` +
`OR` +
`~g INDEX [impt/IMPORTANCE_LEVEL] [text/GOAL_TEXT]` +
`OR` +
`editgoal INDEX [impt/IMPORTANCE_LEVEL] [text/GOAL_TEXT]`

****
* Edits the goal at the specified `INDEX`. The index refers to the index number shown in the goal page's listing. The index *must be a positive integer* 1, 2, 3, ...
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.
****

Examples:

* `~goal 2 impt/1` +
Edits the goal importance level of the 2nd reminder to be `1`.
* `~g 1 impt/3 text/learn yoga` +
Edits the goal text and importance level of the 1st person to be `learn yoga` and `1` respectively.
* `editgoal 5 text/swim at least twice a month` +
Edits the goal text of the 5th person to be `swim at least twice a month`.

=== Deleting a Goal: `-goal OR -g OR deletegoal` [v1.4]
Deletes the specified goal from CollegeZone. +
Format: `-goal INDEX` +
`OR` +
`-g INDEX` +
`OR` +
`deletegoal INDEX` +

****
* Deletes the goal at the specified `INDEX`.
* The index refers to the index number shown in the most recent goal listing.
* The index *must be a positive integer* 1, 2, 3, ...
****

Examples:

* `list` +
`-goal 2` +
Deletes the 2nd goal in CollegeZone's goal page. +
* `list` +
`-g 4` +
Deletes the 4th goal in CollegeZone's goal page. +
* `l` +
`deletegoal 1` +
Deletes the 1st goal in CollegeZone's goal page.

=== Completing a Goal: `!goal OR !g OR completegoal` [v1.5]
Indicates completion of an existing goal in CollegeZone. +

Format: `!goal INDEX` +
`OR` +
`!g INDEX` +
`OR` +
`completegoal INDEX`

****
* Indicates completion of the goal at the specified `INDEX`.
* The index refers to the index number shown in the most recent goal listing.
* The index *must be a positive integer* 1, 2, 3, ...
****

Examples:

* `list` +
`!goal 2` +
Indicates completion of the 2nd goal in CollegeZone's goal page. +
* `list` +
`!g 4` +
Indicates completion of the 4th goal in CollegeZone's goal page. +
* `l` +
`completegoal 1` +
Indicates completion of the 1st goal in CollegeZone's goal page.

=== Listing entered commands : `history`

Lists all the commands that you have entered in reverse chronological order. +
Expand All @@ -264,7 +366,7 @@ Format: `undo`

[NOTE]
====
Undoable commands: those commands that modify CollegeZone's content (`add`, `delete`, `edit`, `clear`, `+r`, `~r` and `-r`).
Undoable commands: those commands that modify CollegeZone's content (`add`, `delete`, `edit`, `clear`, `+goal`, `-goal`, `~goal`).
====

Examples:
Expand Down Expand Up @@ -335,18 +437,38 @@ _{explain how the user can enable/disable data encryption}_
== Command Summary

* *Add* `add n/NAME p/PHONE_NUMBER */LEVEL_OF_FRIENDSHIP b/BIRTHDAY u/UNIT_NUMBER [cca/CCA]... [t/TAG]...` +
e.g. `add n/James Ho p/22224444 */3 b/14th 3 1995 u/01-111 cca/Choir t/friend t/colleague`
* *Clear* : `clear`
* *Delete* : `delete INDEX` +
OR `a n/NAME p/PHONE_NUMBER */LEVEL_OF_FRIENDSHIP b/BIRTHDAY u/UNIT_NUMBER [cca/CCA]... [t/TAG]...` +
e.g. `add n/James Ho p/22224444 */3 b/14-3-1995 u/01-111 cca/Choir t/friend t/colleague`
* *Clear* : `clear` OR `c`
* *Delete* : `delete INDEX` OR `d INDEX`
e.g. `delete 3`
* *Edit* : `edit INDEX [n/NAME] [p/PHONE_NUMBER] [*/LEVEL_OF_FRIENDSHIP] [b/BIRTHDAY] [u/UNIT_NUMBER] [cca/CCA]... [t/TAG]...` +
OR `e INDEX [n/NAME] [p/PHONE_NUMBER] [*/LEVEL_OF_FRIENDSHIP] [b/BIRTHDAY] [u/UNIT_NUMBER] [cca/CCA]... [t/TAG]...` +
e.g. `edit 2 n/James Lee cca/waterpolo`
* *Find* : `find KEYWORD [MORE_KEYWORDS]` +
e.g. `find James Jake`
* *List* : `list`
* *Help* : `help`
* *Select* : `select INDEX` +
e.g.`select 2`
* *History* : `history`
* *List* : `list` OR `l`
* *Help* : `help` or `h`
* *Select* : `select INDEX` OR `s INDEX`
e.g. `select 2`
* *History* : `history` OR `h`
* *Undo* : `undo`
* *Redo* : `redo`
* *Add Goal* : `+goal impt/IMPORTANCE_LEVEL text/GOAL_TEXT` +
OR `+g impt/IMPORTANCE_LEVEL text/GOAL_TEXT` +
OR `addgoal impt/IMPORTANCE_LEVEL text/GOAL_TEXT` +
e.g. `+goal impt/3 text/lose weight!`
* *Edit Goal* : `~goal INDEX [impt/IMPORTANCE_LEVEL] [text/GOAL_TEXT]` +
OR `~g INDEX [impt/IMPORTANCE_LEVEL] [text/GOAL_TEXT]` +
OR `editgoal INDEX [impt/IMPORTANCE_LEVEL] [text/GOAL_TEXT]` +
e.g. `~goal 2 impt/1`

* *Delete Goal* : `-goal INDEX` +
OR `-g INDEX` +
OR `deletegoal INDEX` +
e.g. `-goal 2`

* *Complete Goal* : `!goal INDEX` +
OR `!g INDEX` +
OR `completegoal INDEX` +
e.g. `!goal INDEX`
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/commons/core/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ public class Messages {
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_RA_LISTED_OVERVIEW = "%1$d Searched Persons and "
+ "their Resident Assistant(s) (RA) listed!";

}
10 changes: 10 additions & 0 deletions src/main/java/seedu/address/logic/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ public static String getMessageForPersonListShownSummary(int displaySize) {
return String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, displaySize);
}

/**
* Constructs a feedback message to summarise an operation that displayed a listing of Resident Assistants (RA).
*
* @param displaySize used to generate summary
* @return summary message for RA displayed
*/
public static String getMessageForRaShownSummary(int displaySize) {
return String.format(Messages.MESSAGE_RA_LISTED_OVERVIEW, displaySize);
}

/**
* Executes the command and returns the result message.
*
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/seedu/address/logic/commands/SeekRaCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package seedu.address.logic.commands;

import seedu.address.model.person.UnitNumberContainsKeywordsPredicate;

/**
* Finds and lists the Resident Assistant (RA) of an individual RC Student
* in address book whose name contains any of the argument keywords.
* Keyword matching is case sensitive.
*/
public class SeekRaCommand extends Command {

public static final String COMMAND_WORD = "seek";

public static final String COMMAND_ALIAS = "sk";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Seeks the Resident Assistant (RA) of an individual RC student whose name contain any of "
+ "the specified keywords (case-sensitive) and displays them as a list with index numbers.\n"
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " alice bob charlie";

private final UnitNumberContainsKeywordsPredicate predicate;

public SeekRaCommand(UnitNumberContainsKeywordsPredicate predicate) {
this.predicate = predicate;
}

@Override
public CommandResult execute() {
model.updateFilteredPersonList(predicate);
return new CommandResult(getMessageForRaShownSummary(model.getFilteredPersonList().size()));
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof SeekRaCommand // instanceof handles nulls
&& this.predicate.equals(((SeekRaCommand) other).predicate)); // state check
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import seedu.address.logic.commands.ListCommand;
import seedu.address.logic.commands.MeetCommand;
import seedu.address.logic.commands.RedoCommand;
import seedu.address.logic.commands.SeekRaCommand;
import seedu.address.logic.commands.SelectCommand;
import seedu.address.logic.commands.UndoCommand;
import seedu.address.logic.parser.exceptions.ParseException;
Expand Down Expand Up @@ -86,6 +87,12 @@ public Command parseCommand(String userInput) throws ParseException {
case FindCommand.COMMAND_ALIAS:
return new FindCommandParser().parse(arguments);

case SeekRaCommand.COMMAND_WORD:
return new SeekRaCommandParser().parse(arguments);

case SeekRaCommand.COMMAND_ALIAS:
return new SeekRaCommandParser().parse(arguments);

case ListCommand.COMMAND_WORD:
return new ListCommand();

Expand Down
36 changes: 36 additions & 0 deletions src/main/java/seedu/address/logic/parser/SeekRaCommandParser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import java.util.Arrays;

import seedu.address.logic.commands.SeekRaCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.UnitNumberContainsKeywordsPredicate;

/**
* Parses input arguments and creates a new SeekRaCommand object
*/
public class SeekRaCommandParser implements Parser<SeekRaCommand> {

/**
* Parses the given {@code String} of arguments in the context of the SeekRaCommand
* and returns an SeekRaCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public SeekRaCommand parse(String args) throws ParseException {

String trimmedArgs = args.trim();
if (trimmedArgs.isEmpty()) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, SeekRaCommand.MESSAGE_USAGE));
}

trimmedArgs = trimmedArgs + " " + "RA";

String[] nameKeywords = (trimmedArgs.split("\\s+"));

return new SeekRaCommand(new UnitNumberContainsKeywordsPredicate(Arrays.asList(nameKeywords)));
}

}
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/model/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public void setPersons(List<Person> persons) throws DuplicatePersonException {
this.persons.setPersons(persons);
}

public void setCcas(Set<Cca> ccas) { this.ccas.setCcas(ccas); }
public void setCcas(Set<Cca> ccas) {
this.ccas.setCcas(ccas); }

public void setTags(Set<Tag> tags) {
this.tags.setTags(tags);
Expand Down
Loading

0 comments on commit 86a90e6

Please sign in to comment.