public class Calendar
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<java.util.ArrayList<java.util.ArrayList<Meeting>>> |
occupied |
Constructor and Description |
---|
Calendar()
Default constructor, builds a calendar and initializes each day
to an empty list.
|
Modifier and Type | Method and Description |
---|---|
void |
addMeeting(Meeting toAdd)
Used to add a meeting to a calendar
|
static void |
checkTimes(int mMonth,
int mDay,
int mStart,
int mEnd)
Basic error checking on numbers.
|
void |
clearSchedule(int month,
int day)
Clears all meetings for a day.
|
Meeting |
getMeeting(int month,
int day,
int index)
Retrieves a meeting from the calendar.
|
boolean |
isBusy(int month,
int day,
int start,
int end)
Used to check whether a meeting is scheduled during a particular
time frame.
|
java.lang.String |
printAgenda(int month)
Used to print the calendar for a month in string form.
|
java.lang.String |
printAgenda(int month,
int day)
Used to print the calendar for a day in string form.
|
void |
removeMeeting(int month,
int day,
int index)
Removes a meeting from the calendar.
|
private java.util.ArrayList<java.util.ArrayList<java.util.ArrayList<Meeting>>> occupied
public Calendar()
public boolean isBusy(int month, int day, int start, int end) throws TimeConflictException
month
- - The month of the meeting (1-12)day
- - The day of the meeting (1-31)start
- - The time the meeting starts (0-23)end
- - The time the meeting ends (0-23)TimeConflictException
- If an invalid date or time is entered.public static void checkTimes(int mMonth, int mDay, int mStart, int mEnd) throws TimeConflictException
mMonth
- - The month of the meeting (1-12)mDay
- - The day of the meeting (1-31)mStart
- - The time the meeting starts (0-23)mEnd
- - The time the meeting ends (0-23)TimeConflictException
- - If an invalid date or time is entered.public void addMeeting(Meeting toAdd) throws TimeConflictException
toAdd
- - A Meeting object to add to the calendarTimeConflictException
- - If an invalid date or time is entered.public void clearSchedule(int month, int day)
month
- - The month of the meeting (1-12)day
- - The day of the meeting (1-31)public java.lang.String printAgenda(int month)
month
- - The month of the meeting (1-12)public java.lang.String printAgenda(int month, int day)
month
- - The month of the meeting (1-12)day
- - The day of the meeting (1-31)public Meeting getMeeting(int month, int day, int index)
month
- - The month of the meeting (1-12)day
- - The day of the meeting (1-31)index
- - The index in the list for the meetingpublic void removeMeeting(int month, int day, int index)
month
- - The month of the meeting (1-12)day
- - The day of the meeting (1-31)index
- - The index in the list for the meeting