Package com.primavera.common.value
Class DetailedWorkHours
java.lang.Object
com.primavera.common.value.DetailedWorkHours
- All Implemented Interfaces:
Serializable
This value type is used to define work-time for a particular day. The resolution is 30 minutes
(half an hour)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default work-time map: 13:00-16:59static final longThe default work-time map: 8:00-11:59static final longThe default work-time map: 8:00-11:59 and 13:00-16:59static final longThe default work-time map: 8:00-16:59static final longThe default work-time map: 9:00-11:59 and 13:00-16:59static final longThe default work-time map: 9:00am-16:59 -
Constructor Summary
ConstructorsConstructorDescriptionDetailedWorkHours(long lTimeMap) Constructs aDetailedWorkHoursobject with the given long time list.DetailedWorkHours(String sTimeList) Constructs aDetailedWorkHoursobject with the given String time list. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this object against the specified object.doubleGets the finish of the work time.doubleGets the start of the work time.longGets a time map value for this object.static longgetTimeBitmapAsLong(double dStartIndex, double dEndIndex) Gets a time map value with given time range .static longgetTimeBitmapAsLong(String sStartTime, String sEndTime) Gets a time map value for the given time range.Gets a time bit map as a String for this object .Gets a time string for this object.doubleGets the total work time in minutes for this object.inthashCode()Returns a hash code for this object.booleanisTimeOn(double dIndex) Indicates if the given time is work-time.booleanIndicates if the given time is work-time.voidturnTimeOff(double dStartIndex, double dEndIndex) Sets the time range to be non-work-time.voidturnTimeOff(String sStartTime, String sEndTime) Sets the time range to be non-work-time.voidturnTimeOn(double dStartIndex, double dEndIndex) Sets the time range to be work-time.voidturnTimeOn(String sStartTime, String sEndTime) Sets the time range to be work-time.
-
Field Details
-
WORKTIME_9_TO_5
public static final long WORKTIME_9_TO_5The default work-time map: 9:00am-16:59- See Also:
-
WORKTIME_8_TO_5
public static final long WORKTIME_8_TO_5The default work-time map: 8:00-16:59- See Also:
-
WORKTIME_9_TO_12_AND_1_TO_5
public static final long WORKTIME_9_TO_12_AND_1_TO_5The default work-time map: 9:00-11:59 and 13:00-16:59- See Also:
-
WORKTIME_8_TO_12_AND_1_TO_5
public static final long WORKTIME_8_TO_12_AND_1_TO_5The default work-time map: 8:00-11:59 and 13:00-16:59- See Also:
-
WORKTIME_8_TO_12
public static final long WORKTIME_8_TO_12The default work-time map: 8:00-11:59- See Also:
-
WORKTIME_1_TO_5
public static final long WORKTIME_1_TO_5The default work-time map: 13:00-16:59- See Also:
-
-
Constructor Details
-
DetailedWorkHours
public DetailedWorkHours(long lTimeMap) Constructs aDetailedWorkHoursobject with the given long time list.- Parameters:
lTimeMap- The lower 48 bits of lTimeMap indicate the half hours to be on or off.
-
DetailedWorkHours
Constructs aDetailedWorkHoursobject with the given String time list.- Parameters:
sTimeList- a semicolon-delimited string of work-time that includes the finish minutes: "0:30-5:29;8:00-11:59;22:00-23:59;"- Throws:
ValueObjectException- if the time list is invalid
-
-
Method Details
-
isTimeOn
Indicates if the given time is work-time.- Parameters:
dIndex- - time index, from 0 to 23.5- Returns:
- true if the given time is work-time
- Throws:
ValueObjectException- - if the time index is out of bounds
-
isTimeOn
Indicates if the given time is work-time.- Parameters:
sTime- time value- Returns:
- true if the given time is work-time
- Throws:
ValueObjectException- - if the time value is invalid or the time index is out of bounds
-
turnTimeOn
Sets the time range to be work-time.- Parameters:
dStartIndex- the start time indexdEndIndex- the end time index- Throws:
ValueObjectException- - if one or both time indexes are out of bounds
-
turnTimeOn
Sets the time range to be work-time.- Parameters:
sStartTime- - the start timesEndTime- - the end time- Throws:
ValueObjectException- - if the time value is invalid or the time index is out of bounds
-
turnTimeOff
Sets the time range to be non-work-time.- Parameters:
dStartIndex- the start time index, from 0 to 23.5dEndIndex- the end time index, from 0 to 23.5- Throws:
ValueObjectException- - if either or both time indexes are out of bounds
-
turnTimeOff
Sets the time range to be non-work-time.- Parameters:
sStartTime- the start timesEndTime- the end time- Throws:
ValueObjectException- if the time value is invalid or the time index is out of bounds
-
getTimeBitmapAsLong
public static long getTimeBitmapAsLong(double dStartIndex, double dEndIndex) throws ValueObjectException Gets a time map value with given time range .- Parameters:
dStartIndex- the start time index, from 0 to 23.5dEndIndex- the end time index, from 0 to 23.5- Returns:
- the time map
- Throws:
ValueObjectException- if either or both time indexes are out of bounds
-
getTimeBitmapAsLong
public static long getTimeBitmapAsLong(String sStartTime, String sEndTime) throws ValueObjectException Gets a time map value for the given time range.- Parameters:
sStartTime- the start timesEndTime- the end time- Returns:
- the time map
- Throws:
ValueObjectException- if the time value is invalid or the time index is out of bounds
-
getTimeBitmapAsLong
public long getTimeBitmapAsLong()Gets a time map value for this object.- Returns:
- the time map
-
getTimeBitmapAsString
Gets a time bit map as a String for this object .- Returns:
- the time bit map as a String
-
getTimeString
Gets a time string for this object.- Returns:
- the time String. i.e., "0:30-5:29;8:00-11:59;22:00-23:59;"
-
getTotalWorkHours
public double getTotalWorkHours()Gets the total work time in minutes for this object.- Returns:
- the total work time
-
getStartTime
public double getStartTime()Gets the start of the work time.- Returns:
- the start time as a double. Range is 0 to 23.5 for valid start times, or -1 for no work time.
-
getFinishTime
public double getFinishTime()Gets the finish of the work time.- Returns:
- the finish time as a double. Range is 0.5 to 24 for valid start times, or -1 for no work time.
-
hashCode
public int hashCode()Returns a hash code for this object. -
equals
Compares this object against the specified object. The result istrueif and only if the argument is notnulland is aDetailedWorkHoursobject that has exactly the same time map long value.
-