com.aspose.tasks

Interfaces

Classes

Exceptions

com.aspose.tasks

Class Duration



  • public class Duration
    extends Object

    Represents duration in a project.

    • Constructor Summary

      Constructors 
      Constructor and Description
      Duration()
      Default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Duration add(double val)
      Adds specified double value to this duration.
      Duration add(Duration d)
      Adds specified duration to this duration.
      Object clone()
      Creates and returns a copy of this Duration.
      Duration convert(int timeUnit)
      Converts Duration object to another duration with specified time units.
      boolean equals(Duration other)
      Returns a value indicating whether this instance is equal to a specified object.
      static boolean equals(Duration obj1, Duration obj2)
      Returns a value indicating whether specified obj1 instance is equal to the specified obj2 instance.
      boolean equals(Object obj)
      Returns a value indicating whether this instance is equal to a specified object.
      double getTimeSpan()
      Returns time span in milliseconds of this Duration object.
      int getTimeUnit()
      Returns time unit type of this Duration instance.
      int hashCode()
      Returns a hash code value for this object.
      boolean isElapsed()
      Gets a value indicating whether time unit is elapsed.
      boolean isEstimated()
      Returns true if time unit is estimated; otherwise, false.
      static Duration parse(Project p, String value)
      Converts the specified string to the instance of Duration class.
      static double parseTimeSpan(String value)
      Parses duration string in format "PT--H--M--S--".
      Duration subtract(double val)
      Subtracts specified double value from this duration instance.
      Duration subtract(Duration d)
      Subtracts specified duration from this duration instance.
      double toDouble()
      Converts Duration object to double value.
      String toString()
      Returns a string representation of this instance.
    • Constructor Detail

      • Duration

        public Duration()
        Default constructor.
    • Method Detail

      • getTimeSpan

        public double getTimeSpan()
        Returns time span in milliseconds of this Duration object.
        Returns:
        Returns time span in milliseconds of this Duration object.
      • getTimeUnit

        public int getTimeUnit()

        Returns time unit type of this Duration instance.

        Returns:
        Returns time unit type of this Duration instance.
      • isElapsed

        public boolean isElapsed()

        Gets a value indicating whether time unit is elapsed.

        Value: The flag which determines whether this Duration instance is elapsed.
        Returns:
        true if time unit is elapsed; otherwise, false.
      • isEstimated

        public boolean isEstimated()

        Returns true if time unit is estimated; otherwise, false.

        Returns:
        true if time unit is estimated; otherwise, false.
      • equals

        public static boolean equals(Duration obj1,
                                     Duration obj2)
        Returns a value indicating whether specified obj1 instance is equal to the specified obj2 instance.
        Parameters:
        obj1 - the first object to compare.
        obj2 - the second object to compare.
        Returns:
        returns true if specified obj1 instance is equal to the specified obj2 instance; otherwise, false.
      • parse

        public static Duration parse(Project p,
                                     String value)

        Converts the specified string to the instance of Duration class.

        Parameters:
        p - the specified instance of Project class to convert duration for.
        value - the specified string to convert.
        Returns:
        Returns the converted instance of Duration class.
      • parseTimeSpan

        public static double parseTimeSpan(String value)

        Parses duration string in format "PT--H--M--S--".

        Parameters:
        value - the specified string to parse.
        Returns:
        returns parsed instance of the TimeSpan struct.
      • add

        public Duration add(Duration d)

        Adds specified duration to this duration.

        Parameters:
        d - specified Duration to add to this instance.
        Returns:
        New duration object that represents the value of this instance plus the specified duration value.
      • add

        public Duration add(double val)

        Adds specified double value to this duration.

        Parameters:
        val - the specified double value to add to this instance.
        Returns:
        New duration object that represents the value of this instance plus the specified duration value.
      • clone

        public Object clone()
        Creates and returns a copy of this Duration.
        Overrides:
        clone in class Object
        Returns:
        returns a copy of this object.
      • convert

        public Duration convert(int timeUnit)

        Converts Duration object to another duration with specified time units.

        Parameters:
        timeUnit - the specified time unit type.
        Returns:
        returns new duration with the specified unit type.
      • equals

        public boolean equals(Duration other)

        Returns a value indicating whether this instance is equal to a specified object.

        Parameters:
        other - The object to compare with this instance.
        Returns:
        Returns <b>True</b> if other Duration instance has the same TimeSpan and TimeUnit values as this instance; otherwise, <b>false</b>.
      • equals

        public boolean equals(Object obj)

        Returns a value indicating whether this instance is equal to a specified object.

        Overrides:
        equals in class Object
        Parameters:
        obj - The object to compare with this instance.
        Returns:
        <b>True</b> if the specified object is a Duration that has the same TimeSpan and TimeUnit values as this instance; otherwise, <b>false</b>.
      • hashCode

        public int hashCode()

        Returns a hash code value for this object.

        Overrides:
        hashCode in class Object
        Returns:
        returns a hash code value for this duration instance.
      • subtract

        public Duration subtract(Duration d)

        Subtracts specified duration from this duration instance.

        Parameters:
        d - the specified Duration instance to subtract from this instance.
        Returns:
        New duration object that represents the value of this instance minus the specified duration value.
      • subtract

        public Duration subtract(double val)

        Subtracts specified double value from this duration instance.

        Parameters:
        val - specified double value to subtract from this instance.
        Returns:
        New duration object that represents the value of this instance minus the specified duration value.
      • toDouble

        public double toDouble()

        Converts Duration object to double value.

        Returns:
        Converted value.
      • toString

        public String toString()

        Returns a string representation of this instance.

        Overrides:
        toString in class Object
        Returns:
        a string representation of this instance.