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 lessonprivate java.lang.String
remarks
Additional remarks (eg.private static long
serialVersionUID
For java serializableprivate 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
-
Method Summary
Modifier and Type Method Description static ClassType
chooseClassType()
Method to prompt user to choose the type of classboolean
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.
-
Field Details
-
classType
The type of class (lecture, tutorial etc.) which is an enum ClassType. -
time
private org.joda.time.Interval timeThe allocated block of time for the lesson, of type Interval. -
startTime
private org.joda.time.DateTime startTimeThe start time of the lesson in 24h time (4 digit integer). -
endTime
private org.joda.time.DateTime endTimeThe end time of the lesson in 24h time (4 digit integer). -
dayOfWeek
The day of the week when the lesson occurs (Monday - Sunday). -
location
private java.lang.String locationLocation of the lesson -
remarks
private java.lang.String remarksAdditional remarks (eg. If lesson only occurs every other week). -
lessonID
private final java.lang.Integer lessonIDLesson ID, used to identify and update lessons. -
serialVersionUID
private static final long serialVersionUIDFor 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
Method to prompt user to choose the type of class- Returns:
- The corresponding ClassType object
-
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
-