|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmovement.MovementModel
public abstract class MovementModel
Superclass for all movement models. All subclasses must contain at least a
constructor with one Settings
parameter and also a copy-constructor.
They must also implement the replicate()
method, which should return
an instance of the movement model class with same parameters as the object
(immutable fields can be shared, but mutable fields must be copied).
To make a new movement model do something useful, also at least
getInitialLocation()
and getPath()
are worthwhile to
override.
Field Summary | |
---|---|
protected ModuleCommunicationBus |
comBus
|
static double[] |
DEF_SPEEDS
default setting for speed distribution |
static double[] |
DEF_WAIT_TIMES
default setting for wait time distribution |
protected double |
maxSpeed
|
protected double |
maxWaitTime
|
protected double |
minSpeed
|
protected double |
minWaitTime
|
static java.lang.String |
MOVEMENT_MODEL_NS
MovementModel namespace (where world size and rng seed settings are looked from ("MovementModel") |
protected static java.util.Random |
rng
common rng for all movement models in the simulation |
static java.lang.String |
RNG_SEED
movement models' rng seed -setting id ("rngSeed") |
static java.lang.String |
SPEED
node's speed CSV (min, max) -setting id ("speed") |
static java.lang.String |
WAIT_TIME
node's wait time CSV (min, max) -setting id ("waitTime") |
static java.lang.String |
WORLD_SIZE
world's size CSV (width, height) -setting id ("worldSize") |
Constructor Summary | |
---|---|
MovementModel()
Empty constructor for testing purposes. |
|
MovementModel(MovementModel mm)
Copyconstructor. |
|
MovementModel(Settings settings)
Creates a new MovementModel based on a Settings object's settings. |
Method Summary | |
---|---|
protected double |
generateSpeed()
Generates and returns a speed value between min and max of the WAIT_TIME setting. |
protected double |
generateWaitTime()
Generates and returns a suitable waiting time at the end of a path. |
ModuleCommunicationBus |
getComBus()
Returns the module communication bus of this movement model (if any) |
abstract Coord |
getInitialLocation()
Returns a new initial placement for a node |
int |
getMaxX()
Returns the largest X coordinate value this model uses |
int |
getMaxY()
Returns the largest Y coordinate value this model uses |
abstract 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 |
isActive()
Returns true if this node is active at the moment (false if not) |
double |
nextPathAvailable()
Returns a sim time when the next path is available. |
abstract MovementModel |
replicate()
Creates a replicate of the movement model. |
static void |
reset()
Resets all static fields to default values |
void |
setComBus(ModuleCommunicationBus comBus)
Sets the module communication bus for this movement model |
java.lang.String |
toString()
Returns simply the name of the movement model class |
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 SPEED
public static final java.lang.String WAIT_TIME
public static final double[] DEF_SPEEDS
public static final double[] DEF_WAIT_TIMES
public static final java.lang.String MOVEMENT_MODEL_NS
public static final java.lang.String WORLD_SIZE
public static final java.lang.String RNG_SEED
protected static java.util.Random rng
protected double minSpeed
protected double maxSpeed
protected double minWaitTime
protected double maxWaitTime
protected ModuleCommunicationBus comBus
Constructor Detail |
---|
public MovementModel()
public MovementModel(Settings settings)
settings
- The Settings object where the settings are read frompublic MovementModel(MovementModel mm)
mm
- The MovementModel prototype to base the new object toMethod Detail |
---|
public int getMaxX()
public int getMaxY()
protected double generateSpeed()
WAIT_TIME
setting.
protected double generateWaitTime()
WAIT_TIME
setting).
public abstract Path getPath()
public abstract Coord getInitialLocation()
public boolean isActive()
public double nextPathAvailable()
WAIT_TIME
from now.
public void setComBus(ModuleCommunicationBus comBus)
comBus
- The communications bus to setpublic ModuleCommunicationBus getComBus()
public java.lang.String toString()
toString
in class java.lang.Object
public abstract MovementModel replicate()
public static void reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |