core
Class SimScenario

java.lang.Object
  extended by core.SimScenario
All Implemented Interfaces:
java.io.Serializable

public class SimScenario
extends java.lang.Object
implements java.io.Serializable

A simulation scenario used for getting and storing the settings of a simulation run.

See Also:
Serialized Form

Field Summary
static java.lang.String APPCOUNT_S
          setting name for the number of applications
static java.lang.String APPTYPE_NS
          namespace for application type settings ("Application")
static java.lang.String APPTYPE_S
          application type -setting id ("type")
static java.lang.String END_TIME_S
          end time -setting id ("endTime")
static java.lang.String GAPPNAME_S
          application name in the group -setting id ("application")
static java.lang.String GROUP_ID_S
          group id -setting id ("groupID")
static java.lang.String GROUP_NS
          namespace for host group settings ("Group")
protected  java.util.List<DTNHost> hosts
          List of hosts in this simulation
static java.lang.String INTERFACENAME_S
          interface name in the group -setting id ("interface")
static java.lang.String INTNAME_S
          interface name -setting id ("name")
static java.lang.String INTTYPE_NS
          namespace for interface type settings ("Interface")
static java.lang.String INTTYPE_S
          interface type -setting id ("type")
static java.lang.String MOVEMENT_MODEL_S
          movement model class -setting id ("movementModel")
static java.lang.String NAME_S
          scenario name -setting id ("name")
static java.lang.String NROF_GROUPS_S
          number of host groups -setting id ("nrofHostGroups")
static java.lang.String NROF_HOSTS_S
          number of hosts in the group -setting id ("nrofHosts")
static java.lang.String NROF_INTERF_S
          number of interfaces in the group -setting id ("nrofInterfaces")
static java.lang.String NROF_INTTYPES_S
          number of interface types -setting id ("nrofInterfaceTypes")
static java.lang.String ROUTER_S
          router class -setting id ("router")
static java.lang.String SCAN_INTERVAL_S
          scanning interval -setting id ("scanInterval")
static java.lang.String SCENARIO_NS
          namespace of scenario settings ("Scenario")
static java.lang.String SIM_CON_S
          simulate connections -setting id ("simulateConnections")
static java.lang.String UP_INT_S
          update interval -setting id ("updateInterval")
 
Constructor Summary
protected SimScenario()
          Creates a scenario based on Settings object.
 
Method Summary
 void addApplicationListener(ApplicationListener al)
          Adds a new application event listener for all nodes.
 void addConnectionListener(ConnectionListener cl)
          Adds a new connection listener for all nodes
 void addMessageListener(MessageListener ml)
          Adds a new message listener for all nodes
 void addMovementListener(MovementListener ml)
          Adds a new movement listener for all nodes
 void addUpdateListener(UpdateListener ul)
          Adds a new update listener for the world
protected  void createHosts()
          Creates hosts for the scenario
 java.util.List<ApplicationListener> getApplicationListeners()
          Returns the list of registered application event listeners
 double getEndTime()
          Returns simulation's end time
 java.util.List<EventQueue> getExternalEvents()
          Returns the (external) event queue(s) of this scenario or null if there aren't any
 java.util.List<DTNHost> getHosts()
          Returns the list of nodes for this scenario.
static SimScenario getInstance()
          Returns the SimScenario instance and creates one if it doesn't exist yet
 SimMap getMap()
          Returns the SimMap this scenario uses, or null if scenario doesn't use any map
 double getMaxHostRange()
          Returns how long range the hosts' radios have
 java.lang.String getName()
          Returns the name of the simulation run
 double getUpdateInterval()
          Returns update interval (simulated seconds) of the simulation
 java.util.List<UpdateListener> getUpdateListeners()
          Returns the list of registered update listeners
 World getWorld()
          Returns the World object of this scenario
 int getWorldSizeX()
          Returns the width of the world
 int getWorldSizeY()
          Returns the height of the world
static void reset()
           
 boolean simulateConnections()
          Returns true if connections should be simulated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCENARIO_NS

public static final java.lang.String SCENARIO_NS
namespace of scenario settings ("Scenario")

See Also:
Constant Field Values

NROF_GROUPS_S

public static final java.lang.String NROF_GROUPS_S
number of host groups -setting id ("nrofHostGroups")

See Also:
Constant Field Values

NROF_INTTYPES_S

public static final java.lang.String NROF_INTTYPES_S
number of interface types -setting id ("nrofInterfaceTypes")

See Also:
Constant Field Values

NAME_S

public static final java.lang.String NAME_S
scenario name -setting id ("name")

See Also:
Constant Field Values

END_TIME_S

public static final java.lang.String END_TIME_S
end time -setting id ("endTime")

See Also:
Constant Field Values

UP_INT_S

public static final java.lang.String UP_INT_S
update interval -setting id ("updateInterval")

See Also:
Constant Field Values

SIM_CON_S

public static final java.lang.String SIM_CON_S
simulate connections -setting id ("simulateConnections")

