Package MySTARS

Class Lesson

java.lang.Object
MySTARS.Lesson
All Implemented Interfaces:
java.io.Serializable

public final class Lesson
extends java.lang.Object
implements java.io.Serializable
Represents one lesson timeslot
Since:
2020-11-1
Version:
1.0
Author:
Timothy
See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private ClassType classType
    The type of class (lecture, tutorial etc.) which is an enum ClassType.
    private DayOfWeek dayOfWeek
    The day of the week when the lesson occurs (Monday - Sunday).
    private org.joda.time.DateTime endTime
    The end time of the lesson in 24h time (4 digit integer).
    private java.lang.Integer lessonID
    Lesson ID, used to identify and update lessons.
    private java.lang.String location
    Location of the lesson
    private java.lang.String remarks
    Additional remarks (eg.
    private static long serialVersionUID
    For java serializable
    private org.joda.time.DateTime startTime
    The start time of the lesson in 24h time (4 digit integer).
    private org.joda.time.Interval time
    The allocated block of time for the lesson, of type Interval.
  • Constructor Summary

    Constructors 
    Constructor Description
    Lesson​(ClassType classType, DayOfWeek dayOfWeek, int startTime, int endTime, java.lang.String location)
    Lesson constructor, creates new lesson of specified ClassType on a certain day of the week.
  • Method Summary

    Modifier and Type Method Description
    static ClassType chooseClassType()
    Method to prompt user to choose the type of class
    boolean clashes​(java.util.ArrayList<Lesson> lessons)  
    org.joda.time.DateTime getEndTime()
    Returns end time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).
    java.lang.Integer getLessonID()
    Returns Lesson ID for current lesson.
    java.lang.String getLocation()
    Returns location of lesson as a string.
    java.lang.String getRemarks()
    Returns the remarks for this lesson slot.
    org.joda.time.DateTime getStartTime()
    Returns starting time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).
    org.joda.time.Interval getTime()
    Returns the interval of time where the lesson occurs, as a JodaTime Interval object.
    ClassType getType()
    Returns a ClassType enum specifying the type of the specified lesson.
    void setLocation​(java.lang.String location)
    Sets the location of the lesson.
    void setRemarks​(java.lang.String remarks)
    Sets any relevant remarks for the lesson slot.
    void setTime​(int startTime, int endTime)
    Set start and end time of lesson slot.

    Methods inherited from class java.lang.Object

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

    • classType

      private ClassType classType
      The type of class (lecture, tutorial etc.) which is an enum ClassType.
    • time

      private org.joda.time.Interval time
      The allocated block of time for the lesson, of type Interval.
    • startTime

      private org.joda.time.DateTime startTime
      The start time of the lesson in 24h time (4 digit integer).
    • endTime

      private org.joda.time.DateTime endTime
      The end time of the lesson in 24h time (4 digit integer).
    • dayOfWeek

      private DayOfWeek dayOfWeek
      The day of the week when the lesson occurs (Monday - Sunday).
    • location

      private java.lang.String location
      Location of the lesson
    • remarks

      private java.lang.String remarks
      Additional remarks (eg. If lesson only occurs every other week).
    • lessonID

      private final java.lang.Integer lessonID
      Lesson ID, used to identify and update lessons.
    • serialVersionUID

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

    • Lesson

      public Lesson​(ClassType classType, DayOfWeek dayOfWeek, int startTime, int endTime, java.lang.String location)
      Lesson constructor, creates new lesson of specified ClassType on a certain day of the week.
      Parameters:
      classType - an enum giving the type of class (lecture, tutorial etc.).
      dayOfWeek - integer representing the day of the week.
      startTime - start time of lesson in 24h format.
      endTime - end time of lesson in 24h format.
      location - location of lesson.
  • Method Details

    • chooseClassType

      public static ClassType chooseClassType()
      Method to prompt user to choose the type of class
      Returns:
      The corresponding ClassType object
    • getType

      public ClassType getType()
      Returns a ClassType enum specifying the type of the specified lesson.
      Returns:
      ClassType enum specifying the type of the specified lesson.
    • getTime

      public org.joda.time.Interval getTime()
      Returns the interval of time where the lesson occurs, as a JodaTime Interval object.
      Returns:
      interval of time where the lesson occurs, as a JodaTime Interval object.
    • getStartTime

      public org.joda.time.DateTime getStartTime()
      Returns starting time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).
      Returns:
      starting time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).
    • getEndTime

      public org.joda.time.DateTime getEndTime()
      Returns end time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).
      Returns:
      end time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).
    • setTime

      public void setTime​(int startTime, int endTime)
      Set start and end time of lesson slot.
      Parameters:
      startTime - start time of lesson in 24h format (4 digit integer).
      endTime - end time of lesson in 24h format (4 digit integer).
    • getLocation

      public java.lang.String getLocation()
      Returns location of lesson as a string.
      Returns:
      location of lesson as a string.
    • setLocation

      public void setLocation​(java.lang.String location)
      Sets the location of the lesson.
      Parameters:
      location - location of the lesson as a string.
    • setRemarks

      public void setRemarks​(java.lang.String remarks)
      Sets any relevant remarks for the lesson slot.
      Parameters:
      remarks - additional remarks for the lesson, in a string.
    • getRemarks

      public java.lang.String getRemarks()
      Returns the remarks for this lesson slot.
      Returns:
      remarks for this lesson slot as a string.
    • getLessonID

      public java.lang.Integer getLessonID()
      Returns Lesson ID for current lesson.
      Returns:
      lesson ID.
    • clashes

      public boolean clashes​(java.util.ArrayList<Lesson> lessons)