core
Class World

java.lang.Object
  extended by core.World

public class World
extends java.lang.Object

World contains all the nodes and is responsible for updating their location and connections.


Field Summary
static java.lang.String CELL_SIZE_MULT_S
          Cell based optimization cell size multiplier -setting id ("cellSizeMult").
static java.lang.String CON_ALG_S
          Connection algorithm selection -setting id ("connectionAlg").
static int DEF_CON_ALG
          default value for connection checking algorithm (2)
static int DEF_CON_CELL_SIZE_MULT
          default value for cell size multiplier (5)
static boolean DEF_RANDOMIZE_UPDATES
          should the update order of nodes be randomized -setting's default value (true)
static java.lang.String RANDOMIZE_UPDATES_S
          Should the order of node updates be different (random) within every update step -setting id ("randomizeUpdateOrder").
static java.lang.String SETTINGS_NS
          namespace of optimization settings ("Optimization")
 
Constructor Summary
World(SimScenario scen)
          Constructor.
 
Method Summary
 void cancelSim()
          Asynchronously cancels the currently running simulation
 java.util.List<DTNHost> getHosts()
          Returns the hosts in a list
 DTNHost getNodeByAddress(int address)
          Returns a node from the world by its address
 int getSizeX()
          Returns the x-size (width) of the world
 int getSizeY()
          Returns the y-size (height) of the world
 void setExternalEvents(ExternalEventsQueue extEvents)
          Sets (or disables) the External events queue for this world.
 void update()
          Update (move, connect, disconnect etc.) all hosts in the world.
 void warmupMovementModel(double time)
          Moves hosts in the world for the time given time initialize host positions properly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SETTINGS_NS

public static final java.lang.String SETTINGS_NS
namespace of optimization settings ("Optimization")

See Also:
Constant Field Values

CON_ALG_S

public static final java.lang.String CON_ALG_S
Connection algorithm selection -setting id ("connectionAlg").
Valid values are Default value is DEF_CON_ALG. Selection of the algorithm should not affect the amount of connections but it may affect the ordering of them (i.e. the order in which connections during the same update interval happen may change and also the "initiator" of the connection may change if the algorithm is changed).

See Also:
Constant Field Values

CELL_SIZE_MULT_S

public static final java.lang.String CELL_SIZE_MULT_S
Cell based optimization cell size multiplier -setting id ("cellSizeMult"). Single ConnectivityCell's size is the biggest radio range times this. Larger values save memory and decrease startup time but may result in slower simulation especially with algorithm 2. This has no effect for algorithm 1. Default value is DEF_CON_CELL_SIZE_MULT. Smallest accepted value is 2.

See Also:
ConnectivityGrid, Constant Field Values

RANDOMIZE_UPDATES_S

public static final java.lang.String RANDOMIZE_UPDATES_S
Should the order of node updates be different (random) within every update step -setting id ("randomizeUpdateOrder"). Boolean (true/false) variable. Default is @link DEF_RANDOMIZE_UPDATES.

See Also:
Constant Field Values

DEF_CON_ALG

public static final int DEF_CON_ALG
default value for connection checking algorithm (2)

See Also:
Constant Field Values

DEF_CON_CELL_SIZE_MULT

public static final int DEF_CON_CELL_SIZE_MULT
default value for cell size multiplier (5)

See Also:
Constant Field Values

DEF_RANDOMIZE_UPDATES

public static final boolean DEF_RANDOMIZE_UPDATES
should the update order of nodes be randomized -setting's default value (true)

See Also:
Constant Field Values
Constructor Detail

World

public World(SimScenario scen)
Constructor.

Parameters:
scen - The Scenario to base this world on.
Method Detail

warmupMovementModel

public void warmupMovementModel(double time)
Moves hosts in the world for the time given time initialize host positions properly. SimClock must be set to -time before calling this method.

Parameters:
time - The total time (seconds) to move

setExternalEvents

public void setExternalEvents(ExternalEventsQueue extEvents)
Sets (or disables) the External events queue for this world.

Parameters:
extEvents - The ee queue or null to disable external events

update

public void update()
Update (move, connect, disconnect etc.) all hosts in the world. Performs external events if there are any happening before next time value


cancelSim

public void cancelSim()
Asynchronously cancels the currently running simulation


getHosts

public java.util.List<DTNHost> getHosts()
Returns the hosts in a list

Returns:
the hosts in a list

getSizeX

public int getSizeX()
Returns the x-size (width) of the world

Returns:
the x-size (width) of the world

getSizeY

public int getSizeY()
Returns the y-size (height) of the world

Returns:
the y-size (height) of the world

getNodeByAddress

public DTNHost getNodeByAddress(int address)
Returns a node from the world by its address

Parameters:
address - The address of the node
Returns:
The requested node or null if it wasn't found