See Also:
Constant Field Values

INTTYPE_NS

public static final java.lang.String INTTYPE_NS
namespace for interface type settings ("Interface")

See Also:
Constant Field Values

INTTYPE_S

public static final java.lang.String INTTYPE_S
interface type -setting id ("type")

See Also:
Constant Field Values

INTNAME_S

public static final java.lang.String INTNAME_S
interface name -setting id ("name")

See Also:
Constant Field Values

APPTYPE_NS

public static final java.lang.String APPTYPE_NS
namespace for application type settings ("Application")

See Also:
Constant Field Values

APPTYPE_S

public static final java.lang.String APPTYPE_S
application type -setting id ("type")

See Also:
Constant Field Values

APPCOUNT_S

public static final java.lang.String APPCOUNT_S
setting name for the number of applications

See Also:
Constant Field Values

GROUP_NS

public static final java.lang.String GROUP_NS
namespace for host group settings ("Group")

See Also:
Constant Field Values

GROUP_ID_S

public static final java.lang.String GROUP_ID_S
group id -setting id ("groupID")

See Also:
Constant Field Values

NROF_HOSTS_S

public static final java.lang.String NROF_HOSTS_S
number of hosts in the group -setting id ("nrofHosts")

See Also:
Constant Field Values

SCAN_INTERVAL_S

public static final java.lang.String SCAN_INTERVAL_S
scanning interval -setting id ("scanInterval")

See Also:
Constant Field Values

MOVEMENT_MODEL_S

public static final java.lang.String MOVEMENT_MODEL_S
movement model class -setting id ("movementModel")

See Also:
Constant Field Values

ROUTER_S

public static final java.lang.String ROUTER_S
router class -setting id ("router")

See Also:
Constant Field Values

NROF_INTERF_S

public static final java.lang.String NROF_INTERF_S
number of interfaces in the group -setting id ("nrofInterfaces")

See Also:
Constant Field Values

INTERFACENAME_S

public static final java.lang.String INTERFACENAME_S
interface name in the group -setting id ("interface")

See Also:
Constant Field Values

GAPPNAME_S

public static final java.lang.String GAPPNAME_S
application name in the group -setting id ("application")

See Also:
Constant Field Values

hosts

protected java.util.List<DTNHost> hosts
List of hosts in this simulation

Constructor Detail

SimScenario

protected SimScenario()
Creates a scenario based on Settings object.

Method Detail

reset

public static void reset()

getInstance

public static SimScenario getInstance()
Returns the SimScenario instance and creates one if it doesn't exist yet


getName

public java.lang.String getName()
Returns the name of the simulation run

Returns:
the name of the simulation run

simulateConnections

public boolean simulateConnections()
Returns true if connections should be simulated

Returns:
true if connections should be simulated (false if not)

getWorldSizeX

public int getWorldSizeX()
Returns the width of the world

Returns:
the width of the world

getWorldSizeY

public int getWorldSizeY()
Returns the height of the world

Returns:
the height of the world

getEndTime

public double getEndTime()
Returns simulation's end time

Returns:
simulation's end time

getUpdateInterval

public double getUpdateInterval()
Returns update interval (simulated seconds) of the simulation

Returns:
update interval (simulated seconds) of the simulation

getMaxHostRange

public double getMaxHostRange()
Returns how long range the hosts' radios have

Returns:
Range in meters

getExternalEvents

public java.util.List<EventQueue> getExternalEvents()
Returns the (external) event queue(s) of this scenario or null if there aren't any

Returns:
External event queues in a list or null

getMap

public SimMap getMap()
Returns the SimMap this scenario uses, or null if scenario doesn't use any map

Returns:
SimMap or null if no map is used

addConnectionListener

public void addConnectionListener(ConnectionListener cl)
Adds a new connection listener for all nodes

Parameters:
cl - The listener

addMessageListener

public void addMessageListener(MessageListener ml)
Adds a new message listener for all nodes

Parameters:
ml - The listener

addMovementListener

public void addMovementListener(MovementListener ml)
Adds a new movement listener for all nodes

Parameters:
ml - The listener

addUpdateListener

public void addUpdateListener(UpdateListener ul)
Adds a new update listener for the world

Parameters:
ul - The listener

getUpdateListeners

public java.util.List<UpdateListener> getUpdateListeners()
Returns the list of registered update listeners

Returns:
the list of registered update listeners

addApplicationListener

public void addApplicationListener(ApplicationListener al)
Adds a new application event listener for all nodes.

Parameters:
al - The listener

getApplicationListeners

public java.util.List<ApplicationListener> getApplicationListeners()
Returns the list of registered application event listeners

Returns:
the list of registered application event listeners

createHosts

protected void createHosts()
Creates hosts for the scenario


getHosts

public java.util.List<DTNHost> getHosts()
Returns the list of nodes for this scenario.

Returns:
the list of nodes for this scenario.

getWorld

public World getWorld()
Returns the World object of this scenario

Returns:
the World object