|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmovement.MovementModel
movement.MapBasedMovement
movement.BusTravellerMovement
public class BusTravellerMovement
This class controls the movement of bus travellers. A bus traveller belongs to a bus control system. A bus traveller has a destination and a start location. If the direct path to the destination is longer than the path the node would have to walk if it would take the bus, the node uses the bus. If the destination is not provided, the node will pass a random number of stops determined by Markov chains (defined in settings).
Field Summary | |
---|---|
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
|
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 |
---|
comBus, DEF_SPEEDS, DEF_WAIT_TIMES, maxSpeed, maxWaitTime, minSpeed, minWaitTime, MOVEMENT_MODEL_NS, rng, RNG_SEED, SPEED, WAIT_TIME, WORLD_SIZE |
Constructor Summary | |
---|---|
BusTravellerMovement(BusTravellerMovement proto)
Creates a BusTravellerModel from a prototype |
|
BusTravellerMovement(Settings settings)
Creates a BusTravellerModel |
Method Summary | |
---|---|
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. |
Methods inherited from class movement.MapBasedMovement |
---|
getMap, getOkMapNodeTypes, selectRandomOkNode |
Methods inherited from class movement.MovementModel |
---|
generateSpeed, getComBus, getMaxX, getMaxY, isActive, nextPathAvailable, setComBus, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public 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
Constructor Detail |
---|
public BusTravellerMovement(Settings settings)
settings
- public BusTravellerMovement(BusTravellerMovement proto)
proto
- Method Detail |
---|
public Coord getInitialLocation()
MapBasedMovement
getInitialLocation
in class MapBasedMovement
public Path getPath()
MovementModel
getPath
in class MapBasedMovement
protected double generateWaitTime()
generateWaitTime
in class MovementModel
public MapBasedMovement replicate()
MovementModel
replicate
in class MapBasedMovement
public 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 TransportMovement
nodeLocation
- nodeDestination
- public Coord getLastLocation()
SwitchableMovement
getLastLocation
in interface SwitchableMovement
getLastLocation
in class MapBasedMovement
SwitchableMovement
public void setLocation(Coord lastWaypoint)
SwitchableMovement
setLocation
in interface SwitchableMovement
setLocation
in class MapBasedMovement
SwitchableMovement
public boolean isReady()
SwitchableMovement
isReady
in interface SwitchableMovement
isReady
in class MapBasedMovement
SwitchableMovement
public static void reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |