movement
Class CarMovement

java.lang.Object
  extended by movement.MovementModel
      extended by movement.MapBasedMovement
          extended by movement.CarMovement
All Implemented Interfaces:
SwitchableMovement, TransportMovement

public class CarMovement
extends MapBasedMovement
implements SwitchableMovement, TransportMovement

The CarMovement class representing the car movement submodel


Field Summary
 
Fields inherited from class movement.MapBasedMovement
backAllowed, FILE_S, lastMapNode, MAP_BASE_MOVEMENT_NS, MAP_SELECT_S, maxPathLength, minPathLength, NROF_FILES_S
 
Fields inherited from class movement.MovementModel
DEF_SPEEDS, DEF_WAIT_TIMES, maxSpeed, maxWaitTime, minSpeed, minWaitTime, MOVEMENT_MODEL_NS, rng, RNG_SEED, SPEED, WAIT_TIME, WORLD_SIZE
 
Constructor Summary
CarMovement(CarMovement proto)
          Construct a new CarMovement instance from a prototype
CarMovement(Settings settings)
          Car movement constructor
 
Method Summary
 Path getPath()
          Returns a new path by this movement model or null if no new path could be constructed at the moment (node should wait where it is).
 boolean isReady()
          Checks if the movement model is finished doing its task and it's time to switch to the next movement model.
 void setNextRoute(Coord nodeLocation, Coord nodeDestination)
          Sets the next route to be taken
 
Methods inherited from class movement.MapBasedMovement
getInitialLocation, getLastLocation, getMap, getOkMapNodeTypes, replicate, selectRandomOkNode, setLocation
 
Methods inherited from class movement.MovementModel
generateSpeed, generateWaitTime, getMaxX, getMaxY, isActive, nextPathAvailable, reset, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface movement.SwitchableMovement
getLastLocation, setLocation
 

Constructor Detail

CarMovement

public CarMovement(Settings settings)
Car movement constructor

Parameters:
settings -

CarMovement

public CarMovement(CarMovement proto)
Construct a new CarMovement instance from a prototype

Parameters:
proto -
Method Detail

setNextRoute

public void setNextRoute(Coord nodeLocation,
                         Coord nodeDestination)
Sets the next route to be taken

Specified by:
setNextRoute in interface TransportMovement
Parameters:
nodeLocation -
nodeDestination -

getPath

public Path getPath()
Description copied from class: MovementModel
Returns a new path by this movement model or null if no new path could be constructed at the moment (node should wait where it is). A new path should not be requested before the destination of the previous path has been reached.

Overrides:
getPath in class MapBasedMovement
Returns:
A new path or null

isReady

public boolean isReady()
Description copied from interface: SwitchableMovement
Checks if the movement model is finished doing its task and it's time to switch to the next movement model. The method should be called between getPath() calls.

Specified by:
isReady in interface SwitchableMovement
Overrides:
isReady in class MapBasedMovement
Returns:
true
See Also:
SwitchableMovement