public class MapBasedMovement extends MovementModel implements SwitchableMovement
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
backAllowed
May a node choose to move back the same way it came at a crossing
|
static java.lang.String |
FILE_S
map file -setting id ("mapFile")
|
protected MapNode |
lastMapNode
node where the last path ended or node next to initial placement
|
static java.lang.String |
MAP_BASE_MOVEMENT_NS
map based movement model's settings namespace ("MapBasedMovement")
|
static java.lang.String |
MAP_SELECT_S
Per node group setting for selecting map node types that are OK for
this node group to traverse trough.
|
protected int |
maxPathLength
max nrof map nodes to travel/path
|
protected int |
minPathLength
min nrof map nodes to travel/path
|
static java.lang.String |
NROF_FILES_S
number of map files -setting id ("nrofMapFiles")
|
comBus, DEF_SPEEDS, DEF_WAIT_TIMES, host, maxSpeed, maxWaitTime, minSpeed, minWaitTime, MOVEMENT_MODEL_NS, rng, RNG_SEED, SPEED, WAIT_TIME, WORLD_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
MapBasedMovement(MapBasedMovement mbm)
Copyconstructor.
|
|
MapBasedMovement(Settings settings)
Creates a new MapBasedMovement based on a Settings object's settings.
|
|
MapBasedMovement(Settings settings,
SimMap newMap,
int nrofMaps)
Creates a new MapBasedMovement based on a Settings object's settings
but with different SimMap
|
| Modifier and Type | Method and Description |
|---|---|
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
|
SimMap |
getMap()
Returns the SimMap this movement model uses
|
protected int[] |
getOkMapNodeTypes()
Returns map node types that are OK for this movement model in an array
or null if all values are considered ok
|
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.
|
MapBasedMovement |
replicate()
Creates a replicate of the movement model.
|
protected MapNode |
selectRandomOkNode(java.util.List<MapNode> nodes)
Selects and returns a random node that is OK from a list of nodes.
|
void |
setLocation(Coord lastWaypoint)
Tell the movement model what its current location is
|
generateSpeed, generateWaitTime, getComBus, getHost, getMaxX, getMaxY, isActive, nextPathAvailable, reset, setComBus, setHost, toStringprotected MapNode lastMapNode
protected int maxPathLength
protected int minPathLength
protected boolean backAllowed
public static final java.lang.String MAP_BASE_MOVEMENT_NS
public static final java.lang.String NROF_FILES_S
public static final java.lang.String FILE_S
public static final java.lang.String MAP_SELECT_S
FILE_S). If setting is not defined, all map nodes are
considered OK.public MapBasedMovement(Settings settings)
settings - The Settings object where the settings are read frompublic MapBasedMovement(Settings settings, SimMap newMap, int nrofMaps)
settings - The Settings object where the settings are read fromnewMap - The SimMap to usenrofMaps - How many map "files" are in the mapprotected MapBasedMovement(MapBasedMovement mbm)
mbm - The MapBasedMovement object to base the new object topublic Coord getInitialLocation()
getInitialLocation in class MovementModelprotected int[] getOkMapNodeTypes()
public Path getPath()
MovementModelgetPath in class MovementModelprotected MapNode selectRandomOkNode(java.util.List<MapNode> nodes)
nodes - The list of nodes to choose from.public SimMap getMap()
public MapBasedMovement replicate()
MovementModelreplicate in class MovementModelpublic Coord getLastLocation()
SwitchableMovementgetLastLocation in interface SwitchableMovementpublic void setLocation(Coord lastWaypoint)
SwitchableMovementsetLocation in interface SwitchableMovementpublic boolean isReady()
SwitchableMovementisReady in interface SwitchableMovement