|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectmonthlyCalendar.WeekActivities
public class WeekActivities
This class represents activities we have in a week. The class uses a map
(Map<Day, MySortedLinkedList<Activity>>)
to associate a day with a list of activities for that particular day. If
a day has no activities then no entry for that day will exist in the map.
Notice that for this project you must use a MySortedLinkedList object to keep
track of the activities associated with a particular day.
| Constructor Summary | |
|---|---|
WeekActivities()
Creates a HashMap that maps days to list of activities. |
|
| Method Summary | |
|---|---|
boolean |
addActivity(java.lang.String name,
Day day,
Time activityStartTime,
int duration)
Verifies whether the specified time period is available and if so, adds the activity to the list of activities for the day. |
boolean |
anyActivitiesOnDay(Day day)
Returns true if there are any activities scheduled during the specified day and false otherwise. |
java.util.Iterator<Activity> |
dayActivitiesIterator(Day day)
Returns an Activity iterator for the activities in the specified day |
java.util.Set<Day> |
daysWithActivities()
Returns a set of days with activities. |
Activity |
getActivity(Day day,
Time startTime)
Returns a reference to the Activity that takes place at the specified day and that starts at the specified time. |
java.util.Map<Day,java.util.Map<Time,Activity>> |
getDayTimeActivityMap()
This methods returns a map that allow us to tell what activity takes place at a particular day and at a particular start time. |
boolean |
isTimePeriodAvailable(Day day,
Time activityStartTime,
int duration)
Returns true if it is possible to schedule an activity in the time period starting at activityStartTime and lasting for the specified duration (minutes). |
boolean |
removeActivity(Day day,
Time startTime)
Removes the activity taking place at the specified day and start time. |
java.lang.String |
toString()
Returns a string representation for the week. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WeekActivities()
| Method Detail |
|---|
public boolean isTimePeriodAvailable(Day day,
Time activityStartTime,
int duration)
day - day activity will take placeactivityStartTime - start timeduration - duration of activity in minutes
public boolean addActivity(java.lang.String name,
Day day,
Time activityStartTime,
int duration)
name - activity nameday - day activity will take placeactivityStartTime - start timeduration - duration of activity in minutes
public Activity getActivity(Day day,
Time startTime)
day - day activity will take placestartTime - start time
public boolean removeActivity(Day day,
Time startTime)
day - day activity will take placestartTime - start time
public java.util.Iterator<Activity> dayActivitiesIterator(Day day)
day - target day
java.lang.IllegalArgumentException - Thrown if the specified day has no
activities associated with it. The thrown exception must use the message
"Invalid day"public boolean anyActivitiesOnDay(Day day)
day - target day
public java.util.Set<Day> daysWithActivities()
public java.util.Map<Day,java.util.Map<Time,Activity>> getDayTimeActivityMap()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||