Class Duration
- java.lang.Object
-
- com.aspose.ms.System.ValueType<T>
-
- com.aspose.ms.lang.Struct<Duration>
-
- com.aspose.tasks.Duration
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Duration
add(double val)
Adds specified double value to this duration.Duration
add(Duration d)
Adds specified duration to this duration.Object
clone()
Duration
Clone()
Creates and returns a deep copy of this instance.void
CloneTo(Duration that)
Makes a deep copy of the instance into another instance.Duration
convert(int timeUnitType)
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 specifiedobj1
instance is equal to the specifiedobj2
instance.boolean
equals(Object obj)
Returns a value indicating whether this instance is equal to a specified object.double
getTimeSpan()
int
getTimeUnit()
Gets time unit type for this object.int
hashCode()
Returns a hash code value for this object.boolean
isElapsed()
Gets a value indicating whether time unit is elapsed.boolean
isEstimated()
Gets a value indicating whether time unit is estimated.static boolean
op_Equality(Duration a, Duration b)
Returns a value indicating whether this instance is equal to a specified object.static boolean
op_Inequality(Duration a, Duration b)
Returns a value indicating whether this instance is not equal to a specified object.static Duration
parse(Project p, String value)
Converts the specified string to the instance ofDuration
struct.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 todouble
value.String
toString()
Returns a string representation of this instance.
-
-
-
Constructor Detail
-
Duration
public Duration()
Initializes a new instance of the
Duration
struct with a specified TimeSpan value and TimeUnitType.
-
-
Method Detail
-
Clone
public Duration Clone()
Creates and returns a deep copy of this instance.- Specified by:
Clone
in classcom.aspose.ms.System.ValueType<Duration>
- Returns:
- a deep copy of this object.
-
CloneTo
public void CloneTo(Duration that)
Makes a deep copy of the instance into another instance.- Specified by:
CloneTo
in classcom.aspose.ms.System.ValueType<Duration>
- Parameters:
that
- another instance.
-
add
public final Duration add(Duration d)
Adds specified duration to this duration.
- Parameters:
d
- specifiedDuration
to add to this instance.- Returns:
- New duration object that represents the value of this instance plus the specified duration value.
-
add
public final Duration add(double val)
Adds specified double value to this duration.
- Parameters:
val
- the specifieddouble
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()
- Returns:
-
convert
public final Duration convert(int timeUnitType)
Converts Duration object to another duration with specified time units.
- Parameters:
timeUnitType
- the specified time unit type.- Returns:
- returns new duration with the specified unit type.
-
equals
public final 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 True if other Duration instance has the same TimeSpan and TimeUnit values as this instance; otherwise, false.
-
equals
public boolean equals(Object obj)
Returns a value indicating whether this instance is equal to a specified object.
- Specified by:
equals
in interfacecom.aspose.ms.System.IEquatable<Duration>
- Overrides:
equals
in classObject
- Parameters:
obj
- The object to compare with this instance.- Returns:
- True if the specified object is a Duration that has the same TimeSpan and TimeUnit values as this instance; otherwise, false.
-
equals
public static boolean equals(Duration obj1, Duration obj2)
Returns a value indicating whether specifiedobj1
instance is equal to the specifiedobj2
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 specifiedobj2
instance; otherwise, false.
-
getTimeSpan
public final double getTimeSpan()
Gets
Value: The TimeSpan instance of this Duration object.TimeSpan
(getTimeSpan()
/setTimeSpan(TimeSpan)
) instance of this Duration object.- Returns:
TimeSpan
(getTimeSpan()
/setTimeSpan(TimeSpan)
) instance of this Duration object.
-
getTimeUnit
public final int getTimeUnit()
Gets time unit type for this object.
Value: The time unit type of this Duration instance.- Returns:
- time unit type for this object.
-
hashCode
public int hashCode()
Returns a hash code value for this object.
-
isElapsed
public final boolean isElapsed()
Gets a value indicating whether time unit is elapsed.
Value: The flag which determines whether this Duration instance is elapsed.- Returns:
- a value indicating whether time unit is elapsed.
-
isEstimated
public final boolean isEstimated()
Gets a value indicating whether time unit is estimated.
Value: The flag which determines whether this Duration instance is estimated.- Returns:
- a value indicating whether time unit is estimated.
-
op_Equality
public static boolean op_Equality(Duration a, Duration b)
Returns a value indicating whether this instance is equal to a specified object.
- Parameters:
a
- The first duration.b
- The second duration.- Returns:
- a value indicating whether this instance is equal to a specified object
-
op_Inequality
public static boolean op_Inequality(Duration a, Duration b)
Returns a value indicating whether this instance is not equal to a specified object.
- Parameters:
a
- The first duration.b
- The second duration.- Returns:
- a value indicating whether this instance is not equal to a specified object
-
parse
public static Duration parse(Project p, String value)
Converts the specified string to the instance of
Duration
struct.
-
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
(getTimeSpan()
/setTimeSpan(TimeSpan)
) struct.
-
subtract
public final Duration subtract(Duration d)
Subtracts specified duration from this duration instance.
- Parameters:
d
- the specifiedDuration
instance to subtract from this instance.- Returns:
- New duration object that represents the value of this instance minus the specified duration value.
-
subtract
public final Duration subtract(double val)
Subtracts specified double value from this duration instance.
- Parameters:
val
- specifieddouble
value to subtract from this instance.- Returns:
- New duration object that represents the value of this instance minus the specified duration value.
-
toDouble
public final double toDouble()
Converts Duration object to
double
value.- Returns:
- Converted value.
-
-