public static class BasicVehicle.PhysicalMovement extends Object implements BasicVehicle.MovementWithAccel
Modifier and Type | Field and Description |
---|---|
protected VehicleSpec |
spec
The specification of the vehicle
|
Constructor and Description |
---|
BasicVehicle.PhysicalMovement(BasicVehicle.NonAccelMovement nonAccelMovement,
double acceleration)
Create the physical movement.
|
Modifier and Type | Method and Description |
---|---|
void |
coast()
Maintain the speed of the vehicle.
|
double |
getAcceleration()
Get the acceleration of the vehicle
|
double |
getHeading()
Get the heading of the vehicle
|
BasicVehicle.NonAccelMovement |
getNonAccelMovement()
Get the non acceleration movement.
|
Point2D |
getPosition()
Get the position of the vehicle.
|
double |
getVelocity()
Get the velocity of the vehicle
|
void |
move(double currentTime,
double timeStep)
Move the vehicle for a given period of time.
|
protected void |
moveWithoutAcceleration(double currentTime,
double timeStep)
Move the vehicle while holding all vehicle properties, including
the acceleration, constant.
|
void |
setAccelerationWithBound(double acceleration)
Set the acceleration with respect to the physical limit of the vehicle.
|
protected void |
setVelocityWithBound(double velocity)
Set the velocity with respect to the physical limit of the vehicle.
|
String |
toString() |
protected final VehicleSpec spec
public BasicVehicle.PhysicalMovement(BasicVehicle.NonAccelMovement nonAccelMovement, double acceleration)
nonAccelMovement
- the non-acceleration movementacceleration
- the accelerationpublic Point2D getPosition()
getPosition
in interface BasicVehicle.Movement
public double getHeading()
getHeading
in interface BasicVehicle.Movement
public double getVelocity()
getVelocity
in interface BasicVehicle.Movement
public double getAcceleration()
getAcceleration
in interface BasicVehicle.MovementWithAccel
public BasicVehicle.NonAccelMovement getNonAccelMovement()
public void setAccelerationWithBound(double acceleration)
setAccelerationWithBound
in interface BasicVehicle.MovementWithAccel
acceleration
- the accelerationpublic void coast()
public void move(double currentTime, double timeStep)
move
in interface BasicVehicle.Movement
currentTime
- the current timetimeStep
- the period of time for which the vehicle moves.protected void moveWithoutAcceleration(double currentTime, double timeStep)
currentTime
- the current timetimeStep
- the length of time for which to move the Vehicleprotected void setVelocityWithBound(double velocity)
velocity
- the velocityCopyright © 2013. All rights reserved.