net.sf.mpxj
Class ProjectCalendarWeek

java.lang.Object
  extended by net.sf.mpxj.ProjectCalendarWeek
Direct Known Subclasses:
ProjectCalendar

public class ProjectCalendarWeek
extends Object

This class represents a basic working week, with no exceptions.


Field Summary
static DateRange DEFAULT_WORKING_AFTERNOON
           
static DateRange DEFAULT_WORKING_MORNING
          Constants representing the default working morning and afternoon hours.
 
Constructor Summary
ProjectCalendarWeek()
           
 
Method Summary
 ProjectCalendarHours addCalendarHours()
          Adds a set of hours to this calendar without assigning them to a particular day.
 ProjectCalendarHours addCalendarHours(Day day)
          Used to add working hours to the calendar.
 void addDefaultCalendarHours()
          This is a convenience method used to add a default set of calendar hours to a calendar.
 void addDefaultCalendarHours(Day day)
          This is a convenience method used to add a default set of calendar hours to a calendar.
 void attachHoursToDay(ProjectCalendarHours hours)
          Attaches a pre-existing set of hours to the correct day within the calendar.
 ProjectCalendarHours getCalendarHours(Day day)
          This method retrieves the calendar hours for the specified day.
 DateRange getDateRange()
          Retrieves the data range for which this week is valid.
 DayType[] getDays()
          Retrieve an array representing the days of the week for this calendar.
 ProjectCalendarHours[] getHours()
          Retrieve an array representing all of the calendar hours defined by this calendar.
 ProjectCalendarHours getHours(Day day)
          This method retrieves the calendar hours for the specified day.
 String getName()
          Calendar name.
 ProjectCalendarWeek getParent()
          If this week is derived from a another week, this method will return the parent week.
 DayType getWorkingDay(Day day)
          This method allows the retrieval of the actual working day flag, which can take the values DEFAULT, WORKING, or NONWORKING.
 boolean isDerived()
          Flag indicating if this week is derived from another week.
 void removeHoursFromDay(ProjectCalendarHours hours)
          Removes a set of calendar hours from the day to which they are currently attached.
 void setDateRange(DateRange range)
          Sets the date range for this week.
 void setName(String name)
          Calendar name.
 void setWorkingDay(Day day, boolean working)
          convenience method for setting working or non-working days.
 void setWorkingDay(Day day, DayType working)
          This is a convenience method provided to allow a day to be set as working or non-working, by using the day number to identify the required day.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WORKING_MORNING

public static final DateRange DEFAULT_WORKING_MORNING
Constants representing the default working morning and afternoon hours.


DEFAULT_WORKING_AFTERNOON

public static final DateRange DEFAULT_WORKING_AFTERNOON
Constructor Detail

ProjectCalendarWeek

public ProjectCalendarWeek()
Method Detail

setName

public void setName(String name)
Calendar name.

Parameters:
name - calendar name

getName

public String getName()
Calendar name.

Returns:
calendar name

getDateRange

public DateRange getDateRange()
Retrieves the data range for which this week is valid. Returns null if this is the default week.

Returns:
date range, or null

setDateRange

public void setDateRange(DateRange range)
Sets the date range for this week. Set this to null to indicate the default week.

Parameters:
range - date range, or null

getParent

public ProjectCalendarWeek getParent()
If this week is derived from a another week, this method will return the parent week.

Returns:
parent week

isDerived

public boolean isDerived()
Flag indicating if this week is derived from another week.

Returns:
true if this week is derived from another

addCalendarHours

public ProjectCalendarHours addCalendarHours()
Adds a set of hours to this calendar without assigning them to a particular day.

Returns:
calendar hours instance

getCalendarHours

public ProjectCalendarHours getCalendarHours(Day day)
This method retrieves the calendar hours for the specified day. Note that this method only returns the hours specification for the current calendar.If this is a derived calendar, it does not refer to the base calendar.

Parameters:
day - Day instance
Returns:
calendar hours

getHours

public ProjectCalendarHours[] getHours()
Retrieve an array representing all of the calendar hours defined by this calendar.

Returns:
array of calendar hours

getHours

public ProjectCalendarHours getHours(Day day)
This method retrieves the calendar hours for the specified day. Note that if this is a derived calendar, then this method will refer to the base calendar where no hours are specified in the derived calendar.

Parameters:
day - Day instance
Returns:
calendar hours

addDefaultCalendarHours

public void addDefaultCalendarHours()
This is a convenience method used to add a default set of calendar hours to a calendar.


addDefaultCalendarHours

public void addDefaultCalendarHours(Day day)
This is a convenience method used to add a default set of calendar hours to a calendar.

Parameters:
day - Day for which to add default hours for

addCalendarHours

public ProjectCalendarHours addCalendarHours(Day day)
Used to add working hours to the calendar. Note that the MPX file definition allows a maximum of 7 calendar hours records to be added to a single calendar.

Parameters:
day - day number
Returns:
new ProjectCalendarHours instance

attachHoursToDay

public void attachHoursToDay(ProjectCalendarHours hours)
Attaches a pre-existing set of hours to the correct day within the calendar.

Parameters:
hours - calendar hours instance

removeHoursFromDay

public void removeHoursFromDay(ProjectCalendarHours hours)
Removes a set of calendar hours from the day to which they are currently attached.

Parameters:
hours - calendar hours instance

getDays

public DayType[] getDays()
Retrieve an array representing the days of the week for this calendar.

Returns:
array of days of the week

getWorkingDay

public DayType getWorkingDay(Day day)
This method allows the retrieval of the actual working day flag, which can take the values DEFAULT, WORKING, or NONWORKING. This differs from the isWorkingDay method as it retrieves the actual flag value. The isWorkingDay method will always refer back to the base calendar to get a boolean value if the underlying flag value is DEFAULT. If isWorkingDay were the only method available to access this flag, it would not be possible to determine that a resource calendar had one or more flags set to DEFAULT.

Parameters:
day - required day
Returns:
value of underlying working day flag

setWorkingDay

public void setWorkingDay(Day day,
                          boolean working)
convenience method for setting working or non-working days.

Parameters:
day - required day
working - flag indicating if the day is a working day

setWorkingDay

public void setWorkingDay(Day day,
                          DayType working)
This is a convenience method provided to allow a day to be set as working or non-working, by using the day number to identify the required day.

Parameters:
day - required day
working - flag indicating if the day is a working day


Copyright © 2012. All Rights Reserved.