public class TimeBlock
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
DAYS |
static int |
FRIDAY |
static int |
MONDAY |
static int |
SATURDAY |
static int |
SUNDAY |
static int |
THURSDAY |
static int |
TUESDAY |
static int |
WEDNESDAY |
Constructor and Description |
---|
TimeBlock(int day,
int start,
int end)
Constructor
|
TimeBlock(int startTime,
int startDay,
int endTime,
int endDay)
Constructor
|
TimeBlock(int day,
int sm,
int sh,
int em,
int eh)
Constructor
|
TimeBlock(java.sql.Time startTime,
int startDay,
java.sql.Time endTime,
int endDay)
Constructor
|
TimeBlock(java.sql.Time startTime,
int startDay,
java.sql.Time endTime,
int endDay,
java.lang.String comment)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertDayToName(int day)
Turns a number day into it's human readable version
|
static int |
convertTime(int minutes,
int hours)
Consumes minutes and hours (in military time format) and returns the
total minutes of the day
|
static int |
convertTimeToHour(int time)
Returns the hour (non-military) of a time in minutes total
|
static java.lang.String |
convertTimeToMeridian(int time)
Returns the meridian of a time in minutes total
|
static int |
convertTimeToMinute(int time)
Returns the minutes of a time in minutes total
|
static int |
convertTimeToTime(java.sql.Time time)
Consumes a java time and returns it in total minutes of the day
|
java.lang.String |
getDescription()
Getter for description
|
int |
getEndDay()
Getter for end day
|
java.lang.String |
getEndDayName()
Returns the string representation of the end day
|
int |
getEndHour()
Returns the hour that this ended
|
java.lang.String |
getEndHourString()
Returns the end hour as a string
|
java.lang.String |
getEndMerdian()
Returns whether it ended am or pm
|
int |
getEndMinute()
Returns the minute this ended
|
java.lang.String |
getEndMinuteString()
Returns the end minute as a string
|
java.lang.String |
getEndString()
Returns a nicely formatted string representation of the end time
|
int |
getEndTime()
Getter for end time (uses minute-total
|
int |
getStartDay()
Getter for startDay
|
java.lang.String |
getStartDayName()
Returns the string representation of the start day
|
int |
getStartHour()
Returns the hour that this started
|
java.lang.String |
getStartHourString()
Returns the start hour as a string
|
java.lang.String |
getStartMerdian()
Returns whether it started am or pm
|
int |
getStartMinute()
Returns the minute this started
|
java.lang.String |
getStartMinuteString()
Returns the start minute as a string
|
java.lang.String |
getStartString()
Returns a nicely formatted string representation of the start time
|
int |
getStartTime()
Getter for start time (uses minute-total)
|
java.lang.String |
getTimeString()
Returns a nicely formatted string representation of the entire time
|
boolean |
intersect(TimeBlock other)
Check if this time block has any intersections between it's times and days
|
static int |
makeTime(int m,
int h,
java.lang.String startMeridian)
Creates a minute-total time
|
static java.lang.String |
padTime(int t,
int n)
Pads zeroes onto a number if it is less than 10
|
boolean |
sameTime(TimeBlock time)
Check if two timeblocks are equivalent
|
void |
setDescription(java.lang.String description)
Setter for description
|
void |
setEndDay(int endDay)
SEtter for end day
|
void |
setEndTime(int end)
Setter for end time (uses minute-total)
|
void |
setEndTime(int em,
int eh)
Sets the end time using minutes and hours
|
void |
setStartDay(int startDay)
Setter for startDay
|
void |
setStartTime(int start)
Setter for start time (uses minute-total)
|
void |
setStartTime(int sm,
int sh)
Sets the start time using minutes and hours
|
java.lang.String |
toString()
Returns it as a string
|
public static final int SUNDAY
public static final int MONDAY
public static final int TUESDAY
public static final int WEDNESDAY
public static final int THURSDAY
public static final int FRIDAY
public static final int SATURDAY
public static final int DAYS
public TimeBlock(int startTime, int startDay, int endTime, int endDay)
startTime
- time in total minutes of the daystartDay
- number day of the weekendTime
- time in total minutes of the dayendDay
- number day of the weekpublic TimeBlock(int day, int sm, int sh, int em, int eh)
day
- number day of the weeksm
- start minutesh
- start hourem
- end minuteeh
- end hourpublic TimeBlock(java.sql.Time startTime, int startDay, java.sql.Time endTime, int endDay)
startTime
- a Java TimestartDay
- number day of the weekendTime
- a Java TimeendDay
- number day of the weekpublic TimeBlock(java.sql.Time startTime, int startDay, java.sql.Time endTime, int endDay, java.lang.String comment)
startTime
- a Java Time (unix epoch)startDay
- number day of the weekendTime
- a Java Time (unix epoch)endDay
- number day of the weekcomment
- public TimeBlock(int day, int start, int end)
day
- number day of the weekstart
- a time in minutes total of hte dayend
- a time in minutes total of the daypublic static int convertTime(int minutes, int hours)
minutes
- hours
- public int getStartHour()
public int getEndHour()
public int getStartMinute()
public int getEndMinute()
public java.lang.String getStartMerdian()
public java.lang.String getEndMerdian()
public java.lang.String getStartDayName()
public java.lang.String getEndDayName()
public static int convertTimeToTime(java.sql.Time time)
time
- public static java.lang.String convertDayToName(int day)
day
- public static java.lang.String convertTimeToMeridian(int time)
time
- public static int convertTimeToHour(int time)
time
- public static int convertTimeToMinute(int time)
time
- public java.lang.String toString()
toString
in class java.lang.Object
public boolean intersect(TimeBlock other)
other
- public void setStartTime(int start)
start
- public int getStartTime()
public void setEndTime(int end)
end
- public int getEndTime()
public void setDescription(java.lang.String description)
description
- public java.lang.String getDescription()
public void setStartDay(int startDay)
startDay
- public int getStartDay()
public void setEndDay(int endDay)
endDay
- public int getEndDay()
public java.lang.String getStartString()
public java.lang.String getEndString()
public java.lang.String getTimeString()
public static java.lang.String padTime(int t, int n)
public boolean sameTime(TimeBlock time)
time
- public void setStartTime(int sm, int sh)
sm
- minutessh
- hourspublic void setEndTime(int em, int eh)
sm
- minutessh
- hourspublic static int makeTime(int m, int h, java.lang.String startMeridian)
m
- minutesh
- hoursstartMeridian
- either "PM" or "AM"public java.lang.String getEndHourString()
public java.lang.String getStartHourString()
public java.lang.String getEndMinuteString()
public java.lang.String getStartMinuteString()