public final class ProjectCalendar extends ProjectCalendarWeek
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_BASE_CALENDAR_NAME
Default base calendar name to use when none is supplied.
|
DEFAULT_WORKING_AFTERNOON, DEFAULT_WORKING_MORNING| Constructor and Description |
|---|
ProjectCalendar(ProjectFile file)
Default constructor.
|
ProjectCalendar(ProjectFile file,
ProjectCalendar taskCalendar,
ProjectCalendar resourceCalendar)
Create a calendar based on the intersection of a task calendar and a resource calendar.
|
| Modifier and Type | Method and Description |
|---|---|
ProjectCalendarException |
addCalendarException(Date fromDate,
Date toDate)
Used to add exceptions to the calendar.
|
ProjectCalendarHours |
addCalendarHours(Day day)
Used to add working hours to the calendar.
|
protected void |
addDerivedCalendar(ProjectCalendar calendar)
Add a reference to a calendar derived from this one.
|
ProjectCalendarWeek |
addWorkWeek()
Add an empty work week.
|
void |
attachHoursToDay(ProjectCalendarHours hours)
Attaches a pre-existing set of hours to the correct
day within the calendar.
|
void |
copy(ProjectCalendar cal)
Copy the settings from another calendar to this calendar.
|
List<ProjectCalendarException> |
getCalendarExceptions()
This method retrieves a list of exceptions to the current calendar.
|
Date |
getDate(Date startDate,
Duration duration,
boolean returnNextWorkStart)
Given a start date and a duration, this method calculates the
end date.
|
List<ProjectCalendar> |
getDerivedCalendars()
Retrieve a list of derived calendars.
|
Duration |
getDuration(Date startDate,
Date endDate)
This method is provided to allow an absolute period of time
represented by start and end dates into a duration in working
days based on this calendar instance.
|
ProjectCalendarException |
getException(Date date)
Retrieve a calendar calendar exception which applies to this date.
|
Date |
getFinishTime(Date date)
Retrieves the time at which work finishes on the given date, or returns
null if this is a non-working day.
|
Date |
getNextWorkStart(Date date)
Utility method to retrieve the next working date start time, given
a date and time as a starting point.
|
ProjectCalendar |
getParent()
If this week is derived from a another week, this method
will return the parent week.
|
ProjectFile |
getParentFile()
Accessor method allowing retrieval of ProjectFile reference.
|
Date |
getPreviousWorkFinish(Date date)
Utility method to retrieve the previous working date finish time, given
a date and time as a starting point.
|
Resource |
getResource()
Retrieve the resource to which this calendar is linked.
|
Date |
getStartDate(Date finishDate,
Duration duration)
Given a finish date and a duration, this method calculates backwards to the
start date.
|
Date |
getStartTime(Date date)
Retrieves the time at which work starts on the given date, or returns
null if this is a non-working day.
|
Integer |
getUniqueID()
Accessor method to retrieve the unique ID of this calendar.
|
Duration |
getWork(Date startDate,
Date endDate,
TimeUnit format)
This method retrieves a Duration instance representing the amount of
work between two dates based on this calendar.
|
Duration |
getWork(Date date,
TimeUnit format)
Retrieves the amount of work on a given day, and
returns it in the specified format.
|
List<ProjectCalendarWeek> |
getWorkWeeks()
Retrieve the work weeks associated with this calendar.
|
boolean |
isWorkingDate(Date date)
This method allows the caller to determine if a given date is a
working day.
|
boolean |
isWorkingDay(Day day)
Method indicating whether a day is a working or non-working day.
|
void |
remove()
Removes this calendar from the project.
|
protected void |
removeDerivedCalendar(ProjectCalendar calendar)
Remove a reference to a derived calendar.
|
void |
removeHoursFromDay(ProjectCalendarHours hours)
Removes a set of calendar hours from the day to which they
are currently attached.
|
void |
setParent(ProjectCalendar calendar)
Sets the ProjectCalendar instance from which this calendar is derived.
|
void |
setResource(Resource resource)
Sets the resource to which this calendar is linked.
|
void |
setUniqueID(Integer uniqueID)
Modifier method to set the unique ID of this calendar.
|
String |
toString() |
addCalendarHours, addDefaultCalendarHours, addDefaultCalendarHours, getCalendarHours, getDateRange, getDays, getHours, getHours, getName, getWorkingDay, isDerived, setDateRange, setName, setWorkingDay, setWorkingDaypublic static final String DEFAULT_BASE_CALENDAR_NAME
public ProjectCalendar(ProjectFile file)
file - the parent file to which this record belongs.public ProjectCalendar(ProjectFile file, ProjectCalendar taskCalendar, ProjectCalendar resourceCalendar)
file - the parent file to which this record belongs.taskCalendar - task calendar to mergeresourceCalendar - resource calendar to mergepublic ProjectCalendarWeek addWorkWeek()
public List<ProjectCalendarWeek> getWorkWeeks()
public ProjectCalendarException addCalendarException(Date fromDate, Date toDate)
fromDate - exception start datetoDate - exception end datepublic List<ProjectCalendarException> getCalendarExceptions()
public ProjectCalendarHours addCalendarHours(Day day)
addCalendarHours in class ProjectCalendarWeekday - day numberpublic void attachHoursToDay(ProjectCalendarHours hours)
attachHoursToDay in class ProjectCalendarWeekhours - calendar hours instancepublic void removeHoursFromDay(ProjectCalendarHours hours)
removeHoursFromDay in class ProjectCalendarWeekhours - calendar hours instancepublic void setParent(ProjectCalendar calendar)
calendar - base calendar instancepublic ProjectCalendar getParent()
ProjectCalendarWeekgetParent in class ProjectCalendarWeekpublic boolean isWorkingDay(Day day)
day - required daypublic Duration getDuration(Date startDate, Date endDate)
startDate - start of the periodendDate - end of the periodpublic Date getStartTime(Date date)
date - Date instancepublic Date getFinishTime(Date date)
date - Date instancepublic Date getDate(Date startDate, Duration duration, boolean returnNextWorkStart)
startDate - start dateduration - durationreturnNextWorkStart - if set to true will return start of next working periodpublic Date getStartDate(Date finishDate, Duration duration)
finishDate - finish dateduration - durationpublic Date getNextWorkStart(Date date)
date - date and time start pointpublic Date getPreviousWorkFinish(Date date)
date - date and time start pointpublic boolean isWorkingDate(Date date)
date - Date to be testedpublic void setUniqueID(Integer uniqueID)
uniqueID - unique identifierpublic Integer getUniqueID()
public Resource getResource()
public void setResource(Resource resource)
resource - resource instancepublic void remove()
public ProjectCalendarException getException(Date date)
date - target datepublic Duration getWork(Date date, TimeUnit format)
date - target dateformat - required formatpublic Duration getWork(Date startDate, Date endDate, TimeUnit format)
startDate - start dateendDate - end dateformat - required duration formatprotected void addDerivedCalendar(ProjectCalendar calendar)
calendar - derived calendar instanceprotected void removeDerivedCalendar(ProjectCalendar calendar)
calendar - derived calendar instancepublic List<ProjectCalendar> getDerivedCalendars()
public void copy(ProjectCalendar cal)
cal - calendar data sourcepublic final ProjectFile getParentFile()
Copyright © 2013. All Rights Reserved.