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
Constructor | Description |
---|---|
Duration() | Initializes a new instance of the Duration struct with a specified TimeSpan value and TimeUnitType. |
Methods
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
that | Duration | another instance. |
add(Duration d)
public final Duration add(Duration d)
Adds specified duration to this duration.
Parameters:
Parameter | Type | Description |
---|---|---|
d | Duration | specified 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:
Parameter | Type | Description |
---|---|---|
val | double | the 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:
Parameter | Type | Description |
---|---|---|
timeUnitType | byte | the 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:
Parameter | Type | Description |
---|---|---|
other | Duration | The 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:
Parameter | Type | Description |
---|---|---|
obj1 | Duration | the first object to compare. |
obj2 | Duration | the 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:
Parameter | Type | Description |
---|---|---|
obj | java.lang.Object | The 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:
Parameter | Type | Description |
---|---|---|
a | Duration | The first duration. |
b | Duration | The 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:
Parameter | Type | Description |
---|---|---|
a | Duration | The first duration. |
b | Duration | The 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:
Parameter | Type | Description |
---|---|---|
p | Project | the specified instance of Project class to convert duration for. |
value | java.lang.String | the 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:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | the 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:
Parameter | Type | Description |
---|---|---|
d | Duration | the 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:
Parameter | Type | Description |
---|---|---|
val | double | specified 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.