com.google.caliper.util
Class ShortDuration

java.lang.Object
  extended by com.google.caliper.util.ShortDuration
All Implemented Interfaces:
Comparable<ShortDuration>

public abstract class ShortDuration
extends Object
implements Comparable<ShortDuration>

Represents a nonnegative duration from 0 to 100 days, with picosecond precision. Contrast with Joda-Time's duration class, which has only millisecond precision but can represent durations of millions of years.


Method Summary
abstract  ShortDuration dividedBy(BigDecimal divisor, RoundingMode roundingMode)
          Returns an instance of this type that represents this value divided by divisor, rounded according to roundingMode if necessary.
abstract  ShortDuration dividedBy(long divisor, RoundingMode roundingMode)
          Returns an instance of this type that represents this value divided by the integral value divisor, rounded according to roundingMode if necessary.
abstract  ShortDuration minus(ShortDuration subtrahend)
          Returns an instance of this type that represents the difference of this value and subtrahend.
static ShortDuration of(BigDecimal duration, TimeUnit unit)
           
static ShortDuration of(long duration, TimeUnit unit)
           
abstract  ShortDuration plus(ShortDuration addend)
          Returns an instance of this type that represents the sum of this value and addend.
abstract  ShortDuration times(BigDecimal multiplicand, RoundingMode roundingMode)
          Returns an instance of this type that represents the product of this value and multiplicand, rounded according to roundingMode if necessary.
abstract  ShortDuration times(long multiplicand)
          Returns an instance of this type that represents the product of this value and the integral value multiplicand.
 long to(TimeUnit unit)
           
abstract  long to(TimeUnit unit, RoundingMode roundingMode)
           
static ShortDuration valueOf(String s)
           
static ShortDuration zero()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

of

public static ShortDuration of(long duration,
                               TimeUnit unit)

of

public static ShortDuration of(BigDecimal duration,
                               TimeUnit unit)

valueOf

public static ShortDuration valueOf(String s)

zero

public static ShortDuration zero()

to

public long to(TimeUnit unit)

to

public abstract long to(TimeUnit unit,
                        RoundingMode roundingMode)

plus

public abstract ShortDuration plus(ShortDuration addend)
Returns an instance of this type that represents the sum of this value and addend.


minus

public abstract ShortDuration minus(ShortDuration subtrahend)
Returns an instance of this type that represents the difference of this value and subtrahend.


times

public abstract ShortDuration times(long multiplicand)
Returns an instance of this type that represents the product of this value and the integral value multiplicand.


times

public abstract ShortDuration times(BigDecimal multiplicand,
                                    RoundingMode roundingMode)
Returns an instance of this type that represents the product of this value and multiplicand, rounded according to roundingMode if necessary.

If this class represents an amount that is "continuous" rather than discrete, the implementation of this method may simply ignore the rounding mode.


dividedBy

public abstract ShortDuration dividedBy(long divisor,
                                        RoundingMode roundingMode)
Returns an instance of this type that represents this value divided by the integral value divisor, rounded according to roundingMode if necessary.

If this class represents an amount that is "continuous" rather than discrete, the implementation of this method may simply ignore the rounding mode.


dividedBy

public abstract ShortDuration dividedBy(BigDecimal divisor,
                                        RoundingMode roundingMode)
Returns an instance of this type that represents this value divided by divisor, rounded according to roundingMode if necessary.

If this class represents an amount that is "continuous" rather than discrete, the implementation of this method may simply ignore the rounding mode.



Copyright © 2009-2011 Google, Inc.. All Rights Reserved.