diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md
index 8f70c6c48e0..dbbaf21d67c 100644
--- a/docs/DeveloperGuide.md
+++ b/docs/DeveloperGuide.md
@@ -303,11 +303,11 @@ Execution of the `AddClassCommand`
* Alternative 1 (current choice): Find Tutorial Classes by selecting all classes with classcodes matching the search keyword
* Pros: Shorter keyword to type, therefore increasing user typing speed. User is also able to find multiple classes
* Cons: Lower Accuracy in searching for a specific class, having to search through multiple classes
-
+
* Alternative 2: Find tutorial class by exact class code
* Pros: Higher Accuracy in search
* Cons: Takes longer for user to type commands, less user-friendly
-
+
#### Aspect: Student and Tutorial Class lists
* Alternative 1 (current choice): Use two separate lists to store students and tutorial classes
* Pros: Faster, simpler command executions for student and tutorial class commands.
@@ -439,7 +439,7 @@ The class `Classmate` facilitates all operations related to tutorial groups. It
tutorial group list to be displayed to the user. TutorialGroups are identical only if all its attributes, Group name, Class code and Group type are the same.
The `Classmate` contains a summary of all the logic of the tutorial group commands which can be split into two parts,
adding tutorial groups to tutorial classes (e.g. `AddGroupCommand`) executed on the `UniqueTutorialGroupList`, and adding students to tutorial groups.
-Displaying of groups in the UI has not been implemented yet.
+Displaying of groups in the UI has not been implemented yet.
The following operations are implemented:
* `Classmate#hasTutorialGroup(TutorialGroup tutorialGroup)` - Checks if tutorial group is in ClassMATE
@@ -476,7 +476,7 @@ it checks whether the specified tutorial class exists before invoking the `model
* Pros: Simpler to implement, without the use of multiple lists to store tutorial groups of different types ("OP1" or "OP2").
Storing tutorial groups as arrays in JSON is less complicated.
* Cons: Searching or filtering the list of tutorial groups by group types may take a longer time.
-
+
* Alternative 2: Use multiple lists to store groups of different categories (by class or type)
* Pros: Faster when performing find functions and groups are better organised.
* Cons: Splitting groups based on a category makes it harder to extend to support filtering groups with a different category from what is implemented. Deleting of groups may also become more complicated.
@@ -519,9 +519,9 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
| `* * *` | user | add a new student | |
| `* * *` | user | view a student's details | easily check the details and progress of the students |
| `* * *` | user | add a new class | |
-| `* * ` | user | add a class schedule | plan my week in advance
+| `* * ` | user | add a class schedule | plan my week in advance |
| `* * *` | user | view a class' details | easily check the details of a particular class |
-| `* * *` | user | delete a student | remove entries that I no longer need
+| `* * *` | user | delete a student | remove entries that I no longer need |
| `* * *` | user | delete a class | remove classes that I no longer need |
| `* * *` | user | find a student by name | locate details of students without having to go through the entire list |
| `* * *` | user | find a class by code | locate details of a class without having to go through the entire list |
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index b5a0da2b5e2..aaef91bd12b 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -4,11 +4,11 @@ title: User Guide
---
ClassMATE is a **desktop app designed for CS2101 tutors to manage student contacts and organize them into their tutorial classes and groups, as well as
-other administrative matters including recording of students' class participation. It is optimized for use via a Command Line Interface** (CLI) while
+other administrative matters including recording of students' class participation. It is optimized for use via a Command Line Interface** (CLI) while
still having the benefits of a Graphical User Interface (GUI). If you can type fast, ClassMATE can get your contact management tasks done faster than traditional GUI apps.
-This guide will get you started on how to create students, classes and groups,
-assigning students to their respective classes and groups and covers other functionalities for users
+This guide will get you started on how to create students, classes and groups,
+assigning students to their respective classes and groups and covers other functionalities for users
such as filtering and searching students. Finally, it will also guide
you through on how you can add class participation marks for your students.
@@ -44,24 +44,42 @@ We hope you find this User Guide helpful in using ClassMATE!
1. Ensure you have Java `11` or above installed in your Computer. (Go to [this website](https://codejava.net/java-se/download-and-install-java-11-openjdk-and-oracle-jdk) and follow the instructions to download and install Oracle JDK 11, which is _basically_ Java 11.)
1. Download the latest `classmate.jar` from [here](https://github.com/AY2122S1-CS2103T-W15-1/tp/releases).
1. Copy the file to the folder you want to use as the _home folder_ for your ClassMATE.
-1. Double-click the file to start the app. The GUI similar to the below should appear in a few seconds. Note how the app contains some sample data.
+1. Double-click the file to start the app. The GUI similar to the image below should appear in a few seconds. Note how the app contains some sample data.

1. Type the command in the **Command-Line Input** and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
- Some example commands you can try:
- * **`liststu`** : Lists all students.
-
- * **`addstu n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 c/G06`**: Adds a student named `John Doe` to ClassMATE.
-
- * **`deletestu 3`**: Deletes the 3rd student shown in the current list.
-
- * **`clear`** : Deletes all students.
-
- * **`exit`** : Exits the app.
-1. Refer to the [Features](#features) below for details of each command.
+1. Refer to the [Features](#Features) below for details of each command.
--------------------------------------------------------------------------------------------------------------------
-## Features
+## CLI Tutorial
+
+In this section, you will familiarize yourself with the use of CLI to facilitate your experience when using ClassMATE.
+All commands would be typed in the **Command-Line Input** located at the top of the user interface as shown in the image below.
+
+
+
+Once you have familiarised yourself with the layout of the application, try out some example commands!
+
+Some example commands you can try:
+* **`liststu`** : Lists all students. All students currently stored in ClassMATE will be displayed in the **Student Panel**.
+
+* **`addc c/G99 s/Tuesday 2 to 4pm, Friday 2 to 4pm`**: Adds a tutorial class with the code `G99`. The **Tutorial Class Panel**
+should reflect the updated list of tutorial classes including your new class, `G99`.
+
+* **`addstu n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 c/G99`**: Adds a student named `John Doe` to ClassMATE.
+The **Student Panel** Should reflect the updated list of students including your new student, `John Doe`.
+
+* **`deletestu 3`**: Deletes the 3rd student shown in the current list.
+
+* **`clear`** : Deletes all students.
+
+* **`exit`** : Exits the app.
+
+Once you have attempted these commands, you're ready to go!
+
+### Command format
+
+This section will help you understand the syntax used to describe the command features in this guide better.
**:information_source: Notes about the command format:**
@@ -86,16 +104,27 @@ We hope you find this User Guide helpful in using ClassMATE!
-### Viewing help : `help`
+## Features
-Shows a message explaning how to access the help page.
+Here, you can find instructions on how to use ClassMATE's various features. The features are divided into three main subsections,
+each covering different subsections, namely the Student features, Tutorial Class Features and Tutorial Group Features. Each
+subsection will provide you with an overview of the section, followed by the individual commands' formats, instructions on how to use them,
+examples of use and the expected outcome of executing these commands.
-
-Format: `help`
## Student Commands
+This part of the guide covers all the features you can use to manage student information.These features include:
+1. Add a new Student
+1. Edit and existing Student
+1. View a student's details
+1. Delete a student
+1. List all students
+1. Find students by name
+1. Add Class participation marks
+1. Delete all students
+
### Adding a student: `addstu`
Adds a student to ClassMATE.
@@ -251,11 +280,14 @@ Examples:
Deletes a class from ClassMATE
+
Format: `deletec INDEX`
* Deletes the class at the specified INDEX.
* The index refers to the index number shown in the displayed list of classes.
The index **must be a positive integer** 1, 2, 3, …
+* Students assinged to that class will have thier clascode replaced by `No Class`. They can be edited
+to be added to another class.
Examples:
* `listc` followed by `deletec 2` deletes the 2nd class in the list of classes.
@@ -263,6 +295,13 @@ Examples:
## Tutorial Group Commands
+This part of the guide covers all the features you can use to manage Groups within a tutorial class. These features include:
+1. Add a group
+1. View all groups in a class
+1. Delete a group
+1. Add a student to a group
+1. Remove a student from a group
+
### Adding a group: `addcg`
Adds a group to a particular tutorial class
@@ -308,7 +347,11 @@ Format: `deletecg INDEX`
Examples:
* `listg n/G06` followed by `deleteg 2` deletes the 2nd group in the list of group in class G06
+<<<<<<< HEAD
### Adding Student to a group: `addsg`
+=======
+### Adding Student to a group: `addsg` [Coming Soon]
+>>>>>>> 26bc37482e0c6a7ebb59d6753eae335409cadb55
Adds student to a group.
@@ -334,6 +377,15 @@ Example:
* `liststu c/G06`shows that Betsy is a student in class G06 with Index 1.
`deletesg 1 g/A c/G06 type/OP1` then removes Betsy from OP1 Group A in class G06
+## Additional Commands
+
+### Viewing help : `help`
+
+Shows a message explaning how to access the help page.
+
+
+
+Format: `help`
### Exiting the program : `exit`
@@ -378,8 +430,13 @@ Action | Format, Examples
**View class** | `viewc INDEX`
e.g., `listc` followed by `viewc 3`
**List all classes** | `listc`
**Find class** | `findc KEYWORD [MORE_KEYWORDS]`
e.g., `findc A02`
+<<<<<<< HEAD
**Add Tutorial Group** | `addcg gn/GROUP_NAME c/CLASS_CODE type/TYPE`
e.g.,`addcg gn/1 c/G11 type/OP1`
**Delete Tutorial Group** | `deletecg INDEX`
e.g., `deletecg 2`
+=======
+**Add Tutorial Group** | `addcg gn/GROUP_NAME c/CLASS_CODE type/TYPE`
e.g.,`addsg n/Betsy tp/OP1 g/A`
+**Delete Tutorial Group** | `deletecg INDEX`
e.g., `deletecg 2`
+>>>>>>> 26bc37482e0c6a7ebb59d6753eae335409cadb55
**List Tutorial Group** | `listg`
**Add Student to Group** | `addsg INDEX g/GROUP_NAME c/CLASSCODE type/TYPE`
e.g., `addsg 1 gn/Group 1 c/G01 type/OP1`
**Delete Student from Group** | `deletesg INDEX g/GROUP_NAME c/CLASSCODE type/TYPE`
e.g., `deletesg 1 gn/Group 1 c/G01 type/OP1`
@@ -390,3 +447,7 @@ Action | Format, Examples
**Java 11** | Java is a programming language, more on it [here](https://en.wikipedia.org/wiki/Java_(programming_language)).
**JSON** | a JSON file is an open standard file format, more on it [here](https://en.wikipedia.org/wiki/JSON).
+**CLI** | Command Line Interface (CLI) enables users to interact with a program by typing in text commands following
+visual prompts from the program.
+**GUI** | Graphical User Interface (GUI) is a system of interactive visual components that allows users to interact with
+a program through graphical icons.
diff --git a/docs/images/CommandLineInput.png b/docs/images/CommandLineInput.png
new file mode 100644
index 00000000000..a15b173ad14
Binary files /dev/null and b/docs/images/CommandLineInput.png differ
diff --git a/docs/images/DeleteCommandScreenshot.png b/docs/images/DeleteCommandScreenshot.png
new file mode 100644
index 00000000000..6e584489f98
Binary files /dev/null and b/docs/images/DeleteCommandScreenshot.png differ
diff --git a/docs/img.png b/docs/img.png
new file mode 100644
index 00000000000..a15b173ad14
Binary files /dev/null and b/docs/img.png differ
diff --git a/src/main/java/seedu/address/commons/core/Messages.java b/src/main/java/seedu/address/commons/core/Messages.java
index 94c5f7a9dca..adb2cf16db3 100644
--- a/src/main/java/seedu/address/commons/core/Messages.java
+++ b/src/main/java/seedu/address/commons/core/Messages.java
@@ -9,8 +9,9 @@ public class Messages {
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX = "The student index provided is invalid";
public static final String MESSAGE_INVALID_CLASS_DISPLAYED_INDEX = "The class index provided is invalid";
- public static final String MESSAGE_INVALID_GROUP_DISPLAYED_INDEX = "The group index provided is invalid";
public static final String MESSAGE_STUDENTS_LISTED_OVERVIEW = "%1$d students listed!";
- public static final String MESSAGE_TUTORIAL_CLASSES_LISTED_OVERVIEW = "%1$d classes listed!";
-
+ public static final String MESSAGE_TUTORIAL_CLASSES_LISTED_OVERVIEW = "%1$d tutorial classes listed!";
+ public static final String MESSAGE_TUTORIAL_GROUP_LISTED_OVERVIEW = "%1$d students from tutorial group listed!";
+ public static final String MESSAGE_CLASS_DOES_NOT_EXIST = "This class does not exist in Classmate";
+ public static final String MESSAGE_GROUP_DOES_NOT_EXIST = "This group does not exist in Classmate";
}
diff --git a/src/main/java/seedu/address/logic/commands/AddGroupCommand.java b/src/main/java/seedu/address/logic/commands/AddGroupCommand.java
index bcf52cc7d56..a940d79a7b7 100644
--- a/src/main/java/seedu/address/logic/commands/AddGroupCommand.java
+++ b/src/main/java/seedu/address/logic/commands/AddGroupCommand.java
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;
import static java.util.Objects.requireNonNull;
+import static seedu.address.commons.core.Messages.MESSAGE_CLASS_DOES_NOT_EXIST;
import static seedu.address.logic.parser.CliSyntax.PREFIX_CLASSCODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUPNUMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TYPE;
@@ -15,9 +16,9 @@ public class AddGroupCommand extends Command {
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a group to a class to Classmate. "
+ "Parameters: "
- + PREFIX_GROUPNUMBER + "GROUPNAME "
+ PREFIX_CLASSCODE + "CLASSCODE "
+ PREFIX_TYPE + "TYPE "
+ + PREFIX_GROUPNUMBER + "GROUPNUMBER "
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_GROUPNUMBER + "1 "
+ PREFIX_CLASSCODE + "G06 "
@@ -25,7 +26,6 @@ public class AddGroupCommand extends Command {
public static final String MESSAGE_SUCCESS = "New group added: %1$s";
public static final String MESSAGE_DUPLICATE_GROUP = "This group already exists in Classmate";
- public static final String MESSAGE_CLASS_NOT_EXIST = "The class does not exist in Classmate";
private final TutorialGroup toAdd;
private final TutorialClass toAddTutorialClass;
@@ -46,7 +46,7 @@ public CommandResult execute(Model model) throws CommandException {
// check if tutorial class already exists in ClassMATE
if (!model.hasTutorialClass(toAddTutorialClass)) {
- throw new CommandException(MESSAGE_CLASS_NOT_EXIST);
+ throw new CommandException(MESSAGE_CLASS_DOES_NOT_EXIST);
}
if (model.hasTutorialGroup(toAdd)) {
diff --git a/src/main/java/seedu/address/logic/commands/ViewGroupCommand.java b/src/main/java/seedu/address/logic/commands/ViewGroupCommand.java
new file mode 100644
index 00000000000..feec367db12
--- /dev/null
+++ b/src/main/java/seedu/address/logic/commands/ViewGroupCommand.java
@@ -0,0 +1,71 @@
+package seedu.address.logic.commands;
+
+import static java.util.Objects.requireNonNull;
+import static seedu.address.logic.parser.CliSyntax.PREFIX_CLASSCODE;
+import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUPNUMBER;
+import static seedu.address.logic.parser.CliSyntax.PREFIX_TYPE;
+
+import seedu.address.commons.core.Messages;
+import seedu.address.logic.commands.exceptions.CommandException;
+import seedu.address.model.Model;
+import seedu.address.model.student.GroupMemberPredicate;
+import seedu.address.model.tutorialclass.TutorialClass;
+import seedu.address.model.tutorialgroup.TutorialGroup;
+
+/**
+ * Lists all students in a tutorial group in ClassMATE given a class code, tutorial group type and tutorial group name
+ * Keyword matching is case-insensitive.
+ */
+public class ViewGroupCommand extends Command {
+
+ public static final String COMMAND_WORD = "viewg";
+
+ public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all students in a tutorial group given a class "
+ + "code, tutorial group type and tutorial group name (case-insensitive) and displays them as a list"
+ + "with index numbers.\n"
+ + "Parameters: "
+ + PREFIX_CLASSCODE + "CLASSCODE "
+ + PREFIX_TYPE + "TYPE "
+ + PREFIX_GROUPNUMBER + "GROUPNUMBER "
+ + "Example: " + COMMAND_WORD + " "
+ + PREFIX_GROUPNUMBER + "3 "
+ + PREFIX_CLASSCODE + "G06 "
+ + PREFIX_TYPE + "OP2 ";
+
+ private final TutorialGroup toView;
+ private final TutorialClass toViewTutorialClass;
+
+ /**
+ * Creates a ViewGroupCommand to show the students in the specified {@code TutorialGroup}
+ */
+ public ViewGroupCommand(TutorialGroup tutorialGroup) {
+ requireNonNull(tutorialGroup);
+ toView = tutorialGroup;
+ // new class with the same class code created to check whether it exists in ClassMATE
+ toViewTutorialClass = TutorialClass.createTestTutorialClass(toView.getClassCode());
+ }
+
+ @Override
+ public CommandResult execute(Model model) throws CommandException {
+ requireNonNull(model);
+
+ // check if tutorial class exists in ClassMATE
+ if (!model.hasTutorialClass(toViewTutorialClass)) {
+ throw new CommandException(Messages.MESSAGE_CLASS_DOES_NOT_EXIST);
+ }
+
+
+
+ model.updateFilteredStudentList(new GroupMemberPredicate(toView));
+ return new CommandResult(
+ String.format(Messages.MESSAGE_TUTORIAL_GROUP_LISTED_OVERVIEW,
+ model.getFilteredStudentList().size()));
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other == this // short circuit if same object
+ || (other instanceof ViewGroupCommand // instanceof handles nulls
+ && toView.equals(((ViewGroupCommand) other).toView)); // state check
+ }
+}
diff --git a/src/main/java/seedu/address/logic/parser/ClassmateParser.java b/src/main/java/seedu/address/logic/parser/ClassmateParser.java
index 879ff4ddbc4..303963d2616 100644
--- a/src/main/java/seedu/address/logic/parser/ClassmateParser.java
+++ b/src/main/java/seedu/address/logic/parser/ClassmateParser.java
@@ -27,6 +27,7 @@
import seedu.address.logic.commands.ListClassCommand;
import seedu.address.logic.commands.ListStudentCommand;
import seedu.address.logic.commands.ViewClassCommand;
+import seedu.address.logic.commands.ViewGroupCommand;
import seedu.address.logic.commands.ViewStudentCommand;
import seedu.address.logic.parser.exceptions.ParseException;
@@ -97,6 +98,9 @@ public Command parseCommand(String userInput) throws ParseException {
case ViewClassCommand.COMMAND_WORD:
return new ViewClassCommandParser().parse(arguments);
+ case ViewGroupCommand.COMMAND_WORD:
+ return new ViewGroupCommandParser().parse(arguments);
+
case ViewStudentCommand.COMMAND_WORD:
return new ViewStudentCommandParser().parse(arguments);
diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java
index 7d580396c46..982dc2cf463 100644
--- a/src/main/java/seedu/address/logic/parser/CliSyntax.java
+++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java
@@ -5,7 +5,7 @@
*/
public class CliSyntax {
- /* Student Prefix definitions */
+ // Student Prefix definitions
public static final Prefix PREFIX_NAME = new Prefix("n/");
public static final Prefix PREFIX_PHONE = new Prefix("p/");
public static final Prefix PREFIX_EMAIL = new Prefix("e/");
diff --git a/src/main/java/seedu/address/logic/parser/FindClassCommandParser.java b/src/main/java/seedu/address/logic/parser/FindClassCommandParser.java
index 9a1e8daaedd..3fff11c09bf 100644
--- a/src/main/java/seedu/address/logic/parser/FindClassCommandParser.java
+++ b/src/main/java/seedu/address/logic/parser/FindClassCommandParser.java
@@ -9,13 +9,13 @@
import seedu.address.model.tutorialclass.ClassCodeContainsKeywordsPredicate;
/**
- * Parses input arguments and creates a new FindCommand object
+ * Parses input arguments and creates a new FindClassCommand object
*/
public class FindClassCommandParser implements Parser {
/**
- * Parses the given {@code String} of arguments in the context of the FindCommand
- * and returns a FindCommand object for execution.
+ * Parses the given {@code String} of arguments in the context of the FindClassCommand
+ * and returns a FindClassCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public FindClassCommand parse(String args) throws ParseException {
diff --git a/src/main/java/seedu/address/logic/parser/FindStudentCommandParser.java b/src/main/java/seedu/address/logic/parser/FindStudentCommandParser.java
index b0b2b595f31..8d64b519545 100644
--- a/src/main/java/seedu/address/logic/parser/FindStudentCommandParser.java
+++ b/src/main/java/seedu/address/logic/parser/FindStudentCommandParser.java
@@ -9,13 +9,13 @@
import seedu.address.model.student.NameContainsKeywordsPredicate;
/**
- * Parses input arguments and creates a new FindCommand object
+ * Parses input arguments and creates a new FindStudentCommand object
*/
public class FindStudentCommandParser implements Parser {
/**
- * Parses the given {@code String} of arguments in the context of the FindCommand
- * and returns a FindCommand object for execution.
+ * Parses the given {@code String} of arguments in the context of the FindStudentCommand
+ * and returns a FindStudentCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public FindStudentCommand parse(String args) throws ParseException {
diff --git a/src/main/java/seedu/address/logic/parser/ViewGroupCommandParser.java b/src/main/java/seedu/address/logic/parser/ViewGroupCommandParser.java
new file mode 100644
index 00000000000..261e22f8f76
--- /dev/null
+++ b/src/main/java/seedu/address/logic/parser/ViewGroupCommandParser.java
@@ -0,0 +1,49 @@
+package seedu.address.logic.parser;
+
+import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
+import static seedu.address.logic.parser.CliSyntax.PREFIX_CLASSCODE;
+import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUPNUMBER;
+import static seedu.address.logic.parser.CliSyntax.PREFIX_TYPE;
+
+import java.util.stream.Stream;
+
+import seedu.address.logic.commands.AddGroupCommand;
+import seedu.address.logic.commands.ViewGroupCommand;
+import seedu.address.logic.parser.exceptions.ParseException;
+import seedu.address.model.student.ClassCode;
+import seedu.address.model.tutorialgroup.GroupNumber;
+import seedu.address.model.tutorialgroup.GroupType;
+import seedu.address.model.tutorialgroup.TutorialGroup;
+
+/**
+ * Parses input arguments and creates a new ViewGroupCommand object
+ */
+public class ViewGroupCommandParser implements Parser {
+
+ /**
+ * Parses the given {@code String} of arguments in the context of the ViewGroupCommand
+ * and returns a ViewGroupCommand object for execution.
+ * @throws ParseException if the user input does not conform the expected format
+ */
+ public ViewGroupCommand parse(String args) throws ParseException {
+ ArgumentMultimap argMultimap =
+ ArgumentTokenizer.tokenize(args, PREFIX_CLASSCODE, PREFIX_TYPE, PREFIX_GROUPNUMBER);
+
+ if (!arePrefixesPresent(argMultimap, PREFIX_CLASSCODE, PREFIX_TYPE, PREFIX_GROUPNUMBER)
+ || !argMultimap.getPreamble().isEmpty()) {
+ throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddGroupCommand.MESSAGE_USAGE));
+ }
+
+ GroupNumber groupNumber = ParserUtil.parseGroupName(argMultimap.getValue(PREFIX_GROUPNUMBER).get());
+ ClassCode classCode = ParserUtil.parseClassCode(argMultimap.getValue(PREFIX_CLASSCODE).get());
+ GroupType groupType = ParserUtil.parseGroupType(argMultimap.getValue(PREFIX_TYPE).get());
+
+ TutorialGroup tutorialGroup = new TutorialGroup(groupNumber, classCode, groupType);
+
+ return new ViewGroupCommand(tutorialGroup);
+ }
+
+ private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
+ return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
+ }
+}
diff --git a/src/main/java/seedu/address/model/Classmate.java b/src/main/java/seedu/address/model/Classmate.java
index a21a3e19dc8..da007a101b3 100644
--- a/src/main/java/seedu/address/model/Classmate.java
+++ b/src/main/java/seedu/address/model/Classmate.java
@@ -11,6 +11,7 @@
import seedu.address.model.tutorialclass.TutorialClass;
import seedu.address.model.tutorialclass.UniqueTutorialClassList;
import seedu.address.model.tutorialgroup.TutorialGroup;
+import seedu.address.model.tutorialgroup.UniqueTutorialGroupList;
/**
* Wraps all data at the address-book level
@@ -22,6 +23,7 @@ public class Classmate implements ReadOnlyClassmate {
private final UniqueStudentList students;
private final UniqueTutorialClassList tutorialClasses;
+ private final UniqueTutorialGroupList tutorialGroups;
/*
* The 'unusual' code block below is a non-static initialization block, sometimes used to avoid duplication
@@ -33,6 +35,7 @@ public class Classmate implements ReadOnlyClassmate {
{
students = new UniqueStudentList();
tutorialClasses = new UniqueTutorialClassList();
+ tutorialGroups = new UniqueTutorialGroupList();
}
public Classmate() {}
@@ -155,7 +158,7 @@ public void removeTutorialClass(TutorialClass key) {
* {@code key} must exist in the ClassMATE.
*/
public void removeTutorialGroup(TutorialGroup key) {
- tutorialClasses.remove(key);
+ tutorialGroups.remove(key);
}
/**
@@ -163,7 +166,7 @@ public void removeTutorialGroup(TutorialGroup key) {
*/
public boolean hasTutorialGroup(TutorialGroup tutorialGroup) {
requireNonNull(tutorialGroup);
- return tutorialClasses.contains(tutorialGroup);
+ return tutorialGroups.contains(tutorialGroup);
}
/**
@@ -171,14 +174,14 @@ public boolean hasTutorialGroup(TutorialGroup tutorialGroup) {
* The tutorial group must not already exist in the ClassMATE.
*/
public void addTutorialGroup(TutorialGroup tutorialGroup) {
- tutorialClasses.add(tutorialGroup);
+ tutorialGroups.add(tutorialGroup);
}
/**
* Sorts the tutorial groups in ClassMATE.
*/
public void sortTutorialGroups() {
- tutorialClasses.sort();
+ tutorialGroups.sort();
}
diff --git a/src/main/java/seedu/address/model/student/GroupMemberPredicate.java b/src/main/java/seedu/address/model/student/GroupMemberPredicate.java
new file mode 100644
index 00000000000..a802086cee2
--- /dev/null
+++ b/src/main/java/seedu/address/model/student/GroupMemberPredicate.java
@@ -0,0 +1,32 @@
+package seedu.address.model.student;
+
+import java.util.function.Predicate;
+
+import seedu.address.model.tutorialgroup.TutorialGroup;
+
+/**
+ * Tests that a {@code Student}'s {@code TutorialGroup} matches the given TutorialGroup.
+ */
+public class GroupMemberPredicate implements Predicate {
+ private final TutorialGroup tutorialGroup;
+
+ public GroupMemberPredicate(TutorialGroup tutorialGroup) {
+ this.tutorialGroup = tutorialGroup;
+ }
+
+ public TutorialGroup getTutorialGroup() {
+ return tutorialGroup;
+ }
+
+ @Override
+ public boolean test(Student student) {
+ return student.getTutorialGroups().contains(tutorialGroup);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other == this // short circuit if same instance
+ || other instanceof GroupMemberPredicate // instanceof handles null
+ && tutorialGroup.equals(((GroupMemberPredicate) other).getTutorialGroup()); // state check
+ }
+}
diff --git a/src/main/java/seedu/address/model/tutorialclass/ClassCodeContainsKeywordsPredicate.java b/src/main/java/seedu/address/model/tutorialclass/ClassCodeContainsKeywordsPredicate.java
index d9fa367ffb8..e0cbf40c15b 100644
--- a/src/main/java/seedu/address/model/tutorialclass/ClassCodeContainsKeywordsPredicate.java
+++ b/src/main/java/seedu/address/model/tutorialclass/ClassCodeContainsKeywordsPredicate.java
@@ -6,7 +6,7 @@
import seedu.address.commons.util.StringUtil;
/**
- * Tests that a {@code Student}'s {@code Name} matches any of the keywords given.
+ * Tests that a {@code TutorialClass}'s {@code ClassCode} matches any of the keywords given.
*/
public class ClassCodeContainsKeywordsPredicate implements Predicate {
private final List keywords;
diff --git a/src/main/java/seedu/address/model/tutorialgroup/TutorialGroupContainsKeywordsPredicate.java b/src/main/java/seedu/address/model/tutorialgroup/TutorialGroupContainsKeywordsPredicate.java
new file mode 100644
index 00000000000..8fa1e2a0797
--- /dev/null
+++ b/src/main/java/seedu/address/model/tutorialgroup/TutorialGroupContainsKeywordsPredicate.java
@@ -0,0 +1,33 @@
+package seedu.address.model.tutorialgroup;
+
+import java.util.List;
+import java.util.function.Predicate;
+
+import seedu.address.commons.util.StringUtil;
+
+/**
+ * Tests that a {@code TutorialGroup}'s {@code GroupName} matches any of the keywords given.
+ */
+public class TutorialGroupContainsKeywordsPredicate implements Predicate {
+ private final List keywords;
+
+ public TutorialGroupContainsKeywordsPredicate(List keywords) {
+ this.keywords = keywords;
+ }
+
+ @Override
+ public boolean test(TutorialGroup tutorialGroup) {
+ return keywords.stream()
+ .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(
+ tutorialGroup.getClassCode().toString(), keyword));
+ //TODO Add GroupType as a keyword
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other == this // short circuit if same object
+ || (other instanceof TutorialGroupContainsKeywordsPredicate // instanceof handles nulls
+ && keywords.equals(((TutorialGroupContainsKeywordsPredicate) other).keywords)); // state check
+ }
+
+}