public class BusTravellerMovement extends MapBasedMovement implements SwitchableMovement, TransportMovement
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROBABILITIES_STRING |
static java.lang.String |
PROBABILITY_TAKE_OTHER_BUS |
static int |
STATE_DECIDED_TO_ENTER_A_BUS |
static int |
STATE_TRAVELLING_ON_BUS |
static int |
STATE_WAITING_FOR_BUS |
static int |
STATE_WALKING_ELSEWHERE |
backAllowed, FILE_S, lastMapNode, MAP_BASE_MOVEMENT_NS, MAP_SELECT_S, maxPathLength, minPathLength, NROF_FILES_ScomBus, DEF_SPEEDS, DEF_WAIT_TIMES, host, maxSpeed, maxWaitTime, minSpeed, minWaitTime, MOVEMENT_MODEL_NS, rng, RNG_SEED, SPEED, WAIT_TIME, WORLD_SIZE| Constructor and Description |
|---|
BusTravellerMovement(BusTravellerMovement proto)
Creates a BusTravellerModel from a prototype
|
BusTravellerMovement(Settings settings)
Creates a BusTravellerModel
|
| Modifier and Type | Method and Description |
|---|---|
void |
enterBus(Path nextPath)
Notifies the node at the bus stop that a bus is there.
|
protected double |
generateWaitTime()
Switches state between getPath() calls
|
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
|
Coord |
getLocation()
Get the location where the bus is located when it has moved its path
|
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).
|
int |
getState() |
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.
|
static void |
reset() |
void |
setLocation(Coord lastWaypoint)
Tell the movement model what its current location is
|
void |
setNextRoute(Coord nodeLocation,
Coord nodeDestination)
Sets the next route for the traveller, so that it can decide wether it
should take the bus or not.
|
getMap, getOkMapNodeTypes, selectRandomOkNodegenerateSpeed, getComBus, getHost, getMaxX, getMaxY, isActive, nextPathAvailable, setComBus, setHost, toStringpublic static final java.lang.String PROBABILITIES_STRING
public static final java.lang.String PROBABILITY_TAKE_OTHER_BUS
public static final int STATE_WAITING_FOR_BUS
public static final int STATE_DECIDED_TO_ENTER_A_BUS
public static final int STATE_TRAVELLING_ON_BUS
public static final int STATE_WALKING_ELSEWHERE
public BusTravellerMovement(Settings settings)
settings - public BusTravellerMovement(BusTravellerMovement proto)
proto - public Coord getInitialLocation()
MapBasedMovementgetInitialLocation in class MapBasedMovementpublic Path getPath()
MovementModelgetPath in class MapBasedMovementprotected double generateWaitTime()
generateWaitTime in class MovementModelpublic MapBasedMovement replicate()
MovementModelreplicate in class MapBasedMovementpublic int getState()
public Coord getLocation()
public void enterBus(Path nextPath)
nextPath - The next path the bus is going to takepublic int getID()
public void setNextRoute(Coord nodeLocation, Coord nodeDestination)
setNextRoute in interface TransportMovementnodeLocation - nodeDestination - public Coord getLastLocation()
SwitchableMovementgetLastLocation in interface SwitchableMovementgetLastLocation in class MapBasedMovementSwitchableMovementpublic void setLocation(Coord lastWaypoint)
SwitchableMovementsetLocation in interface SwitchableMovementsetLocation in class MapBasedMovementSwitchableMovementpublic boolean isReady()
SwitchableMovementisReady in interface SwitchableMovementisReady in class MapBasedMovementSwitchableMovementpublic static void reset()