Package MySTARS
Class Course
java.lang.Object
MySTARS.Course
- All Implemented Interfaces:
java.io.Serializable
public final class Course
extends java.lang.Object
implements java.io.Serializable
Represents one course/module
- Since:
- 2020-11-1
- Version:
- 1.0
- Author:
- Timothy
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description private AUacadUnitsNumber of AUs credited for passing the course (default = 1).private java.lang.StringcourseCodeThe course code (eg.private java.util.HashMap<java.lang.String,CourseIndex>courseIndicesHashmap of all available indices in the course.private java.lang.StringcourseNameFull course name (eg.private CourseStatuscourseStatusStatus of a the course in relation to a student (eg.private java.lang.StringdescriptionCourse description.private java.lang.StringschoolThe school that offers this course.private static longserialVersionUIDFor Java serializable. -
Constructor Summary
Constructors Constructor Description Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits)Constructor for course object, to be created without a description, school and course status.Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits, java.lang.String description, java.lang.String school)Constructor for course object, to be created with a description and school, but without course status.Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits, java.lang.String description, java.lang.String school, CourseStatus courseStatus)Constructor for course object, to be created with a description, school and course status.Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits, java.lang.String description, java.lang.String school, CourseStatus courseStatus, CourseIndex courseIndex)Constructor for course object, creates course with description, school, course status, and an initial course index. -
Method Summary
Modifier and Type Method Description voidaddIndex(CourseIndex courseIndex)Directly adds a particularCourseIndexto the current Course.voidaddIndices(int numIndices)Add a User defined number of CourseIndices to the course.static booleancheckCourseCodeFormat(java.lang.String courseCode)A method to check the Course code to verify it matches a fixed pattern.booleancontainsIndex(java.lang.String courseIndex)Check if the Course has a particular Index number.AUgetCourseAU()Return the number of AUs credited upon completion of the Course.java.lang.StringgetCourseCode()Returns the courseCode.java.lang.StringgetCourseName()Return the courseName.java.lang.StringgetDescription()Return the Course description.CourseIndexgetIndex(java.lang.String courseIndex)Returns a CourseIndex object by taking the index number as a parameter.CourseIndex[]getIndices()Returns an array of all indices registered under the Course.java.lang.String[]getIndicesString()Return an array all index numbers registered the Course.java.lang.StringgetSchool()Return the school offering this course.CourseStatusgetStatus()Return the CourseStatus of a Student's enrollment in the Course.CourseIndexremoveIndex(java.lang.String courseIndex)Directly removes a particularCourseIndexto the current Course.voidsetCourseAU(AU acadUnits)Set the number of AUs to be credited upon completion of the Course.voidsetCourseCode(java.lang.String courseCode)Sets courseCode.voidsetCourseName(java.lang.String courseName)Set courseName.voidsetDescription(java.lang.String description)Set the Course description.voidsetSchool(java.lang.String school)Sets school.voidsetStatus(CourseStatus courseStatus)Set the CourseStatus of a Student's enrollment in the Course.CoursesimpleCopy(CourseStatus status, CourseIndex courseIndex)Make a simple copy of the course to be stored under theStudentobject.
-
Field Details
-
courseCode
private java.lang.String courseCodeThe course code (eg. CZ2002). -
courseName
private java.lang.String courseNameFull course name (eg. Object Oriented Design Programming). -
description
private java.lang.String descriptionCourse description. -
acadUnits
Number of AUs credited for passing the course (default = 1). -
school
private java.lang.String schoolThe school that offers this course. -
courseIndices
Hashmap of all available indices in the course. -
courseStatus
Status of a the course in relation to a student (eg. registered, waitlisted etc.) -
serialVersionUID
private static final long serialVersionUIDFor Java serializable.- See Also:
- Constant Field Values
-
-
Constructor Details
-
Course
Constructor for course object, to be created without a description, school and course status.- Parameters:
courseCode- Course code (eg. cz2002).courseName- Course name (eg. object oriented design programming).acadUnits- Number of AUs credited upon completion of course.
-
Course
public Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits, java.lang.String description, java.lang.String school)Constructor for course object, to be created with a description and school, but without course status.- Parameters:
courseCode- Course code (eg. cz2002).courseName- Course name (eg. object oriented design programming).acadUnits- Number of AUs credited upon completion of course.description- Course description.school- School that offers this course
-
Course
public Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits, java.lang.String description, java.lang.String school, CourseStatus courseStatus)Constructor for course object, to be created with a description, school and course status.- Parameters:
courseCode- Course code (eg. cz2002).courseName- Course name (eg. object oriented design programming).acadUnits- Number of AUs credited upon completion of course.description- Course description.school- School that offers this coursecourseStatus- Enrollment status of a particular Student.
-
Course
public Course(java.lang.String courseCode, java.lang.String courseName, AU acadUnits, java.lang.String description, java.lang.String school, CourseStatus courseStatus, CourseIndex courseIndex)Constructor for course object, creates course with description, school, course status, and an initial course index.- Parameters:
courseCode- Course code (eg. cz2002).courseName- Course name (eg. object oriented design programming).acadUnits- Number of AUs credited upon completion of course.description- Course description.school- School that offers this coursecourseStatus- Enrollment status of a particular student.courseIndex- Course index to initialize with this course.
-
-
Method Details
-
setCourseCode
public void setCourseCode(java.lang.String courseCode)Sets courseCode.- Parameters:
courseCode- The courseCode as a String.
-
getCourseCode
public java.lang.String getCourseCode()Returns the courseCode.- Returns:
- courseCode.
-
setCourseName
public void setCourseName(java.lang.String courseName)Set courseName.- Parameters:
courseName- The name of the Course.
-
getCourseName
public java.lang.String getCourseName()Return the courseName.- Returns:
- The name of the Course.
-
setDescription
public void setDescription(java.lang.String description)Set the Course description.- Parameters:
description- The Course description.
-
getDescription
public java.lang.String getDescription()Return the Course description.- Returns:
- The Course description.
-
setCourseAU
Set the number of AUs to be credited upon completion of the Course.- Parameters:
acadUnits- Number of AUs to be credited upon completion of the Course.
-
getCourseAU
Return the number of AUs credited upon completion of the Course.- Returns:
- The number of AUs credited upon completion of the Course.
-
setSchool
public void setSchool(java.lang.String school)Sets school.- Parameters:
school- The school that offers this course as a String.
-
getSchool
public java.lang.String getSchool()Return the school offering this course.- Returns:
- The school that offers this course.
-
setStatus
Set the CourseStatus of a Student's enrollment in the Course.- Parameters:
courseStatus- The status of a Student's enrollment in the Course.
-
getStatus
Return the CourseStatus of a Student's enrollment in the Course.- Returns:
- The CourseStatus of a Student's enrollment in the Course.
-
getIndex
Returns a CourseIndex object by taking the index number as a parameter.- Parameters:
courseIndex- The index number of the course to be returned.- Returns:
- A CourseIndex object corresponding to the specified key value.
-
containsIndex
public boolean containsIndex(java.lang.String courseIndex)Check if the Course has a particular Index number.- Parameters:
courseIndex- Number of the index that is being queried.- Returns:
trueif Course contains given index.
-
addIndices
public void addIndices(int numIndices)Add a User defined number of CourseIndices to the course. Includes prompts for the User to enter all relevant details for each CourseIndex and Lesson.- Parameters:
numIndices- Integer number of indices to add to the Course.
-
removeIndex
Directly removes a particularCourseIndexto the current Course.- Parameters:
courseIndex- The index to be removed to the Course.- Returns:
- The removed CourseIndex
-
addIndex
Directly adds a particularCourseIndexto the current Course.- Parameters:
courseIndex- The index to be added to the Course.
-
getIndicesString
public java.lang.String[] getIndicesString()Return an array all index numbers registered the Course.- Returns:
- An array all index numbers registered the Course.
-
getIndices
Returns an array of all indices registered under the Course.- Returns:
- An array of all indices registered under the Course.
-
checkCourseCodeFormat
public static boolean checkCourseCodeFormat(java.lang.String courseCode)A method to check the Course code to verify it matches a fixed pattern.- Parameters:
courseCode- The String value of the course code.- Returns:
trueif the course code matches the specified pattern.
-
simpleCopy
Make a simple copy of the course to be stored under theStudentobject.- Parameters:
status- The current status of the Course.courseIndex- The Index that the Student registered for.- Returns:
- A Course object with all the basic information with the current CourseStatus and CourseIndex.
-