uavsim.datatypes
Class Radius

java.lang.Object
  extended by uavsim.datatypes.Radius
All Implemented Interfaces:
java.lang.Comparable<Radius>, I_Unitable<Radius>

public class Radius
extends java.lang.Object
implements I_Unitable<Radius>

Defines a mathematical radius.

Author:
Dan Tappan [26.06.11]

Field Summary
private  double _radius
          the non-negative length
 
Constructor Summary
Radius(double radius)
          Creates a radius descriptor.
 
Method Summary
 Radius add_(Radius radius)
          Adds another unit to this one.
 int compareTo(Radius radius)
          
 double convertToDiameter()
          Converts the radius to a diameter.
 double getValue_()
          Returns the numerical value of this unit.
 int getValueInt()
          Gets the radius as an integer.
 Radius scale(Radius scaler)
          Scales the radius according to a scaler provided by another radius.
 Radius scale(Scaler scaler)
          Scales the radius according to a scaler.
private  void setRadius(double radius)
          Sets the radius.
 Radius subtract_(Radius radius)
          Subtract another unit from this one.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_radius

private double _radius
the non-negative length

Constructor Detail

Radius

public Radius(double radius)
Creates a radius descriptor.

Parameters:
radius - - the non-negative length
Method Detail

add_

public Radius add_(Radius radius)
Adds another unit to this one.

Specified by:
add_ in interface I_Unitable<Radius>
Parameters:
radius - - the unit
Returns:
the result as a new unit

compareTo

public int compareTo(Radius radius)

Specified by:
compareTo in interface java.lang.Comparable<Radius>

convertToDiameter

public double convertToDiameter()
Converts the radius to a diameter.

Returns:
the diameter

getValue_

public double getValue_()
Returns the numerical value of this unit.

Specified by:
getValue_ in interface I_Unitable<Radius>
Returns:
the value

getValueInt

public int getValueInt()
Gets the radius as an integer.

Returns:
the radius

scale

public Radius scale(Radius scaler)
Scales the radius according to a scaler provided by another radius. This basically functions as a multiply method.

Parameters:
scaler - - the scaler
Returns:
the result

scale

public Radius scale(Scaler scaler)
Scales the radius according to a scaler.

Parameters:
scaler - - the scaler
Returns:
the result

setRadius

private void setRadius(double radius)
Sets the radius.

Parameters:
radius - - the non-negative length

subtract_

public Radius subtract_(Radius radius)
Subtract another unit from this one.

Specified by:
subtract_ in interface I_Unitable<Radius>
Parameters:
radius - - the unit
Returns:
the result as a new unit

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object