

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object java.lang.Number org.modeshape.common.math.Duration
@Immutable public class Duration
A number representing an immutable duration of time. This is intended to be used in the same manner as other Number
subclasses.
Nested Class Summary  

class 
Duration.Components
The atomic components of this duration, broken down into whole hours, minutes and (fractional) seconds. 
Constructor Summary  

Duration(long nanos)
Create a duration given the number of nanoseconds. 

Duration(long duration,
TimeUnit unit)
Create a duration and the time unit. 
Method Summary  

Duration 
add(Duration duration)
Add the supplied duration to this duration, and return the result. 
Duration 
add(long duration,
TimeUnit unit)
Add the supplied duration to this duration, and return the result. 
int 
compareTo(Duration that)

double 
divide(Duration duration)
Divide the duration by another duration to calculate the ratio. 
Duration 
divide(long denominator)
Divide the duration by the supplied number, and return the result. 
double 
doubleValue()

float 
floatValue()

Duration.Components 
getComponents()
Return the duration components. 
long 
getDuratinInNanoseconds()
Return the total duration in nanoseconds. 
long 
getDuration(TimeUnit unit)
Get the duration value in the supplied unit of time. 
BigDecimal 
getDurationInMicroseconds()
Return the total duration in microseconds, which may contain a fraction part for the submicrosecond component. 
BigDecimal 
getDurationInMilliseconds()
Return the total duration in microseconds, which may contain a fraction part for the submicrosecond component. 
BigDecimal 
getDurationInSeconds()
Return the total duration in microseconds, which may contain a fraction part for the submicrosecond component. 
int 
intValue()

long 
longValue()

Duration 
multiply(long scale)
Multiply the duration by the supplied scale factor, and return the result. 
Duration 
subtract(Duration duration)
Subtract the supplied duration from this duration, and return the result. 
Duration 
subtract(long duration,
TimeUnit unit)
Subtract the supplied duration from this duration, and return the result. 
BigDecimal 
toBigDecimal()

String 
toString()
Writes the duration in a form containing hours, minutes, and seconds, including the fractional part of the seconds. 
Methods inherited from class java.lang.Number 

byteValue, shortValue 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Constructor Detail 

public Duration(long nanos)
nanos
 the number of nanoseconds in the durationpublic Duration(long duration, TimeUnit unit)
duration
 the duration in the supplied time unitsunit
 the time unitMethod Detail 

public double doubleValue()
doubleValue
in class Number
public float floatValue()
floatValue
in class Number
public int intValue()
intValue
in class Number
public long longValue()
longValue
in class Number
public BigDecimal toBigDecimal()
public Duration add(long duration, TimeUnit unit)
duration
 the duration to add to this objectunit
 the unit of the duration being added; may not be null
public Duration subtract(long duration, TimeUnit unit)
duration
 the duration to subtract from this objectunit
 the unit of the duration being subtracted; may not be null
public Duration add(Duration duration)
duration
 the duration to add to this object
public Duration subtract(Duration duration)
duration
 the duration to subtract from this object
public Duration multiply(long scale)
scale
 the factor by which the duration is to be scaled.
public Duration divide(long denominator)
denominator
 the factor by which the duration is to be divided.
public double divide(Duration duration)
duration
 the duration that this duration is to be divided by; may not be null
public int compareTo(Duration that)
compareTo
in interface Comparable<Duration>
public long getDuratinInNanoseconds()
public BigDecimal getDurationInMicroseconds()
public BigDecimal getDurationInMilliseconds()
public BigDecimal getDurationInSeconds()
public Duration.Components getComponents()
public long getDuration(TimeUnit unit)
unit
 the unit of time for the returned value; may not be null
public String toString()
HHH:MM:SS.mmm,mmm
, where
toString
in class Object


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 