// A thing that's doing duty for a database!
import java.util.*;

class Registry {
    protected static HashMap students = new HashMap();
    protected static HashMap lecturers = new HashMap();
    protected static HashMap directors = new HashMap();
    protected static HashMap modules = new HashMap();
    protected static HashMap courses = new HashMap();

    public static Student getStudent(String name) {
	return (Student)students.get(name);
    }

    public static Lecturer getLecturer(String name) {
	return (Lecturer)lecturers.get(name);
    }

    public static DirectorOfStudies getDos(String name) {
	return (DirectorOfStudies)lecturers.get(name);
    }

    public static Module getModule(String name) {
	return (Module)modules.get(name);
    }

    public static HonoursCourse getCourse(String name) {
	return (HonoursCourse)courses.get(name);
    }

    public static void registerStudent(Student s) {
	students.put(s.name, s);
    }

    public static void registerLecturer(Lecturer s) {
	lecturers.put(s.name, s);
    }

    // pre: all fields of Module are initialised
    public static void registerModule(Module s) {
	modules.put(s.name, s);
	s.lecturer.teachModule(s);
    }

    public static void registerCourse(HonoursCourse s) {
	courses.put(s.name, s);
    }

}
