Skip to content

Commit

Permalink
Fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Nijnxw committed Oct 6, 2020
1 parent a5ea45a commit 2b1c530
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 34 deletions.
2 changes: 0 additions & 2 deletions src/main/java/seedu/address/logic/commands/ListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";

public static final String MESSAGE_SUCCESS = "Listed all persons";


@Override
public CommandResult execute(Model model) {
requireNonNull(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public class ViewLsnCommand extends Command {
private final GrpContainsKeywordPredicate grpPredicate;
private final LsnContainsKeywordPredicate lsnPredicate;

public ViewLsnCommand(GrpContainsKeywordPredicate grpPredicate, LsnContainsKeywordPredicate lsnPredicate) {
/**
* Creates a ViewLsnCommand to view the specified {@code Lesson}
*/
public ViewLsnCommand(GrpContainsKeywordPredicate grpPredicate,
LsnContainsKeywordPredicate lsnPredicate) {
this.grpPredicate = grpPredicate;
this.lsnPredicate = lsnPredicate;
}
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/seedu/address/logic/parser/SerenityParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import seedu.address.logic.commands.*;
import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.AddGrpCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.EditCommand;
import seedu.address.logic.commands.ExitCommand;
import seedu.address.logic.commands.FindCommand;
import seedu.address.logic.commands.HelpCommand;
import seedu.address.logic.commands.ListCommand;
import seedu.address.logic.commands.ViewGrpCommand;
import seedu.address.logic.commands.ViewLsnCommand;
import seedu.address.logic.parser.exceptions.ParseException;

/**
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
import javafx.collections.transformation.FilteredList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.commons.core.LogsCenter;
import seedu.address.model.group.*;
import seedu.address.model.group.Group;
import seedu.address.model.group.Lesson;
import seedu.address.model.group.Student;
import seedu.address.model.group.StudentInfo;
import seedu.address.model.group.UniqueLessonList;
import seedu.address.model.group.UniqueStudentInfoList;
import seedu.address.model.group.UniqueStudentList;
import seedu.address.model.person.Person;

/**
Expand Down Expand Up @@ -51,7 +57,7 @@ public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs
filteredPersons = new FilteredList<>(this.addressBook.getPersonList());
filteredGroups = new FilteredList<>(this.serenity.getGroupList());
students = new ArrayObservableList<>(new UniqueStudentList().asUnmodifiableObservableList());
lessons = new ArrayObservableList<>(new UniqueLessonList().asUnmodifiableObservableList());
lessons = new ArrayObservableList<>(new UniqueLessonList().asUnmodifiableObservableList());
filteredLessons = new FilteredList<>(new UniqueLessonList().asUnmodifiableObservableList());
studentsInfo = new ArrayObservableList<>(new UniqueStudentInfoList().asUnmodifiableObservableList());
}
Expand All @@ -72,7 +78,7 @@ public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs
filteredPersons = new FilteredList<>(this.addressBook.getPersonList());
filteredGroups = new FilteredList<>(this.serenity.getGroupList());
students = new ArrayObservableList<>(new UniqueStudentList().asUnmodifiableObservableList());
lessons = new ArrayObservableList<>(new UniqueLessonList().asUnmodifiableObservableList());
lessons = new ArrayObservableList<>(new UniqueLessonList().asUnmodifiableObservableList());
filteredLessons = new FilteredList<>(new UniqueLessonList().asUnmodifiableObservableList());
studentsInfo = new ArrayObservableList<>(new UniqueStudentInfoList().asUnmodifiableObservableList());
}
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/seedu/address/model/group/Lesson.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package seedu.address.model.group;

import javafx.collections.ObservableList;

import static seedu.address.commons.util.AppUtil.checkArgument;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.util.Collections;
import java.util.Set;
import javafx.collections.ObservableList;

/**
* Represents a tutorial class in serenity. Guarantees: details are present and not null, field values are validated,
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/seedu/address/model/group/UniqueStudentInfoList.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package seedu.address.model.group;

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.util.Iterator;
import java.util.List;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.address.model.group.exceptions.DuplicateGroupException;
import seedu.address.model.group.exceptions.DuplicateStudentInfoException;
import seedu.address.model.group.exceptions.StudentInfoNotFoundException;

import java.util.Iterator;
import java.util.List;

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

/**
* A list of Students Info that enforces uniqueness between its elements and does not allow nulls.
* A Student Info is considered unique by comparing using {@code StudentInfo#equal(Object)}.
Expand Down Expand Up @@ -41,6 +41,16 @@ public void add(StudentInfo toAdd) {
internalList.add(toAdd);
}

/**
* Removes the equivalent student info from the list. The student info must exist in the list.
*/
public void remove(StudentInfo toRemove) {
requireNonNull(toRemove);
if (!internalList.remove(toRemove)) {
throw new StudentInfoNotFoundException();
}
}

public int size() {
return internalList.size();
}
Expand All @@ -65,16 +75,6 @@ public void setStudentInfo(StudentInfo target, StudentInfo editedStudentInfo) {
internalList.set(index, editedStudentInfo);
}

/**
* Removes the equivalent student info from the list. The student info must exist in the list.
*/
public void remove(StudentInfo toRemove) {
requireNonNull(toRemove);
if (!internalList.remove(toRemove)) {
throw new StudentInfoNotFoundException();
}
}

public void setStudentInfo(UniqueStudentInfoList replacement) {
requireNonNull(replacement);
internalList.setAll(replacement.internalList);
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/seedu/address/model/util/SampleDataUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.ReadOnlySerenity;
import seedu.address.model.Serenity;
import seedu.address.model.group.*;
import seedu.address.model.group.Group;
import seedu.address.model.group.Lesson;
import seedu.address.model.group.Student;
import seedu.address.model.group.StudentInfo;
import seedu.address.model.group.UniqueLessonList;
import seedu.address.model.group.UniqueStudentInfoList;
import seedu.address.model.group.UniqueStudentList;
import seedu.address.model.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/seedu/address/storage/JsonAdaptedGroup.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package seedu.address.storage;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.model.group.*;
import seedu.address.model.group.Group;
import seedu.address.model.group.Lesson;
import seedu.address.model.group.Student;
import seedu.address.model.group.UniqueLessonList;
import seedu.address.model.group.UniqueStudentInfoList;
import seedu.address.model.group.UniqueStudentList;

/**
* Jackson-friendly version of {@link Group}.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/ui/StudentInfoListPanel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package seedu.address.ui;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ListCell;
Expand All @@ -8,8 +10,6 @@
import seedu.address.commons.core.LogsCenter;
import seedu.address.model.group.StudentInfo;

import java.util.logging.Logger;

/**
* Panel containing the list of student information.
*/
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/seedu/address/logic/commands/AddCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import seedu.address.model.group.Group;
import seedu.address.model.group.Lesson;
import seedu.address.model.group.Student;
import seedu.address.model.group.StudentInfo;
import seedu.address.model.person.Person;
import seedu.address.testutil.PersonBuilder;

Expand Down Expand Up @@ -198,6 +199,16 @@ public void updateLessonList() {
throw new AssertionError("This method should not be called.");
}

@Override
public void updateFilteredLessonList(Predicate<Lesson> predicate) {
throw new AssertionError("This method should not be called.");
}

@Override
public void updateStudentInfoList() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<Group> getFilteredGroupList() {
throw new AssertionError("This method should not be called.");
Expand All @@ -212,6 +223,16 @@ public ObservableList<Student> getStudentList() {
public ObservableList<Lesson> getLessonList() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<Lesson> getFilteredLessonList() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<StudentInfo> getStudentInfoList() {
throw new AssertionError("This method should not be called.");
}
}

/**
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/seedu/address/logic/commands/AddGrpCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import seedu.address.model.group.Group;
import seedu.address.model.group.Lesson;
import seedu.address.model.group.Student;
import seedu.address.model.group.StudentInfo;
import seedu.address.model.person.Person;
import seedu.address.testutil.GroupBuilder;

Expand Down Expand Up @@ -199,6 +200,16 @@ public void updateLessonList() {
throw new AssertionError("This method should not be called.");
}

@Override
public void updateFilteredLessonList(Predicate<Lesson> predicate) {
throw new AssertionError("This method should not be called.");
}

@Override
public void updateStudentInfoList() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<Group> getFilteredGroupList() {
throw new AssertionError("This method should not be called.");
Expand All @@ -213,6 +224,16 @@ public ObservableList<Student> getStudentList() {
public ObservableList<Lesson> getLessonList() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<Lesson> getFilteredLessonList() {
throw new AssertionError("This method should not be called.");
}

@Override
public ObservableList<StudentInfo> getStudentInfoList() {
throw new AssertionError("This method should not be called.");
}
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/test/java/seedu/address/testutil/GroupBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
import java.util.Set;

import seedu.address.commons.util.CsvUtil;
import seedu.address.model.group.*;
import seedu.address.model.group.Group;
import seedu.address.model.group.Lesson;
import seedu.address.model.group.Student;
import seedu.address.model.group.StudentInfo;
import seedu.address.model.group.UniqueLessonList;
import seedu.address.model.group.UniqueStudentInfoList;
import seedu.address.model.group.UniqueStudentList;

/**
* A utility class to help with building Group objects.
Expand Down

0 comments on commit 2b1c530

Please sign in to comment.