jfreerails.world.train
Class ConstAcc
java.lang.Object
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
|
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 |
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
ConstAcc
private ConstAcc(double a,
double t,
double u,
double s)
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:
- s >= 0
- s <= getS()
- s = 0 if t = 0
- 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:
- t >= 0
- t <= getT()
- t = 0 if s = 0
- 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