net.agmodel.physical
Class Acceleration

java.lang.Object
  extended bynet.agmodel.physical.AbstractQuantity
      extended bynet.agmodel.physical.Acceleration
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public final class Acceleration
extends AbstractQuantity
implements Comparable

This class represents the rate of change of speed with respect to time.

Version:
1.2, 1 April 1999
Author:
Jean-Marie Dautelle
See Also:
Speed, Duration, Serialized Form

Field Summary
static int METERS_PER_SQUARE_SECOND
          Used to specify meter per square second unit.
static int METRES_PER_SQUARE_SECOND
           
 
Fields inherited from class net.agmodel.physical.AbstractQuantity
COMPLETE, DEVOID, SPATIALLYINTERPOLATED, TEMPORALLYINTERPOLATED, UNINTERPOLATED
 
Constructor Summary
Acceleration(Composite c)
          Acceleration constructor from Composite quantity.
Acceleration(double value, int unit)
          Acceleration constructor.
 
Method Summary
 Acceleration add(Acceleration x)
          Returns an Acceleration whose value is (this + x).
 int compareTo(Acceleration x)
          Compares this Acceleration with the specified Acceleration.
 int compareTo(Object o)
          Compares this Acceleration with the specified Object.
 Acceleration divide(double coefficient)
          Returns an Acceleration whose value is (this / coefficient).
 double getValue(int unit)
          Gets the acceleration in the specified unit.
 Acceleration multiply(double coefficient)
          Returns an Acceleration whose value is (this * coefficient).
 Speed multiply(Duration d)
          Returns a Speed whose value is (this * d).
 void setValue(double value, int unit)
          Sets this Acceleration using the specified unit.
 Acceleration substract(Acceleration x)
          Returns an Acceleration whose value is (this - x).
 
Methods inherited from class net.agmodel.physical.AbstractQuantity
clone, divide, isSpatiallyInterpolated, isTemporallyInterpolated, multiply, toComposite, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

METERS_PER_SQUARE_SECOND

public static final int METERS_PER_SQUARE_SECOND
Used to specify meter per square second unit.

See Also:
Constant Field Values

METRES_PER_SQUARE_SECOND

public static final int METRES_PER_SQUARE_SECOND
See Also:
Constant Field Values
Constructor Detail

Acceleration

public Acceleration(double value,
                    int unit)
Acceleration constructor.

Parameters:
value - the acceleration in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

Acceleration

public Acceleration(Composite c)
Acceleration constructor from Composite quantity.

Parameters:
c - the quantity to convert.
Throws:
UnitDimensionException - composite is not an acceleration.
See Also:
Composite
Method Detail

getValue

public double getValue(int unit)
Gets the acceleration in the specified unit.

Parameters:
unit - the measurement unit being used.
Returns:
acceleration in the specified measurement unit.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

setValue

public void setValue(double value,
                     int unit)
Sets this Acceleration using the specified unit.

Parameters:
value - the new acceleration in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

add

public Acceleration add(Acceleration x)
Returns an Acceleration whose value is (this + x).

Parameters:
x - the Acceleration to be added.
Returns:
(this + x)

substract

public Acceleration substract(Acceleration x)
Returns an Acceleration whose value is (this - x).

Parameters:
x - the Acceleration to be substracted.
Returns:
(this - x)

multiply

public Acceleration multiply(double coefficient)
Returns an Acceleration whose value is (this * coefficient).

Parameters:
coefficient - the dimensionless multiplier.
Returns:
(this * coefficient)

divide

public Acceleration divide(double coefficient)
Returns an Acceleration whose value is (this / coefficient).

Parameters:
coefficient - the dimensionless divisor.
Returns:
(this / coefficient)
Throws:
ArithmeticException - coefficient == 0.0

multiply

public Speed multiply(Duration d)
Returns a Speed whose value is (this * d).

Parameters:
d - the duration multiplier.
Returns:
(this * d)

compareTo

public int compareTo(Acceleration x)
Compares this Acceleration with the specified Acceleration. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) <op> 0), where <op> is one of the six comparison operators.

Parameters:
x - Acceleration to which this Acceleration is to be compared.
Returns:
-1, 0 or 1 as this Acceleration is numerically less than, equal to, or greater than x.

compareTo

public int compareTo(Object o)
Compares this Acceleration with the specified Object. If the Object is a Acceleration, this method behaves like compareTo(Acceleration). Otherwise, it throws a ClassCastException (as Accelerations are comparable only to other Accelerations).

Specified by:
compareTo in interface Comparable
Parameters:
o - Object to which this Acceleration is to be compared.
Returns:
a negative number, zero, or a positive number as this Acceleration is numerically less than, equal to, or greater than o, which must be a Acceleration.
Throws:
ClassCastException - o is not a Acceleration.
See Also:
compareTo(Acceleration), Comparable


Copyright (C) NARC 2001 All Rights Reserved.