peersim
Class Simulator

java.lang.Object
  extended by peersim.Simulator

public class Simulator
extends java.lang.Object

This is the main entry point to peersim. This class loads configuration and detects the simulation type. According to this, it invokes the appropriate simulator. The known simulators at this moment, along with the way to detect them are the following:

This list represents the order in which these alternatives are checked. That is, if more than one return true, then the first will be taken. Note that this class checks only for these clues and does not check if the configuration is consistent or valid.

See Also:
main(java.lang.String[])

Parameter Summary
simulation.experiments
          Parameter representing the number of times the experiment is run.
simulation.stdout
          If present, this parameter activates the redirection of the standard output to a given PrintStream.
 
Field Summary
static int CDSIM
          CDSimulator
static int EDSIM
          EDSimulator
protected static java.lang.String[] simName
          the class names of simulators used
static int UNKNOWN
          Unknown simulator
 
Constructor Summary
Simulator()
           
 
Method Summary
static int getSimID()
          Returns the numeric id of the simulator to invoke.
static void main(java.lang.String[] args)
          Loads the configuration and executes the experiments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

simulation.experiments

Parameter representing the number of times the experiment is run. Defaults to 1.


simulation.stdout

If present, this parameter activates the redirection of the standard output to a given PrintStream. This comes useful for processing the output of the simulation from within the simulator.

Field Detail

CDSIM

public static final int CDSIM
CDSimulator

See Also:
Constant Field Values

EDSIM

public static final int EDSIM
EDSimulator

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
Unknown simulator

See Also:
Constant Field Values

simName

protected static final java.lang.String[] simName
the class names of simulators used

Constructor Detail

Simulator

public Simulator()
Method Detail

getSimID

public static int getSimID()
Returns the numeric id of the simulator to invoke. At the moment this can be CDSIM, EDSIM or UNKNOWN.


main

public static void main(java.lang.String[] args)
Loads the configuration and executes the experiments. The number of independent experiments is given by config parameter "simulation.experiments". In all experiments the configuration is the same, only the random seed is not re-initialized between experiments.

Loading the configuration is currently done with the help of constructing an instance of ParsedProperties using the constructor ParsedProperties.ParsedProperties(String[]). The parameter args is simply passed to this class. This class is then used to initialize the configuration.

After loading the configuration, the experiments are run by invoking the appropriate engine, which is identified as follows:

This list represents the order in which these alternatives are checked. That is, if more than one return true, then the first will be taken. Note that this class checks only for these clues and does not check if the configuration is consistent or valid.

Parameters:
args - passed on to ParsedProperties.ParsedProperties(String[])
See Also:
ParsedProperties, Configuration, CDSimulator, EDSimulator