Duration

Inheritance: java.lang.Object, com.aspose.ms.System.ValueType, com.aspose.ms.lang.Struct

All Implemented Interfaces: com.aspose.ms.System.IEquatable

public class Duration extends Struct<Duration> implements System.IEquatable<Duration>

Represents duration in a project.

Constructors

ConstructorDescription
Duration()Initializes a new instance of the Duration struct with a specified TimeSpan value and TimeUnitType.

Methods

MethodDescription
Clone()Creates and returns a deep copy of this instance.
CloneTo(Duration that)Makes a deep copy of the instance into another instance.
add(Duration d)Adds specified duration to this duration.
add(double val)Adds specified double value to this duration.
clone(){@inheritDoc}
convert(byte timeUnitType)Converts Duration object to another duration with specified time units.
equals(Duration other)Returns a value indicating whether this instance is equal to a specified object.
equals(Duration obj1, Duration obj2)Returns a value indicating whether specified obj1 instance is equal to the specified obj2 instance.
equals(Object obj)Returns a value indicating whether this instance is equal to a specified object.
getTimeSpan()Gets TimeSpan(getTimeSpan/setTimeSpan(TimeSpan)) instance of this Duration object.
getTimeUnit()Gets time unit type for this object.
hashCode()Returns a hash code value for this object.
isElapsed()Gets a value indicating whether time unit is elapsed.
isEstimated()Gets a value indicating whether time unit is estimated.
op_Equality(Duration a, Duration b)Returns a value indicating whether this instance is equal to a specified object.
op_Inequality(Duration a, Duration b)Returns a value indicating whether this instance is not equal to a specified object.
parse(Project p, String value)Converts the specified string to the instance of Duration struct.
parseTimeSpan(String value)Parses duration string in format “PT–H–M–S–”.
subtract(Duration d)Subtracts specified duration from this duration instance.
subtract(double val)Subtracts specified double value from this duration instance.
toDouble()Converts Duration object to double value.
toString()Returns a string representation of this instance.

Duration()

public Duration()

Initializes a new instance of the Duration struct with a specified TimeSpan value and TimeUnitType.

Clone()

public Duration Clone()

Creates and returns a deep copy of this instance.

Returns: Duration - a deep copy of this object.

CloneTo(Duration that)

public void CloneTo(Duration that)

Makes a deep copy of the instance into another instance.

Parameters:

ParameterTypeDescription
thatDurationanother instance.

add(Duration d)

public final Duration add(Duration d)

Adds specified duration to this duration.

Parameters:

ParameterTypeDescription
dDurationspecified Duration to add to this instance.

Returns: Duration - New duration object that represents the value of this instance plus the specified duration value.

add(double val)

public final Duration add(double val)

Adds specified double value to this duration.

Parameters:

ParameterTypeDescription
valdoublethe specified double value to add to this instance.

Returns: Duration - New duration object that represents the value of this instance plus the specified duration value.

clone()

public Object clone()

Returns: java.lang.Object - {@inheritDoc}

convert(byte timeUnitType)

public final Duration convert(byte timeUnitType)

Converts Duration object to another duration with specified time units.

Parameters:

ParameterTypeDescription
timeUnitTypebytethe specified time unit type.

Returns: Duration - returns new duration with the specified unit type.

equals(Duration other)

public final boolean equals(Duration other)

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

Parameters:

ParameterTypeDescription
otherDurationThe object to compare with this instance.

Returns: boolean - Returns True if other Duration instance has the same TimeSpan and TimeUnit values as this instance; otherwise, false.

equals(Duration obj1, Duration obj2)

public static boolean equals(Duration obj1, Duration obj2)

Returns a value indicating whether specified obj1 instance is equal to the specified obj2 instance.

Parameters:

ParameterTypeDescription
obj1Durationthe first object to compare.
obj2Durationthe second object to compare.

Returns: boolean - returns true if specified obj1 instance is equal to the specified obj2 instance; otherwise, false.

equals(Object obj)

public boolean equals(Object obj)

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

Parameters:

ParameterTypeDescription
objjava.lang.ObjectThe object to compare with this instance.

Returns: boolean - True if the specified object is a Duration that has the same TimeSpan and TimeUnit values as this instance; otherwise, false.

getTimeSpan()

public final double getTimeSpan()

Gets TimeSpan(getTimeSpan/setTimeSpan(TimeSpan)) instance of this Duration object.

Value: The TimeSpan instance of this Duration object.

Returns: double - TimeSpan(getTimeSpan/setTimeSpan(TimeSpan)) instance of this Duration object.

getTimeUnit()

public final byte getTimeUnit()

Gets time unit type for this object.

Value: The time unit type of this Duration instance.

Returns: byte - time unit type for this object.

hashCode()

public int hashCode()

Returns a hash code value for this object.

Returns: int - returns a hash code value for this duration instance.

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: boolean - 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: boolean - a value indicating whether time unit is estimated.

op_Equality(Duration a, Duration b)

public static boolean op_Equality(Duration a, Duration b)

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

Parameters:

ParameterTypeDescription
aDurationThe first duration.
bDurationThe second duration.

Returns: boolean - a value indicating whether this instance is equal to a specified object

op_Inequality(Duration a, Duration b)

public static boolean op_Inequality(Duration a, Duration b)

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

Parameters:

ParameterTypeDescription
aDurationThe first duration.
bDurationThe second duration.

Returns: boolean - a value indicating whether this instance is not equal to a specified object

parse(Project p, String value)

public static Duration parse(Project p, String value)

Converts the specified string to the instance of Duration struct.

Parameters:

ParameterTypeDescription
pProjectthe specified instance of Project class to convert duration for.
valuejava.lang.Stringthe specified string to convert.

Returns: Duration - Returns the converted instance of Duration struct.

parseTimeSpan(String value)

public static double parseTimeSpan(String value)

Parses duration string in format “PT–H–M–S–”.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringthe specified string to parse.

Returns: double - returns parsed instance of the TimeSpan(getTimeSpan/setTimeSpan(TimeSpan)) struct.

subtract(Duration d)

public final Duration subtract(Duration d)

Subtracts specified duration from this duration instance.

Parameters:

ParameterTypeDescription
dDurationthe specified Duration instance to subtract from this instance.

Returns: Duration - New duration object that represents the value of this instance minus the specified duration value.

subtract(double val)

public final Duration subtract(double val)

Subtracts specified double value from this duration instance.

Parameters:

ParameterTypeDescription
valdoublespecified double value to subtract from this instance.

Returns: Duration - 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: double - Converted value.

toString()

public String toString()

Returns a string representation of this instance.

Returns: java.lang.String - a string representation of this instance.