com.azalient.apo.basics
Class Speed

java.lang.Object
  extended by com.azalient.apo.basics.Speed
Direct Known Subclasses:
Speed.SpeedFinal

public class Speed
extends Object

A speed value, converted on demand to preferred units (km/h, mph, m/s).


Nested Class Summary
static class Speed.S_Units
           
static class Speed.SpeedFinal
           
 
Field Summary
static double FPS_TO_KPH
           
static double FPS_TO_MPH
           
static double FPS_TO_MPS
           
static Speed.S_Units Km_H
          Kilometres / Hour
static Speed.S_Units KPH
           
static double KPH_TO_FPS
           
static double KPH_TO_MPH
           
static double KPH_TO_MPS
           
static Speed.S_Units M_S
          Metres / Second
static Speed.S_Units MPH
           
static double MPH_TO_FPS
           
static double MPH_TO_KPH
           
static double MPH_TO_MPS
           
static Speed.S_Units MPS
           
static double MPS_TO_FPS
           
static double MPS_TO_KPH
           
static double MPS_TO_MPH
           
static Speed ONE
           
static Speed ZERO
           
 
Constructor Summary
Speed(double s)
          Create a new speed of (s localeUnits)
Speed(double s, Speed.S_Units u)
           
Speed(Speed.S_Units u, double s)
           
Speed(Speed s)
           
 
Method Summary
static Speed defaultSpeedLimit()
           
 double get()
          Return the speed in the current locale units
 double get(Speed.S_Units u)
           
 double kph()
           
static Speed.S_Units localeUnits()
           
 double mph()
           
 double mps()
           
static Speed parse(String s)
           
 void set(double s)
           
 void set(double s, Speed.S_Units u)
           
 void set(Speed.S_Units u, double s)
           
 void set(Speed s)
           
 String toString()
           
 String toString(Speed.S_Units u)
           
 String toStringNoUnits()
           
 String toStringNoUnits(Speed.S_Units u)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MPH_TO_MPS

public static final double MPH_TO_MPS
See Also:
Constant Field Values

MPH_TO_KPH

public static final double MPH_TO_KPH
See Also:
Constant Field Values

MPH_TO_FPS

public static final double MPH_TO_FPS
See Also:
Constant Field Values

MPS_TO_MPH

public static final double MPS_TO_MPH
See Also:
Constant Field Values

MPS_TO_KPH

public static final double MPS_TO_KPH
See Also:
Constant Field Values

MPS_TO_FPS

public static final double MPS_TO_FPS
See Also:
Constant Field Values

KPH_TO_MPS

public static final double KPH_TO_MPS
See Also:
Constant Field Values

KPH_TO_MPH

public static final double KPH_TO_MPH
See Also:
Constant Field Values

KPH_TO_FPS

public static final double KPH_TO_FPS
See Also:
Constant Field Values

FPS_TO_MPS

public static final double FPS_TO_MPS
See Also:
Constant Field Values

FPS_TO_MPH

public static final double FPS_TO_MPH
See Also:
Constant Field Values

FPS_TO_KPH

public static final double FPS_TO_KPH
See Also:
Constant Field Values

MPS

public static final Speed.S_Units MPS

MPH

public static final Speed.S_Units MPH

KPH

public static final Speed.S_Units KPH

Km_H

public static final Speed.S_Units Km_H
Kilometres / Hour


M_S

public static final Speed.S_Units M_S
Metres / Second


ZERO

public static final Speed ZERO

ONE

public static final Speed ONE
Constructor Detail

Speed

public Speed(Speed.S_Units u,
             double s)

Speed

public Speed(double s,
             Speed.S_Units u)

Speed

public Speed(double s)
Create a new speed of (s localeUnits)


Speed

public Speed(Speed s)
Method Detail

defaultSpeedLimit

public static Speed defaultSpeedLimit()

set

public final void set(double s)

set

public final void set(Speed s)

set

public final void set(Speed.S_Units u,
                      double s)

set

public final void set(double s,
                      Speed.S_Units u)

get

public final double get(Speed.S_Units u)

get

public final double get()
Return the speed in the current locale units


kph

public final double kph()

mph

public final double mph()

mps

public final double mps()

localeUnits

public static Speed.S_Units localeUnits()

toString

public final String toString()
Overrides:
toString in class Object

toString

public final String toString(Speed.S_Units u)

toStringNoUnits

public String toStringNoUnits()

toStringNoUnits

public String toStringNoUnits(Speed.S_Units u)

parse

public static Speed parse(String s)