jfreerails.world.train
Class CompositeSpeedAgainstTime
java.lang.Object
jfreerails.world.train.CompositeSpeedAgainstTime
- All Implemented Interfaces:
- java.io.Serializable, Activity<SpeedTimeAndStatus>, FreerailsSerializable, SpeedAgainstTime
public class CompositeSpeedAgainstTime
- extends java.lang.Object
- implements Activity<SpeedTimeAndStatus>, SpeedAgainstTime
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
values
private final ImList<SpeedAgainstTime> values
finalT
private final double finalT
finalS
private final double finalS
CompositeSpeedAgainstTime
public CompositeSpeedAgainstTime(SpeedAgainstTime... accs)
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
duration
public double duration()
- Specified by:
duration in interface Activity<SpeedTimeAndStatus>
getState
public SpeedTimeAndStatus getState(double dt)
- Specified by:
getState in interface Activity<SpeedTimeAndStatus>
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
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().
getIndex
private CompositeSpeedAgainstTime.TandI getIndex(double t)
checkT
void checkT(double t)