public final class Duration extends Object implements Comparable<Duration>
Modifier and Type | Method and Description |
---|---|
static Duration |
add(Duration a,
Duration b,
TimeUnitDefaultsContainer defaults)
If a and b are not null, returns a new duration of a + b.
|
int |
compareTo(Duration rhs) |
static Duration |
convertUnits(double duration,
TimeUnit fromUnits,
TimeUnit toUnits,
double minutesPerDay,
double minutesPerWeek,
double daysPerMonth)
This method provides an approximate conversion between duration
units.
|
static Duration |
convertUnits(double duration,
TimeUnit fromUnits,
TimeUnit toUnits,
TimeUnitDefaultsContainer defaults)
This method provides an approximate conversion between duration
units.
|
Duration |
convertUnits(TimeUnit type,
TimeUnitDefaultsContainer defaults)
This method provides an approximate conversion between duration
units.
|
boolean |
durationComponentEquals(Duration rhs)
Equality test for duration component of a Duration instance.
|
static boolean |
durationValueEquals(double lhs,
double rhs)
Equality test for two duration values.
|
boolean |
equals(Object o) |
double |
getDuration()
This method is used to retrieve the size of the duration.
|
static Duration |
getInstance(double duration,
TimeUnit type)
Retrieve a Duration instance.
|
static Duration |
getInstance(int duration,
TimeUnit type)
Retrieve a Duration instance.
|
TimeUnit |
getUnits()
This method is used to retrieve the type of units the duration
is expressed in.
|
int |
hashCode() |
String |
toString() |
public double getDuration()
public TimeUnit getUnits()
public Duration convertUnits(TimeUnit type, TimeUnitDefaultsContainer defaults)
type
- target duration typedefaults
- project properties containing default valuespublic static Duration convertUnits(double duration, TimeUnit fromUnits, TimeUnit toUnits, TimeUnitDefaultsContainer defaults)
duration
- duration valuefromUnits
- units to convert fromtoUnits
- units to convert todefaults
- project properties containing default valuespublic static Duration convertUnits(double duration, TimeUnit fromUnits, TimeUnit toUnits, double minutesPerDay, double minutesPerWeek, double daysPerMonth)
duration
- duration valuefromUnits
- units to convert fromtoUnits
- units to convert tominutesPerDay
- number of minutes per dayminutesPerWeek
- number of minutes per weekdaysPerMonth
- number of days per monthpublic static Duration getInstance(double duration, TimeUnit type)
duration
- duration valuetype
- duration typepublic static Duration getInstance(int duration, TimeUnit type)
duration
- duration valuetype
- duration typepublic int compareTo(Duration rhs)
compareTo
in interface Comparable<Duration>
public boolean durationComponentEquals(Duration rhs)
rhs
- duration to comparepublic static boolean durationValueEquals(double lhs, double rhs)
lhs
- duration valuerhs
- duration valuepublic static Duration add(Duration a, Duration b, TimeUnitDefaultsContainer defaults)
a
- first durationb
- second durationdefaults
- project properties containing default valuesCopyright © 2000–2024 Packwood Software. All rights reserved.