jist.swans.field
Class Mobility.RandomWalk

java.lang.Object
  extended by jist.swans.field.Mobility.RandomWalk
All Implemented Interfaces:
Mobility
Enclosing interface:
Mobility

public static class Mobility.RandomWalk
extends java.lang.Object
implements Mobility

Random Walk mobility model: pick a direction, walk a certain distance in that direction, with some fixed and random component, reflecting off walls as necessary, then pause for some time and repeat.

Since:
SWANS1.0
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from interface jist.swans.field.Mobility
Mobility.MobilityInfo, Mobility.RandomWalk, Mobility.RandomWaypoint, Mobility.RandomWaypointInfo, Mobility.Static, Mobility.Teleport
 
Field Summary
private  Location.Location2D bounds
          field boundaries.
private  double fixedRadius
          fixed component of step size.
private  long pauseTime
          time wait between steps.
private  double randomRadius
          random component of step size.
 
Constructor Summary
Mobility.RandomWalk(Location.Location2D bounds, double fixedRadius, double randomRadius, long pauseTime)
          Create and initialize new random walk object.
Mobility.RandomWalk(Location.Location2D bounds, java.lang.String config)
          Create an initialize a new random walk object.
 
Method Summary
 Mobility.MobilityInfo init(FieldInterface f, java.lang.Integer id, Location loc)
          Initiate mobility; initialize mobility data structures.
private  void init(Location.Location2D bounds, double fixedRadius, double randomRadius, long pauseTime)
          Initialize random walk object.
 void next(FieldInterface f, java.lang.Integer id, Location loc, Mobility.MobilityInfo info)
          Schedule next movement.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fixedRadius

private double fixedRadius
fixed component of step size.


randomRadius

private double randomRadius
random component of step size.


pauseTime

private long pauseTime
time wait between steps.


bounds

private Location.Location2D bounds
field boundaries.

Constructor Detail

Mobility.RandomWalk

public Mobility.RandomWalk(Location.Location2D bounds,
                           double fixedRadius,
                           double randomRadius,
                           long pauseTime)
Create and initialize new random walk object.

Parameters:
bounds - field boundaries
fixedRadius - fixed component of step size
randomRadius - random component of step size
pauseTime - time wait between steps

Mobility.RandomWalk

public Mobility.RandomWalk(Location.Location2D bounds,
                           java.lang.String config)
Create an initialize a new random walk object.

Parameters:
bounds - field boundaries
config - configuration string: "fixed,random,time(in seconds)"
Method Detail

init

private void init(Location.Location2D bounds,
                  double fixedRadius,
                  double randomRadius,
                  long pauseTime)
Initialize random walk object.

Parameters:
bounds - field boundaries
fixedRadius - fixed component of step size
randomRadius - random component of step size
pauseTime - time wait between steps

init

public Mobility.MobilityInfo init(FieldInterface f,
                                  java.lang.Integer id,
                                  Location loc)
Initiate mobility; initialize mobility data structures.

Specified by:
init in interface Mobility
Parameters:
f - field entity
id - node identifier
loc - node location
Returns:
mobility information object

next

public void next(FieldInterface f,
                 java.lang.Integer id,
                 Location loc,
                 Mobility.MobilityInfo info)
Schedule next movement. This method will again be called after every movement on the field.

Specified by:
next in interface Mobility
Parameters:
f - field entity
id - radio identifier
loc - destination of move
info - mobility information object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object