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 AU acadUnits
    Number of AUs credited for passing the course (default = 1).
    private java.lang.String courseCode
    The course code (eg.
    private java.util.HashMap<java.lang.String,​CourseIndex> courseIndices
    Hashmap of all available indices in the course.
    private java.lang.String courseName
    Full course name (eg.
    private CourseStatus courseStatus
    Status of a the course in relation to a student (eg.
    private java.lang.String description
    Course description.
    private java.lang.String school
    The school that offers this course.
    private static long serialVersionUID
    For 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
    void addIndex​(CourseIndex courseIndex)
    Directly adds a particular CourseIndex to the current Course.
    void addIndices​(int numIndices)
    Add a User defined number of CourseIndices to the course.
    static boolean checkCourseCodeFormat​(java.lang.String courseCode)
    A method to check the Course code to verify it matches a fixed pattern.
    boolean containsIndex​(java.lang.String courseIndex)
    Check if the Course has a particular Index number.
    AU getCourseAU()
    Return the number of AUs credited upon completion of the Course.
    java.lang.String getCourseCode()
    Returns the courseCode.
    java.lang.String getCourseName()
    Return the courseName.
    java.lang.String getDescription()
    Return the Course description.
    CourseIndex getIndex​(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.String getSchool()
    Return the school offering this course.
    CourseStatus getStatus()
    Return the CourseStatus of a Student's enrollment in the Course.
    CourseIndex removeIndex​(java.lang.String courseIndex)
    Directly removes a particular CourseIndex to the current Course.
    void setCourseAU​(AU acadUnits)
    Set the number of AUs to be credited upon completion of the Course.
    void setCourseCode​(java.lang.String courseCode)
    Sets courseCode.
    void setCourseName​(java.lang.String courseName)
    Set courseName.
    void setDescription​(java.lang.String description)
    Set the Course description.
    void setSchool​(java.lang.String school)
    Sets school.
    void setStatus​(CourseStatus courseStatus)
    Set the CourseStatus of a Student's enrollment in the Course.
    Course simpleCopy​(CourseStatus status, CourseIndex courseIndex)
    Make a simple copy of the course to be stored under the Student object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • courseCode

      private java.lang.String courseCode
      The course code (eg. CZ2002).
    • courseName

      private java.lang.String courseName
      Full course name (eg. Object Oriented Design Programming).
    • description

      private java.lang.String description
      Course description.
    • acadUnits

      private AU acadUnits
      Number of AUs credited for passing the course (default = 1).
    • school

      private java.lang.String school
      The school that offers this course.
    • courseIndices

      private java.util.HashMap<java.lang.String,​CourseIndex> courseIndices
      Hashmap of all available indices in the course.
    • courseStatus

      private CourseStatus courseStatus
      Status of a the course in relation to a student (eg. registered, waitlisted etc.)
    • serialVersionUID

      private static final long serialVersionUID
      For Java serializable.
      See Also:
      Constant Field Values
  • Constructor Details

    • Course

      public 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.
      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 course
      courseStatus - 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 course
      courseStatus - 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

      public void setCourseAU​(AU acadUnits)
      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

      public AU 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

      public void setStatus​(CourseStatus courseStatus)
      Set the CourseStatus of a Student's enrollment in the Course.
      Parameters:
      courseStatus - The status of a Student's enrollment in the Course.
    • getStatus

      public CourseStatus getStatus()
      Return the CourseStatus of a Student's enrollment in the Course.
      Returns:
      The CourseStatus of a Student's enrollment in the Course.
    • getIndex

      public CourseIndex getIndex​(java.lang.String courseIndex)
      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:
      true if 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

      public CourseIndex removeIndex​(java.lang.String courseIndex)
      Directly removes a particular CourseIndex to the current Course.
      Parameters:
      courseIndex - The index to be removed to the Course.
      Returns:
      The removed CourseIndex
    • addIndex

      public void addIndex​(CourseIndex courseIndex)
      Directly adds a particular CourseIndex to 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

      public CourseIndex[] 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:
      true if the course code matches the specified pattern.
    • simpleCopy

      public Course simpleCopy​(CourseStatus status, CourseIndex courseIndex)
      Make a simple copy of the course to be stored under the Student object.
      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.