model
Class Course

java.lang.Object
  extended by model.Course

public class Course
extends java.lang.Object

Representation for a single course


Constructor Summary
Course(java.lang.String id, int limit)
          Constructor
 
Method Summary
 void addEnrolledIn(java.lang.String studentName, EnrolledIn newEnrolledIn)
          Add a new enrollment to the course
 void addWaiting(Student student)
          Add a student to the waiting list for a course
 boolean areAnyWaiting()
          Test to see whether any students are waiting to get into the course
 EnrolledIn getEnrolledIn(java.lang.String studentName)
          Accessor for the enrollment for a specific student
 int getEnrollmentCount()
          Accessor for the number of current enrollments in the course
 java.lang.String getId()
          Accessor for the course's id
 int getLimit()
          Accessor for the enrollment limit
 boolean isEnrolledIn(java.lang.String studentName)
          Determine if a specific student is enrolled in the course
 void printReport()
          Print a report on the course - enrollments and waiting list
 void removeEnrolledIn(java.lang.String studentName)
          Remove the enrollment for a specific student
 Student removeFirstWaiting()
          Remove the first student from the waiting list when a slot opens up
 void removeWaiting(Student student)
          Remove a specific student from the waiting list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Course

public Course(java.lang.String id,
              int limit)
Constructor

Parameters:
id - the course's id
limit - its enrollment limit
Method Detail

getId

public java.lang.String getId()
Accessor for the course's id

Returns:
the course's id

getLimit

public int getLimit()
Accessor for the enrollment limit

Returns:
the enrollment limit

getEnrollmentCount

public int getEnrollmentCount()
Accessor for the number of current enrollments in the course

Returns:
the number of students currently in the course

addEnrolledIn

public void addEnrolledIn(java.lang.String studentName,
                          EnrolledIn newEnrolledIn)
                   throws java.lang.IllegalArgumentException
Add a new enrollment to the course

Parameters:
studentName - the name of the student being enrolled
newEnrolledIn - the new enrollment to add
Throws:
java.lang.IllegalArgumentException - if the student is already enrolled in this course

isEnrolledIn

public boolean isEnrolledIn(java.lang.String studentName)
Determine if a specific student is enrolled in the course

Parameters:
studentName - the name of the student
Returns:
true iff the student is enrolled in the course

getEnrolledIn

public EnrolledIn getEnrolledIn(java.lang.String studentName)
                         throws java.lang.IllegalArgumentException
Accessor for the enrollment for a specific student

Parameters:
studentName - the student's name
Returns:
the enrollment object.
Throws:
java.lang.IllegalArgumentException - if the student is not enrolled

removeEnrolledIn

public void removeEnrolledIn(java.lang.String studentName)
                      throws java.lang.IllegalArgumentException
Remove the enrollment for a specific student

Parameters:
studentName - the student's name
Throws:
java.lang.IllegalArgumentException - if the student is not enrolled

addWaiting

public void addWaiting(Student student)
                throws java.lang.IllegalArgumentException
Add a student to the waiting list for a course

Parameters:
student - the student to add
Throws:
java.lang.IllegalArgumentException - if the student is already in the course or on the waiting list

removeWaiting

public void removeWaiting(Student student)
                   throws java.lang.IllegalArgumentException
Remove a specific student from the waiting list

Parameters:
student - the student to remove
Throws:
java.lang.IllegalArgumentException - if the student is not on the waiting list

areAnyWaiting

public boolean areAnyWaiting()
Test to see whether any students are waiting to get into the course

Returns:
true iff there is at least one student on the waiting list

removeFirstWaiting

public Student removeFirstWaiting()
Remove the first student from the waiting list when a slot opens up

Returns:
the student that was removed

printReport

public void printReport()
Print a report on the course - enrollments and waiting list