calendar
Class Activity


java.lang.Object

  extended by calendar.Activity


public class Activity
extends java.lang.Object

This class represents an activity. An activity is associated with a name, start time, end time and duration. We have implemented this class for you and you should not modify it.

Author:
Dept of Computer Science, UMCP

Constructor Summary
Activity(java.lang.String name, Time startTime, int duration)
          Initializes an Activity object based on the parameters.
 
Method Summary
 int getDuration()
          Returns the activity's duration (in minutes).
 Time getEndTime()
          Returns the activity's end time.
 java.lang.String getName()
          Returns the name of the activity.
 Time getStartTime()
          Returns the activity's start time.
 void setDuration(int duration)
          Updates the activity's duration.
 void setName(java.lang.String name)
          Updates the activity's name.
 void setStartTime(Time startTime)
          Updates the activity's start time.
 java.lang.String toString()
          Returns a string representation for an Activity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Activity


public Activity(java.lang.String name,

                Time startTime,

                int duration)
Initializes an Activity object based on the parameters. The endTime is initialized based on the start time and the duration.

Parameters:
name - name of the activity
startTime - time when activity begins
duration - duration of the activity in minutes
Method Detail

getName


public java.lang.String getName()
Returns the name of the activity.

Returns:
name of the activity

setName


public void setName(java.lang.String name)
Updates the activity's name.

Parameters:
name - activity name

getStartTime


public Time getStartTime()
Returns the activity's start time.

Returns:
start time

setStartTime


public void setStartTime(Time startTime)
Updates the activity's start time. Updating the start time of an activity updates the end time.

Parameters:
startTime - new start time

getDuration


public int getDuration()
Returns the activity's duration (in minutes).

Returns:
duration in minutes

setDuration


public void setDuration(int duration)
Updates the activity's duration. The end time is updated based on the new duration.

Parameters:
duration - new duration (in minutes).

getEndTime


public Time getEndTime()
Returns the activity's end time.

Returns:
activities end time

toString


public java.lang.String toString()
Returns a string representation for an Activity. The format is:
 Activity Name: name, StartTime: startTime, EndTime: endTime, Duration: duration
 

Overrides:
toString in class java.lang.Object
Returns:
string representation for an activity


Web Accessibility