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 ClassTypeclassTypeThe type of class (lecture, tutorial etc.) which is an enum ClassType.private DayOfWeekdayOfWeekThe day of the week when the lesson occurs (Monday - Sunday).private org.joda.time.DateTimeendTimeThe end time of the lesson in 24h time (4 digit integer).private java.lang.IntegerlessonIDLesson ID, used to identify and update lessons.private java.lang.StringlocationLocation of the lessonprivate java.lang.StringremarksAdditional remarks (eg.private static longserialVersionUIDFor java serializableprivate org.joda.time.DateTimestartTimeThe start time of the lesson in 24h time (4 digit integer).private org.joda.time.IntervaltimeThe allocated block of time for the lesson, of type Interval. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description static ClassTypechooseClassType()Method to prompt user to choose the type of classbooleanclashes(java.util.ArrayList<Lesson> lessons)org.joda.time.DateTimegetEndTime()Returns end time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).java.lang.IntegergetLessonID()Returns Lesson ID for current lesson.java.lang.StringgetLocation()Returns location of lesson as a string.java.lang.StringgetRemarks()Returns the remarks for this lesson slot.org.joda.time.DateTimegetStartTime()Returns starting time of the lesson slot, in JodaTime DateTime object (year, month, day of week, hour, minute).org.joda.time.IntervalgetTime()Returns the interval of time where the lesson occurs, as a JodaTime Interval object.ClassTypegetType()Returns a ClassType enum specifying the type of the specified lesson.voidsetLocation(java.lang.String location)Sets the location of the lesson.voidsetRemarks(java.lang.String remarks)Sets any relevant remarks for the lesson slot.voidsetTime(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
-