public class StudentGroup extends Object implements Comparable<StudentGroup>
Constructor and Description |
---|
StudentGroup(long id,
double weight,
String name)
Create a student group
|
Modifier and Type | Method and Description |
---|---|
void |
addStudent(Student student)
Add student to this group
|
int |
compareTo(StudentGroup g) |
int |
countOfferings()
Count offerings that students of this group have
|
int |
countStudents(Long offeringId)
Count students of this group that are requesting the given offering.
|
boolean |
equals(Object o) |
double |
getAverageEnrollmentWeight(Long offeringId)
Average enrollment weight of students of this group in the given offering
|
long |
getId()
Returns student group id
|
String |
getName()
Returns student group name
|
List<Student> |
getStudents()
Return students of this group
|
double |
getWeight()
Returns student group weight
|
int |
hashCode() |
String |
toString() |
public StudentGroup(long id, double weight, String name)
id
- group unique idweight
- group weightname
- group namepublic long getId()
public double getWeight()
public List<Student> getStudents()
public int countStudents(Long offeringId)
offeringId
- offering idStudent.hasOffering(Long)
truepublic void addStudent(Student student)
student
- a student to addpublic int compareTo(StudentGroup g)
compareTo
in interface Comparable<StudentGroup>
public double getAverageEnrollmentWeight(Long offeringId)
public int countOfferings()