Class BusinessDuration

    • Field Detail

      • UNINITIALIZED_BUSINESS_DURATION

        public static final BusinessDuration UNINITIALIZED_BUSINESS_DURATION
        business duration where all time values are set to zero
        API:
        This public API is available in Java.
    • Constructor Detail

      • BusinessDuration

        public BusinessDuration​(int hours,
                                int minutes,
                                int seconds)
        Creates a new not normalized BusinessDuration.
        Parameters:
        hours -
        minutes -
        seconds -
        See Also:
        normalize()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • BusinessDuration

        public BusinessDuration​(long initialSeconds)
        Creates a normalized business duration with a given amount of seconds.
        Parameters:
        initialSeconds -
        See Also:
        normalize()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • Method Detail

      • getHours

        public int getHours()
        Returns:
        The hour part of the business duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getMinutes

        public int getMinutes()
        Returns:
        The minute part of the business duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getSeconds

        public int getSeconds()
        Returns:
        The second part of the business duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • multiply

        public BusinessDuration multiply​(Number factor)
        Multiplies the BusinessDuration with a factor.
        Parameters:
        factor - multiplier
        Returns:
        A new BusinessDuration not normalized instance which represent the result of this multiplication.
        See Also:
        normalize()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • divide

        public BusinessDuration divide​(Number divisor)
        Divides the BusinessDuration by a divisor.
        Parameters:
        divisor -
        Returns:
        A new BusinessDuration normalized instance which represents the result of the division.
        See Also:
        normalize()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • normalize

        public BusinessDuration normalize()
        Returns a normalized duration. A Duration is normalized, if seconds, minutes, and hours have the same sign, the absolute values of seconds and minutes are smaller than 60. Hours will never be normalized.
        E.g.
            BusinessDuration(0,2,90).normalize() -> BusinessDuration(0,3,30)
            BusinessDuration(5,62,61).normalize() -> BusinessDuration(6,3,1)
            BusinessDuration(28,0,0).normalize() -> BusinessDuration(28,0,0)
            BusinessDuration(0,4,-90).normalize() -> BusinessDuration(0,2,30)
         
        Returns:
        A new normalized BusinessDuration instance.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • equals

        public boolean equals​(Object otherObj)
        Indicates whether a BusinessDuration object is "equal to" this one.
        Returns:
        only true for business durations if all fields (hours, minutes, seconds) are equal. E.g.
              BusinessDuration(0,1,30).equals(BusinessDuration(0,1,30)) -> true
              BusinessDuration(0,1,30).equals(BusinessDuration(0,0,90))  -> false
              BusinessDuration(0,1,30).equals(BusinessDuration(0,0,90).normalize())  -> true
            
        See Also:
        Object.equals(java.lang.Object)
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • hashCode

        public int hashCode()
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • toString

        public String toString()
        Returns the duration as String in the ISO-8601 format. E.g.
            BusinessDuration(1,2,3).toString() -> "1H2M3S"
            BusinessDuration(0,0,3).toString() -> "3S"
            BusinessDuration(0,0,0).toString() -> "0S"
            UNINITIALIZED_BUSINESS_DURATION.toString() -> ""
         
        See Also:
        Object.toString()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toNumber

        public long toNumber()
        Converts the BusinessDuration into a Number.
        Returns:
        Number of all seconds that represent the BusinessDuration
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • compareTo

        public int compareTo​(BusinessDuration otherDuration)
        Compares two durations lexicographically.
        Parameters:
        otherDuration - another BusinessDuration.
        Returns:
        1 if the receiver is smaller than the argument,
        0 if the receiver is equal to the argument,
        -1 if the receiver is greater than the argument.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • clone

        public BusinessDuration clone()
        Creates a clone of this object.
        Specified by:
        clone in interface IIvyDataObject
        Returns:
        A shallow clone.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.