movement
Class BusMovement

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

public class BusMovement
extends MapRouteMovement

This class controls the movement of busses. It informs the bus control system the bus is registered with every time the bus stops.


Field Summary
 
Fields inherited from class movement.MapRouteMovement
ROUTE_FILE_S, ROUTE_FIRST_STOP_S, ROUTE_TYPE_S
 
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
comBus, DEF_SPEEDS, DEF_WAIT_TIMES, maxSpeed, maxWaitTime, minSpeed, minWaitTime, MOVEMENT_MODEL_NS, rng, RNG_SEED, SPEED, WAIT_TIME, WORLD_SIZE
 
Constructor Summary
BusMovement(BusMovement proto)
          Create a new instance from a prototype
BusMovement(Settings settings)
          Creates a new instance of BusMovement
 
Method Summary
 int getID()
          Returns unique ID of the bus
 Coord getInitialLocation()
          Returns the first stop on the route
 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).
 BusMovement replicate()
          Creates a replicate of the movement model.
 
Methods inherited from class movement.MapRouteMovement
getLastLocation, getStops
 
Methods inherited from class movement.MapBasedMovement
getMap, getOkMapNodeTypes, isReady, selectRandomOkNode, setLocation
 
Methods inherited from class movement.MovementModel
generateSpeed, generateWaitTime, getComBus, getMaxX, getMaxY, isActive, nextPathAvailable, reset, setComBus, 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
 

Constructor Detail

BusMovement

public BusMovement(Settings settings)
Creates a new instance of BusMovement

Parameters:
settings -

BusMovement

public BusMovement(BusMovement proto)
Create a new instance from a prototype

Parameters:
proto -
Method Detail

getInitialLocation

public Coord getInitialLocation()
Description copied from class: MapRouteMovement
Returns the first stop on the route

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

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 MapRouteMovement
Returns:
A new path or null

replicate

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

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

getID

public int getID()
Returns unique ID of the bus

Returns:
unique ID of the bus