movement
Class MapRouteMovement

java.lang.Object
  extended by movement.MovementModel
      extended by movement.MapBasedMovement
          extended by movement.MapRouteMovement
All Implemented Interfaces:
SwitchableMovement
Direct Known Subclasses:
BusMovement

public class MapRouteMovement
extends MapBasedMovement
implements SwitchableMovement

Map based movement model that uses predetermined paths within the map area. Nodes using this model (can) stop on every route waypoint and find their way to next waypoint using DijkstraPathFinder. There can be different type of routes; see ROUTE_TYPE_S.


Field Summary
static java.lang.String ROUTE_FILE_S
          Per node group setting used for selecting a route file ("routeFile")
static java.lang.String ROUTE_TYPE_S
          Per node group setting used for selecting a route's type ("routeType").
 
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
protected MapRouteMovement(MapRouteMovement proto)
          Copyconstructor.
  MapRouteMovement(Settings settings)
          Creates a new movement model based on a Settings object's settings.
 
Method Summary
 Coord getInitialLocation()
          Returns a (random) coordinate that is between two adjacent MapNodes
 Coord getLastLocation()
          Get the last location the getPath() of this movement model has returned
 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).
 java.util.List<MapNode> getStops()
           
 MapRouteMovement replicate()
          Creates a replicate of the movement model.
 
Methods inherited from class movement.MapBasedMovement
getMap, getOkMapNodeTypes, isReady, 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
isReady, setLocation
 

Field Detail

ROUTE_FILE_S

public static final java.lang.String ROUTE_FILE_S
Per node group setting used for selecting a route file ("routeFile")

See Also:
Constant Field Values

ROUTE_TYPE_S

public static final java.lang.String ROUTE_TYPE_S
Per node group setting used for selecting a route's type ("routeType"). Integer value from MapRoute class.

See Also:
Constant Field Values
Constructor Detail

MapRouteMovement

public MapRouteMovement(Settings settings)
Creates a new movement model based on a Settings object's settings.

Parameters:
settings - The Settings object where the settings are read from

MapRouteMovement

protected MapRouteMovement(MapRouteMovement proto)
Copyconstructor. Gives a route to the new movement model from the list of routes and randomizes the starting position.

Parameters:
proto - The MapRouteMovement prototype
Method Detail

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

getInitialLocation

public Coord getInitialLocation()
Description copied from class: MapBasedMovement
Returns a (random) coordinate that is between two adjacent MapNodes

Overrides:
getInitialLocation in class MapBasedMovement
Returns:
The initial coordinates for a node

getLastLocation

public Coord getLastLocation()
Description copied from interface: SwitchableMovement
Get the last location the getPath() of this movement model has returned

Specified by:
getLastLocation in interface SwitchableMovement
Overrides:
getLastLocation in class MapBasedMovement
Returns:
the last location

replicate

public MapRouteMovement replicate()
Description copied from class: MovementModel
Creates a replicate of the movement model.

Overrides:
replicate in class MapBasedMovement
Returns:
A new movement model with the same settings as this model

getStops

public java.util.List<MapNode> getStops()