forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comparators and static for consistent reference -- JUNI now works
- Loading branch information
1 parent
57eecdb
commit 0ffa824
Showing
7 changed files
with
92 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/staffconnect/model/person/comparators/ModuleComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package staffconnect.model.person.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import staffconnect.model.person.Person; | ||
|
||
/** | ||
* Represents a Comparator for a Person's Module code in the staff book. | ||
*/ | ||
public class ModuleComparator implements Comparator<Person> { | ||
|
||
public static final ModuleComparator MODULE_COMPARATOR = new ModuleComparator(); | ||
|
||
@Override | ||
public int compare(Person p1, Person p2) { | ||
return p1.getModule().toString().compareToIgnoreCase(p2.getModule().toString()); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/staffconnect/model/person/comparators/NameComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package staffconnect.model.person.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import staffconnect.model.person.Person; | ||
|
||
/** | ||
* Represents a Comparator for a Person's Name in the staff book. | ||
*/ | ||
public class NameComparator implements Comparator<Person> { | ||
|
||
public static final NameComparator NAME_COMPARATOR = new NameComparator(); | ||
@Override | ||
public int compare(Person p1, Person p2) { | ||
return p1.getName().toString().compareToIgnoreCase(p2.getName().toString()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/staffconnect/model/person/comparators/PhoneComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package staffconnect.model.person.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import staffconnect.model.person.Person; | ||
|
||
/** | ||
* Represents a Comparator for a Person's Phone number in the staff book. | ||
*/ | ||
public class PhoneComparator implements Comparator<Person> { | ||
|
||
public static final PhoneComparator PHONE_COMPARATOR = new PhoneComparator(); | ||
|
||
@Override | ||
public int compare(Person p1, Person p2) { | ||
return p1.getPhone().toString().compareToIgnoreCase(p2.getPhone().toString()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/staffconnect/model/person/comparators/VenueComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package staffconnect.model.person.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import staffconnect.model.person.Person; | ||
|
||
/** | ||
* Represents a Comparator for a Person's Venue in the staff book. | ||
*/ | ||
public class VenueComparator implements Comparator<Person> { | ||
|
||
public static final VenueComparator VENUE_COMPARATOR = new VenueComparator(); | ||
|
||
@Override | ||
public int compare(Person p1, Person p2) { | ||
return p1.getVenue().toString().compareToIgnoreCase(p2.getVenue().toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters