Class DetailedWorkHours

java.lang.Object
com.primavera.common.value.DetailedWorkHours
All Implemented Interfaces:
Serializable

public class DetailedWorkHours extends Object implements 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 Details

    • WORKTIME_9_TO_5

      public static final long WORKTIME_9_TO_5
      The default work-time map: 9:00am-16:59
      See Also:
    • WORKTIME_8_TO_5

      public static final long WORKTIME_8_TO_5
      The 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_5
      The 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_5
      The 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_12
      The default work-time map: 8:00-11:59
      See Also:
    • WORKTIME_1_TO_5

      public static final long WORKTIME_1_TO_5
      The default work-time map: 13:00-16:59
      See Also:
  • Constructor Details

    • DetailedWorkHours

      public DetailedWorkHours(long lTimeMap)
      Constructs a DetailedWorkHours object with the given long time list.
      Parameters:
      lTimeMap - The lower 48 bits of lTimeMap indicate the half hours to be on or off.
    • DetailedWorkHours

      public DetailedWorkHours(String sTimeList) throws ValueObjectException
      Constructs a DetailedWorkHours object 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

      public boolean isTimeOn(double dIndex) throws ValueObjectException
      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

      public boolean isTimeOn(String sTime) throws ValueObjectException
      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

      public void turnTimeOn(double dStartIndex, double dEndIndex) throws ValueObjectException
      Sets the time range to be work-time.
      Parameters:
      dStartIndex - the start time index
      dEndIndex - the end time index
      Throws:
      ValueObjectException - - if one or both time indexes are out of bounds
    • turnTimeOn

      public void turnTimeOn(String sStartTime, String sEndTime) throws ValueObjectException
      Sets the time range to be work-time.
      Parameters:
      sStartTime - - the start time
      sEndTime - - the end time
      Throws:
      ValueObjectException - - if the time value is invalid or the time index is out of bounds
    • turnTimeOff

      public void turnTimeOff(double dStartIndex, double dEndIndex) throws ValueObjectException
      Sets the time range to be non-work-time.
      Parameters:
      dStartIndex - the start time index, from 0 to 23.5
      dEndIndex - the end time index, from 0 to 23.5
      Throws:
      ValueObjectException - - if either or both time indexes are out of bounds
    • turnTimeOff

      public void turnTimeOff(String sStartTime, String sEndTime) throws ValueObjectException
      Sets the time range to be non-work-time.
      Parameters:
      sStartTime - the start time
      sEndTime - 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.5
      dEndIndex - 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 time
      sEndTime - 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

      public String getTimeBitmapAsString()
      Gets a time bit map as a String for this object .
      Returns:
      the time bit map as a String
    • getTimeString

      public 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.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • equals

      public boolean equals(Object parm1)
      Compares this object against the specified object. The result is true if and only if the argument is not null and is a DetailedWorkHours object that has exactly the same time map long value.
      Overrides:
      equals in class Object
      Parameters:
      parm1 - the reference object with which to compare.
      Returns:
      true if the day maps equal. false otherwise.