org.swiftgantt.common
Class CalendarUtils

java.lang.Object
  extended by org.swiftgantt.common.CalendarUtils

public class CalendarUtils
extends java.lang.Object

Common utils for Time.

Version:
1.0
Author:
Yuxing Wang

Constructor Summary
CalendarUtils()
           
 
Method Summary
static int calcWorkingDays(Time start, int dates)
           
static int calcWorkingDays(Time start, Time end, int[] workingDurationInWeek)
          Calculate working days from start day to end day(incluing end day).
static int calcWorkingHourDurationLen(Time start, Time end, int workingHoursOfDay, int startHour)
          Calculate hours from start time to end time, with all rest-out hours as one hour.
static int calcWorkingHours(Time start, Time end, int workingHoursOfDay, int startHour)
          Calculate actual working hours, by specifying working hours of day and working start hour, in time duration.
static Time cloneTimeByDateOffset(Time time, int offset)
          Deprecated. to Time
static Time cloneTimeByHourOffset(Time time, int offset)
          Deprecated. to Time
static Time cloneTimeByMonthOffset(Time time, int offset)
          Deprecated. to Time
static Time cloneTimeByWeekOffset(Time time, int offset)
          Deprecated. to Time
static Time cloneTimeByYearOffset(Time time, int offset)
          Deprecated. to Time
static int getDaysOfMonth(Time Time)
          Deprecated. to Time
static void truncateTime(Time time, int field)
          Deprecated. to Time
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarUtils

public CalendarUtils()
Method Detail

getDaysOfMonth

public static int getDaysOfMonth(Time Time)
Deprecated. to Time

Get amount of days in a month

Parameters:
month -
Returns:
int

truncateTime

public static void truncateTime(Time time,
                                int field)
Deprecated. to Time

Truncate time by given Time filed, exclude any Week.

Parameters:
time -
field - The field of Time to keep.

calcWorkingDays

public static int calcWorkingDays(Time start,
                                  int dates)
Parameters:
start -
dates -
Returns:

calcWorkingDays

public static int calcWorkingDays(Time start,
                                  Time end,
                                  int[] workingDurationInWeek)
Calculate working days from start day to end day(incluing end day). workingDurationInWeek represent the index of start working day and end working day in a week.

Parameters:
start -
end -
workingDurationInWeek -
Returns:

calcWorkingHourDurationLen

public static int calcWorkingHourDurationLen(Time start,
                                             Time end,
                                             int workingHoursOfDay,
                                             int startHour)
Calculate hours from start time to end time, with all rest-out hours as one hour.

Parameters:
start -
end -
workingHoursOfDay - Working hours of a day.
startHour -
Returns:

calcWorkingHours

public static int calcWorkingHours(Time start,
                                   Time end,
                                   int workingHoursOfDay,
                                   int startHour)
Calculate actual working hours, by specifying working hours of day and working start hour, in time duration.

Parameters:
start -
end -
workingHoursOfDay -
startHour -
Returns:

cloneTimeByDateOffset

public static Time cloneTimeByDateOffset(Time time,
                                         int offset)
Deprecated. to Time

Parameters:
time -
offset -
Returns:

cloneTimeByHourOffset

public static Time cloneTimeByHourOffset(Time time,
                                         int offset)
Deprecated. to Time

Parameters:
time -
offset -
Returns:

cloneTimeByWeekOffset

public static Time cloneTimeByWeekOffset(Time time,
                                         int offset)
Deprecated. to Time

Parameters:
time -
offset -
Returns:

cloneTimeByMonthOffset

public static Time cloneTimeByMonthOffset(Time time,
                                          int offset)
Deprecated. to Time

Parameters:
time -
offset -
Returns:

cloneTimeByYearOffset

public static Time cloneTimeByYearOffset(Time time,
                                         int offset)
Deprecated. to Time

Parameters:
time -
offset -
Returns: