Class DurationTime

java.lang.Object
com.polarion.core.util.types.duration.DurationTime
All Implemented Interfaces:
Serializable, Cloneable

public class DurationTime extends Object implements Serializable, Cloneable
Author:
Jiri Banszel, Polarion Software
See Also:
  • Field Details

  • Constructor Details

    • DurationTime

      @Deprecated public DurationTime(String[] units, boolean allowMixedUnits)
      Deprecated.
    • DurationTime

      @Deprecated public DurationTime(boolean negative, String[] units, boolean allowMixedUnits)
      Deprecated.
      Parameters:
      allowMixedUnits -
      Since:
      3.3
  • Method Details

    • setCoefficients

      @Deprecated public void setCoefficients(Fraction[] coefficients)
      Deprecated.
    • isNegative

      public boolean isNegative()
      Since:
      3.3
    • setNegative

      public void setNegative(boolean negative)
      Since:
      3.3
    • getMillisPerDay

      public static long getMillisPerDay()
      Since:
      3.7.1
    • getMillis

      public long getMillis()
      Returns the duration in milliseconds.
      Since:
      3.7.1
    • getHours

      public float getHours()
      Returns the duration in hours.
      Since:
      3.7.1
    • fromHours

      public static DurationTime fromHours(float hours)
      Warning: Experimental, precision of conversion can change in the future.
      Since:
      3.7.1
    • fromString

      public static DurationTime fromString(String s)
      Parses duration from a string in decimal format (e.g. "1.5", "1.5h") or in days-hours format (e.g. "1d 3h"). Returns null for empty or null input.

      Warning: Experimental, precision of conversion can change in the future.

      Since:
      3.7.1
    • add

      public void add(DurationTime durationTime)
      Adds another DurationTime instance (by adding respective time unit's multiplicity).
    • isZero

      public boolean isZero()
    • toCollapsedForm

      public void toCollapsedForm(long oneDayLength)
    • parseDuration

      public DurationTime parseDuration(String duration)
      Returns instance of DurationTime that represents given string.
    • isValid

      public boolean isValid(String duration)
      Checks whether given string is a valid duration description.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Object clone()
      Since:
      3.3.2
    • getLength

      @Deprecated public long getLength(long oneDayLength)
      Deprecated.
    • getLength

      @Deprecated public long getLength()
      Deprecated.
    • getInDays

      @Deprecated public float getInDays()
      Deprecated.
    • getInMonths

      @Deprecated public float getInMonths()
      Deprecated.
    • getInYears

      @Deprecated public float getInYears()
      Deprecated.