All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class distans.CoursesHashtable

java.lang.Object
   |
   +----distans.CoursesHashtable

public class CoursesHashtable
extends Object
A class for storage of courses and the students belonging to them.


Variable Index

 o courses
The Hashtable containing courses.
 o currentCourse
The CreateCourseApplets actualCourses corresponding Hashtable.

Constructor Index

 o CoursesHashtable()
Constructs a Hashtable with initial capacity for 5 courses.
 o CoursesHashtable(String[])
Calls the CoursesHashtable() constructor and puts in the courses from courseArray into the coursesHashtable.

Method Index

 o courseExists(String)
Checks if a course exists in the Hashtable courses.
 o getCourseNames()
 o getStudents(CreateCourseDataLoader)
If no students are already in the currentCourse then the method getStudentsPutInHTReturnHt is called.
 o getStudentsPutInHtReturnHt(CreateCourseDataLoader)
Contacts the server through CCDL and retrieves the students for currentCourse.
 o putCourse(String)
Creates a new Hashtable to be used for the students of the course and puts it into the Hashtable courses.
 o putStudent(String, String)
Puts the student in the Hashtable currentCourse.
 o putStudents(Vector)
Puts the students data from a vector in the Hashtable currentCourse.
 o removeCourse(String)
Removes a course (and the students Hashtable) from courses.
 o removeStudent(String)
Removes a student from the Hashtable currentCourse.
 o removeStudentI(String)
Removes a student from the Hashtable currentCourse.
 o setCourse(String)
Sets currentCourse to the Hashtable with the key = courseName.
 o sortStudents()
Sorts the student for the currentCourse Hashtable in increasing cedula number.
 o studentExists(String)
Checks if a student exists in currentCourse.

Variables

 o currentCourse
 Hashtable currentCourse
The CreateCourseApplets actualCourses corresponding Hashtable.

 o courses
 Hashtable courses
The Hashtable containing courses.

Constructors

 o CoursesHashtable
 public CoursesHashtable()
Constructs a Hashtable with initial capacity for 5 courses.

 o CoursesHashtable
 public CoursesHashtable(String courseArray[])
Calls the CoursesHashtable() constructor and puts in the courses from courseArray into the coursesHashtable.

Parameters:
courseArray - an array with the names of the courses to initially are to be put into the coursesHashtable.

Methods

 o putCourse
 public void putCourse(String courseName)
Creates a new Hashtable to be used for the students of the course and puts it into the Hashtable courses.
The key is the name of the course and the value is the Hashtable with the students.

Parameters:
courseName - the name of the course (the key too) to put in the Hashtable courses.
 o removeCourse
 public void removeCourse(String courseName)
Removes a course (and the students Hashtable) from courses.

 o courseExists
 public boolean courseExists(String courseName)
Checks if a course exists in the Hashtable courses.

Parameters:
courseName - the key to check if it exist in the Hashtable courses.
Returns:
true or false. True if it did exist, false if not.
 o getCourseNames
 public Enumeration getCourseNames()
Returns:
an enumeration of the keys from the Hashtable courses.
 o putStudent
 public void putStudent(String student,
                        String cedula)
Puts the student in the Hashtable currentCourse. The key is cedula and the value is student.

Parameters:
student - data for a student.
cedula - the cedula number for the student.
 o putStudents
 public void putStudents(Vector students)
Puts the students data from a vector in the Hashtable currentCourse. The key is cedula and the value is student.

Parameters:
students - a vector with data for students.
 o removeStudent
 public void removeStudent(String cedula)
Removes a student from the Hashtable currentCourse.

Parameters:
cedula - the cedula number for the student.
 o removeStudentI
 public void removeStudentI(String student)
Removes a student from the Hashtable currentCourse.

Parameters:
student - is the data for a student.
 o studentExists
 public boolean studentExists(String cedula)
Checks if a student exists in currentCourse.

Parameters:
cedula - the key to check.
Returns:
true or false. True if it did exist, false if not.
 o getStudents
 public Enumeration getStudents(CreateCourseDataLoader CCDL)
If no students are already in the currentCourse then the method getStudentsPutInHTReturnHt is called.

Parameters:
CCDL - passed to getStudentsPutInHTReturnHt if currentCourse does not contain any students.
Returns:
a vector with the students for currentCourse sorted in increasing cedula order.
 o getStudentsPutInHtReturnHt
 private void getStudentsPutInHtReturnHt(CreateCourseDataLoader CCDL)
Contacts the server through CCDL and retrieves the students for currentCourse. Then puts the student into the Hashtable of currentCourse.

Parameters:
CCDL - the CreatCourseDataLoader for which subject the students are to be retrieved.
 o setCourse
 public void setCourse(String courseName)
Sets currentCourse to the Hashtable with the key = courseName.

Parameters:
courseName - the key for the new currentCourse Hashtable.
 o sortStudents
 private Vector sortStudents()
Sorts the student for the currentCourse Hashtable in increasing cedula number.

Returns:
a sorted vector containing the students for currentCourse.

All Packages  Class Hierarchy  This Package  Previous  Next  Index