jfreerails.world.train
Class ConstAcc

java.lang.Object
  extended by jfreerails.world.train.ConstAcc
All Implemented Interfaces:
java.io.Serializable, FreerailsSerializable, SpeedAgainstTime

public class ConstAcc
extends java.lang.Object
implements FreerailsSerializable, SpeedAgainstTime

See Also:
Serialized Form

Field Summary
private  double a
           
private  double finalS
           
private  double finalT
           
private static long serialVersionUID
           
static ConstAcc STOPPED
           
private  double u
           
 
Constructor Summary
private ConstAcc(double a, double t, double u, double s)
           
 
Method Summary
 double calcA(double t)
           
 double calcS(double t)
          Returns the distance travelled at time t.
 double calcT(double s)
          Returns the time taken to travel distance s.
private static double calcT(double u, double a, double s)
           
 double calcV(double t)
           
 boolean equals(java.lang.Object o)
           
 double getS()
           
 double getT()
           
 int hashCode()
           
 java.lang.String toString()
           
static ConstAcc uas(double u, double a, double s)
           
static ConstAcc uat(double u, double a, double t)
           
private  void validateT(double t)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

STOPPED

public static final ConstAcc STOPPED

u

private final double u

a

private final double a

finalS

private final double finalS

finalT

private final double finalT
Constructor Detail

ConstAcc

private ConstAcc(double a,
                 double t,
                 double u,
                 double s)
Method Detail

uas

public static ConstAcc uas(double u,
                           double a,
                           double s)

calcT

private static double calcT(double u,
                            double a,
                            double s)

uat

public static ConstAcc uat(double u,
                           double a,
                           double t)

calcS

public double calcS(double t)
Description copied from interface: SpeedAgainstTime
Returns the distance travelled at time t. The returned value, s, satisfies the following conditions:
  1. s >= 0
  2. s <= getS()
  3. s = 0 if t = 0
  4. s = getS() if t = getT()

Specified by:
calcS in interface SpeedAgainstTime
Returns:
s

calcT

public double calcT(double s)
Description copied from interface: SpeedAgainstTime
Returns the time taken to travel distance s. The returned value, t, satisfies the following conditions:
  1. t >= 0
  2. t <= getT()
  3. t = 0 if s = 0
  4. t = getT() if s = getS()

Specified by:
calcT in interface SpeedAgainstTime
Returns:
t

calcV

public double calcV(double t)
Specified by:
calcV in interface SpeedAgainstTime

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

calcA

public double calcA(double t)
Specified by:
calcA in interface SpeedAgainstTime

getT

public double getT()
Specified by:
getT in interface SpeedAgainstTime
Returns:
The time taken to travel the distance given by getS().

getS

public double getS()
Specified by:
getS in interface SpeedAgainstTime
Returns:
The distance traveled during at time given by getT().

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

validateT

private void validateT(double t)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object