movement
Class ExtendedMovementModel

java.lang.Object
  extended by movement.MovementModel
      extended by movement.ExtendedMovementModel
Direct Known Subclasses:
WorkingDayMovement

public abstract class ExtendedMovementModel
extends MovementModel

Classes derived from this can make use of other movement models that implement the SwitchableMovement interface.


Field Summary
 
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
ExtendedMovementModel()
          Creates a new ExtendedMovementModel
ExtendedMovementModel(ExtendedMovementModel mm)
          Creates a new ExtendedMovementModel from a prototype
ExtendedMovementModel(Settings settings)
          Creates a new ExtendedMovementModel
 
Method Summary
protected  double generateWaitTime()
          Generates and returns a suitable waiting time at the end of a path.
 SwitchableMovement getCurrentMovementModel()
           
 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).
abstract  boolean newOrders()
          Method is called between each getPath() request when the current MM is ready (isReady() method returns true).
 void setCurrentMovementModel(SwitchableMovement mm)
          Sets the current movement model to be used the next time getPath() is called
 
Methods inherited from class movement.MovementModel
generateSpeed, getComBus, getInitialLocation, getMaxX, getMaxY, isActive, nextPathAvailable, replicate, reset, setComBus, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtendedMovementModel

public ExtendedMovementModel()
Creates a new ExtendedMovementModel


ExtendedMovementModel

public ExtendedMovementModel(Settings settings)
Creates a new ExtendedMovementModel

Parameters:
settings -

ExtendedMovementModel

public ExtendedMovementModel(ExtendedMovementModel mm)
Creates a new ExtendedMovementModel from a prototype

Parameters:
mm -
Method Detail

setCurrentMovementModel

public void setCurrentMovementModel(SwitchableMovement mm)
Sets the current movement model to be used the next time getPath() is called

Parameters:
mm - Next movement model

getCurrentMovementModel

public SwitchableMovement getCurrentMovementModel()
Returns:
The movement model currently in use

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.

Specified by:
getPath in class MovementModel
Returns:
A new path or null

generateWaitTime

protected double generateWaitTime()
Description copied from class: MovementModel
Generates and returns a suitable waiting time at the end of a path. (i.e. random variable whose value is between min and max of the MovementModel.WAIT_TIME setting).

Overrides:
generateWaitTime in class MovementModel
Returns:
The time as a double

newOrders

public abstract boolean newOrders()
Method is called between each getPath() request when the current MM is ready (isReady() method returns true). Subclasses should implement all changes of state that need to be made here, for example switching mobility model, etc.

Returns:
true if success