registrationsystem.model
Class RegistrationModel

java.lang.Object
  extended by registrationsystem.model.RegistrationModel

public class RegistrationModel
extends java.lang.Object

The main model for the registration system. Maintains and provides access to collections of courses, students, and grades.


Constructor Summary
RegistrationModel()
          Constructor
 
Method Summary
 void addCourse(Course newCourse)
          Add a course to the collection of courses
 void addLegalGrade(java.lang.String newLegalGrade)
          Add a grade to the collection of legal grades
 void addStudent(Student newStudent)
          Add a student to the collection of students
 java.util.Iterator<Course> courseIterator()
          Allow access to all courses
 Course getCourse(java.lang.String id)
          Lookup a course by id
 Student getStudent(java.lang.String name)
          Lookup a student by name
 boolean isLegalGrade(java.lang.String grade)
          Test to see if a grade is legal
 java.util.Iterator<Student> studentIterator()
          Allow access to all students
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistrationModel

public RegistrationModel()
Constructor

Method Detail

addCourse

public void addCourse(Course newCourse)
Add a course to the collection of courses

Parameters:
newCourse - the course to add

addStudent

public void addStudent(Student newStudent)
Add a student to the collection of students

Parameters:
newStudent - the student to add

addLegalGrade

public void addLegalGrade(java.lang.String newLegalGrade)
Add a grade to the collection of legal grades

Parameters:
newLegalGrade - the grade to add

getCourse

public Course getCourse(java.lang.String id)
                 throws java.lang.IllegalArgumentException
Lookup a course by id

Parameters:
id - the id of the course desired
Returns:
the corresponding course object
Throws:
java.lang.IllegalArgumentException - if the course does not exist

getStudent

public Student getStudent(java.lang.String name)
Lookup a student by name

Parameters:
name - the name of the student desired
Returns:
the corresponding student object
Throws:
java.lang.IllegalArgumentException - if the student does not exist

isLegalGrade

public boolean isLegalGrade(java.lang.String grade)
Test to see if a grade is legal

Parameters:
grade - the grade to test
Returns:
true iff the grade is legal

courseIterator

public java.util.Iterator<Course> courseIterator()
Allow access to all courses

Returns:
an iterator that allows access to all courses in id order

studentIterator

public java.util.Iterator<Student> studentIterator()
Allow access to all students

Returns:
an iterator that allows access to all students in alphabetical order of name