JADE v6.1

com.dautelle.physics
Class Duration

java.lang.Object
  extended byjava.lang.Number
      extended bycom.dautelle.math.numbers.RealtimeNumber
          extended bycom.dautelle.physics.Quantity
              extended bycom.dautelle.physics.Duration
All Implemented Interfaces:
java.lang.Comparable, Operable, Realtime, Representable, java.io.Serializable

public class Duration
extends Quantity

This class represents a period of existence or persistence. The system unit for this quantity is "s" (Système International d'Unités).

Version:
4.1, February 10, 2003
Author:
Jean-Marie Dautelle
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.dautelle.physics.Quantity
Quantity.Factory, Quantity.Value
 
Field Summary
static Duration ZERO
          Represents a Duration amounting to nothing.
 
Constructor Summary
protected Duration()
          Default constructor (allows for derivation).
 
Method Summary
 java.util.Date addTo(java.util.Date date)
          Returns the date after the specified date.
static Duration between(java.util.Date from, java.util.Date to)
          Returns the Duration from the ellapsed time between two dates.
static Duration durationOf(Quantity quantity)
          Returns the Duration corresponding to the specified quantity.
static void showAs(Unit unit)
          Shows Duration instances in the specified unit.
 java.util.Date subtractFrom(java.util.Date date)
          Returns the date before the specified date.
 
Methods inherited from class com.dautelle.physics.Quantity
abs, add, appendTo, approxEquals, approxEquals, compareTo, divide, divide, doubleValue, doubleValue, equals, floatValue, floatValue, getAbsoluteError, getMaximum, getMinimum, getOutputUnit, getRelativeError, getSystemUnit, hashCode, intValue, intValue, inverse, isPossiblyZero, longValue, longValue, multiply, multiply, negate, opposite, plus, pow, random, reciprocal, root, subtract, times, toString, toString, toXml, valueOf, valueOf, valueOf, valueOf
 
Methods inherited from class com.dautelle.math.numbers.RealtimeNumber
clone, export, isLocalObject, isPoolObject, pow, recycle, toHeap
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final Duration ZERO
Represents a Duration amounting to nothing.

Constructor Detail

Duration

protected Duration()
Default constructor (allows for derivation).

Method Detail

durationOf

public static Duration durationOf(Quantity quantity)
Returns the Duration corresponding to the specified quantity.

Parameters:
quantity - a quantity compatible with Duration.
Returns:
the specified quantity or a new Duration instance.
Throws:
ConversionException - if the current model does not allow the specified quantity to be converted to Duration.

showAs

public static void showAs(Unit unit)
Shows Duration instances in the specified unit.

Parameters:
unit - the output unit for Duration instances.
See Also:
Quantity.getOutputUnit()

between

public static Duration between(java.util.Date from,
                               java.util.Date to)
Returns the Duration from the ellapsed time between two dates.

Parameters:
from - the departure date.
to - the arrival date.
Returns:
the ellapsed time between the specified dates.

addTo

public java.util.Date addTo(java.util.Date date)
Returns the date after the specified date. How long after being specified by this Duration.

Parameters:
date - the date of origin.
Returns:
date + this.

subtractFrom

public java.util.Date subtractFrom(java.util.Date date)
Returns the date before the specified date. How long before being specified by this Duration.

Parameters:
date - the date of origin.
Returns:
date - this

JADE v6.1

Copyright © 2004 Jean-Marie Dautelle.