|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmovement.MovementModel
movement.MapBasedMovement
public class MapBasedMovement
Map based movement model which gives out Paths that use the roads of a SimMap.
Field Summary | |
---|---|
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") |
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 | |
---|---|
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 |
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 |
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 |
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 |
Field Detail |
---|
protected 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.
Constructor Detail |
---|
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 toMethod Detail |
---|
public Coord getInitialLocation()
getInitialLocation
in class MovementModel
protected int[] getOkMapNodeTypes()
public Path getPath()
MovementModel
getPath
in class MovementModel
protected MapNode selectRandomOkNode(java.util.List<MapNode> nodes)
nodes
- The list of nodes to choose from.
public SimMap getMap()
public MapBasedMovement replicate()
MovementModel
replicate
in class MovementModel
public Coord getLastLocation()
SwitchableMovement
getLastLocation
in interface SwitchableMovement
public void setLocation(Coord lastWaypoint)
SwitchableMovement
setLocation
in interface SwitchableMovement
public boolean isReady()
SwitchableMovement
isReady
in interface SwitchableMovement
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |