movement
Class EveningActivityMovement

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

public class EveningActivityMovement
extends MapBasedMovement
implements SwitchableMovement

A Class to model movement when people are out shopping or doing other activities with friends. If the node happens to be at some other location than the place where the shopping starts (where it meets its friends), it first travels to the destination along the shortest path.


Field Summary
static java.lang.String EVENING_ACTIVITY_CONTROL_SYSTEM_NR_SETTING
           
static java.lang.String MAX_GROUP_SIZE_SETTING
           
static java.lang.String MAX_WAIT_TIME_SETTING
           
static java.lang.String MEETING_SPOTS_FILE_SETTING
           
static java.lang.String MIN_GROUP_SIZE_SETTING
           
static java.lang.String MIN_WAIT_TIME_SETTING
           
static java.lang.String NR_OF_MEETING_SPOTS_SETTING
           
 
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
EveningActivityMovement(EveningActivityMovement proto)
          Creates a new instance of EveningActivityMovement from a prototype
EveningActivityMovement(Settings settings)
          Creates a new instance of EveningActivityMovement
 
Method Summary
protected  double generateWaitTime()
          Generates and returns a suitable waiting time at the end of a path.
 int getID()
           
 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
 int getMaxGroupSize()
           
 int getMinGroupSize()
           
 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).
 Coord getShoppingLocation()
           
 Coord getShoppingLocationAndGetReady()
          Sets the node ready to start a shopping trip.
 boolean isReady()
          Checks if the movement model is finished doing its task and it's time to switch to the next movement model.
 boolean isReadyToShop()
          Checks if a node is at the correct place where the shopping begins
 MapBasedMovement replicate()
          Creates a replicate of the movement model.
static void reset()
           
 void setLocation(Coord lastWaypoint)
          Tell the movement model what its current location is
 void setMaxGroupSize(int maxGroupSize)
           
 void setMinGroupSize(int minGroupSize)
           
 
Methods inherited from class movement.MapBasedMovement
getMap, getOkMapNodeTypes, selectRandomOkNode
 
Methods inherited from class movement.MovementModel
generateSpeed, getMaxX, getMaxY, isActive, nextPathAvailable, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NR_OF_MEETING_SPOTS_SETTING

public static final java.lang.String NR_OF_MEETING_SPOTS_SETTING
See Also:
Constant Field Values

EVENING_ACTIVITY_CONTROL_SYSTEM_NR_SETTING

public static final java.lang.String EVENING_ACTIVITY_CONTROL_SYSTEM_NR_SETTING
See Also:
Constant Field Values

MEETING_SPOTS_FILE_SETTING

public static final java.lang.String MEETING_SPOTS_FILE_SETTING
See Also:
Constant Field Values

MIN_GROUP_SIZE_SETTING

public static final java.lang.String MIN_GROUP_SIZE_SETTING
See Also:
Constant Field Values

MAX_GROUP_SIZE_SETTING

public static final java.lang.String MAX_GROUP_SIZE_SETTING
See Also:
Constant Field Values

MIN_WAIT_TIME_SETTING

public static final java.lang.String MIN_WAIT_TIME_SETTING
See Also:
Constant Field Values

MAX_WAIT_TIME_SETTING

public static final java.lang.String MAX_WAIT_TIME_SETTING
See Also:
Constant Field Values
Constructor Detail

EveningActivityMovement

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

Parameters:
settings -

EveningActivityMovement

public EveningActivityMovement(EveningActivityMovement proto)
Creates a new instance of EveningActivityMovement from a prototype

Parameters:
proto -
Method Detail

getID

public int getID()
Returns:
Unique ID of the shopper

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

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

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

replicate

public MapBasedMovement 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

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
See Also:
SwitchableMovement

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 if ready
See Also:
SwitchableMovement

setLocation

public void setLocation(Coord lastWaypoint)
Description copied from interface: SwitchableMovement
Tell the movement model what its current location is

Specified by:
setLocation in interface SwitchableMovement
Overrides:
setLocation in class MapBasedMovement
See Also:
SwitchableMovement

getShoppingLocationAndGetReady

public Coord getShoppingLocationAndGetReady()
Sets the node ready to start a shopping trip.

Returns:
The coordinate of the place where the shopping trip starts

getShoppingLocation

public Coord getShoppingLocation()

isReadyToShop

public boolean isReadyToShop()
Checks if a node is at the correct place where the shopping begins

Returns:
true if node is ready and waiting for the rest of the group to arrive

reset

public static void reset()

getMinGroupSize

public int getMinGroupSize()

setMinGroupSize

public void setMinGroupSize(int minGroupSize)

getMaxGroupSize

public int getMaxGroupSize()

setMaxGroupSize

public void setMaxGroupSize(int maxGroupSize)