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 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(java.util.List<DTNHost> hosts, int sizeX, int sizeY, double updateInterval, java.util.List<UpdateListener> updateListeners, boolean simulateConnections, java.util.List<EventQueue> eventQueues)
          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 scheduleUpdate(double simTime)
          Schedules an update request to all nodes to happen at the specified simulation time.
 void setNextEventQueue()
          Goes through all event Queues and sets the event queue that has the next event.
 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

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. 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_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(java.util.List<DTNHost> hosts,
             int sizeX,
             int sizeY,
             double updateInterval,
             java.util.List<UpdateListener> updateListeners,
             boolean simulateConnections,
             java.util.List<EventQueue> eventQueues)
Constructor.

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

setNextEventQueue

public void setNextEventQueue()
Goes through all event Queues and sets the event queue that has the next event.


update

public void update()
Update (move, connect, disconnect etc.) all hosts in the world. Runs all external events that are due between the time when this method is called and after one update interval.


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

scheduleUpdate

public void scheduleUpdate(double simTime)
Schedules an update request to all nodes to happen at the specified simulation time.

Parameters:
simTime - The time of the update