Skip to content

Commit

Permalink
Edit equals() method in localcourse comparators
Browse files Browse the repository at this point in the history
  • Loading branch information
dlathyun committed Oct 26, 2023
1 parent a3c94f1 commit 15770d9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public boolean equals(Object other) {
}

LocalCourseSortCommand otherLocalCourseSortCommand = (LocalCourseSortCommand) other;
return comparator.toString().equals(otherLocalCourseSortCommand.comparator.toString());
return comparator.equals(otherLocalCourseSortCommand.comparator);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class LocalCourseSortCommandParser implements Parser<LocalCourseSortCommand> {
/**
* Pqrses the given {@code String} of arguments in the context of the LocalCourseSortCommand
* Parses the given {@code String} of arguments in the context of the LocalCourseSortCommand
* and returns a LocalCourseSortCommand object for execution.
*
* @throws ParseException if the user input does not conform the expected format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public SeplendidModelManager(ReadOnlyLocalCourseCatalogue localCourseCatalogue,
}

/**
* Contructs Seplendid Model Manager.
* Constructs Seplendid Model Manager.
*/
public SeplendidModelManager() {
this(new LocalCourseCatalogue(), new UserPrefs(), new PartnerCourseCatalogue(), new UniversityCatalogue(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,19 @@ public int compare(LocalCourse localCourse, LocalCourse otherLocalCourse) {
public String toString() {
return "localcode";
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

if (!(other instanceof LocalCourseComparatorByLocalCode)) {
return false;
}

LocalCourseComparatorByLocalCode otherLocalCourseComparatorByLocalCode =
(LocalCourseComparatorByLocalCode) other;
return this.toString().equals(otherLocalCourseComparatorByLocalCode.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@ public int compare(LocalCourse localCourse, LocalCourse otherLocalCourse) {
public String toString() {
return "localname";
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

if (!(other instanceof LocalCourseComparatorByLocalName)) {
return false;
}

LocalCourseComparatorByLocalName otherLocalCourseComparatorByLocalName =
(LocalCourseComparatorByLocalName) other;
return this.toString().equals(otherLocalCourseComparatorByLocalName.toString());
}
}

0 comments on commit 15770d9

Please sign in to comment.