public interface IModelVehicle
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
NUM_FRAMES
Number of frames to be shown every second.
|
static java.lang.Integer |
TIME_SLICE
Time fraction used to update vehicles positions, in milliseconds.
|
Modifier and Type | Method and Description |
---|---|
Coordinates[] |
getAnglesPosition()
Return angles position in a vector of four elements.
|
double |
getCurvatureAngleActual()
Return curvature radius, in radians.
|
double |
getCurvatureAngleToReach()
Return curvature radius, in radians.
|
java.lang.String |
getName()
Returns the name, it is unique between all vehicles.
|
java.lang.Double |
getPixelsToGo()
Return pixels that vehicle can still move.
|
Coordinates |
getPosition()
Returns vehicle coordinates.
|
java.lang.Double |
getSpeed()
Return vehicle speed, in Km/h.
|
java.lang.Double |
getSpeedToReach()
Return speed that vehicle will reach at the end its actual a movement.
|
java.awt.Image |
getSprite()
Returns sprite image of vehicle.
|
IThreadVehicle |
getThread()
Return thread of this vehicle.
|
Direction |
getWay()
Return the direction in which the vehicle is going.
|
boolean |
isRunning()
Returns a boolean flag at true if this thread is running, false if it is stopped.
|
void |
setCurvatureAngleActual(double curvatureAngle)
Set curvature radius, in radians.
|
void |
setCurvatureAngleToReach(double curvatureAngle)
Set curvature radius to be reach from the vehicle, in radians.
|
void |
setName(java.lang.String name)
Set vehicle's name, it must be unique.
|
void |
setPixelsToGo(java.lang.Double pixels)
Set pixels that car can move in that fraction of time.
|
void |
setPosition(Coordinates position)
Set vehicle coordinates.
|
void |
setPosition(java.lang.Integer x,
java.lang.Integer y)
Set vehicle coordinates.
|
void |
setSpeed(java.lang.Double kmh)
Set vehicle speed, in Km/h, it could be negative, if doing reverse.
|
void |
setSpeedToReach(java.lang.Double speed)
Set speed to be reached at the end of its actual movement.
|
void |
setSprite(java.awt.Image image)
Set sprite image of vehicle.
|
void |
setThread(IThreadVehicle thread)
Set reference to thread updating this vehicle.
|
void |
start()
Start a new thread that update vehicle every
IThreadVehicle.TIME_SLICE fraction of second. |
static final java.lang.Integer NUM_FRAMES
static final java.lang.Integer TIME_SLICE
void start() throws java.lang.IllegalStateException
IThreadVehicle.TIME_SLICE
fraction of second.java.lang.IllegalStateException
- Thread cannot be instantiate if vehicle is positioned out of mapboolean isRunning()
Coordinates getPosition()
void setPosition(Coordinates position)
position
- coordinates of the vehiclevoid setPosition(java.lang.Integer x, java.lang.Integer y)
x
- value of coordinate xy
- value of coordinate yDirection getWay()
Coordinates[] getAnglesPosition()
java.lang.Double getSpeed()
void setSpeed(java.lang.Double kmh)
kmh
- java.awt.Image getSprite()
void setSprite(java.awt.Image image)
image
- image to be setted as sprite of the vehiclejava.lang.String getName()
void setName(java.lang.String name)
name
- unique name of the vehicledouble getCurvatureAngleActual()
void setCurvatureAngleActual(double curvatureAngle)
curvatureAngle
- rotation radians of vehicledouble getCurvatureAngleToReach()
void setCurvatureAngleToReach(double curvatureAngle)
curvatureAngle
- rotation radians to be reachIThreadVehicle getThread()
void setThread(IThreadVehicle thread)
thread
- thread referencejava.lang.Double getPixelsToGo()
void setPixelsToGo(java.lang.Double pixels)
pixels
- pixels this car can move in this fraction of timevoid setSpeedToReach(java.lang.Double speed)
speed
- speed value to be reachedjava.lang.Double getSpeedToReach()