verinec.netsim
Class SimulationFactory

java.lang.Object
  extended by verinec.netsim.SimulationFactory

public class SimulationFactory
extends Object

Factory for Simulations that create Simulations. To choose the implementation class, the system property verinec.netsim.implementation is read. If this is not set, a Simulationis created as default.

Version:
$Revision: 1032 $
Author:
Dominik Jungo

Constructor Summary
SimulationFactory()
           
 
Method Summary
private static ISimulation createSimulation()
          Instantiate a simulation.
static ISimulation createSimulation(Document eventDocument)
          Instantiate a simulation createSimulation()
private static ISimulation createSimulation(Events events)
          Instantiate a simulation createSimulation()
static ISimulation createSimulation(IVerinecRepository repository, Document eventDocument)
          Instantiate a simulation createSimulation()
static ISimulation createSimulation(IVerinecRepository repository, Document eventDocument, double stoptime)
          Instantiate a simulation.
private static ISimulation createSimulation(IVerinecRepository repository, Events events)
          Instantiate a simulation createSimulation()
private static ISimulation createSimulation(IVerinecRepository repository, Events events, double stoptime)
          Instantiate a simulation.
private static Class getImpl()
          Determine the class to instantiate for the ISimulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulationFactory

public SimulationFactory()
Method Detail

getImpl

private static Class getImpl()
                      throws ClassNotFoundException
Determine the class to instantiate for the ISimulation. First looks at the verinec.netsim.implementation system property. If this is not found, returns Simulation.class.

Returns:
a Simulator Class
Throws:
ClassNotFoundException - when no Class with the given name id found

createSimulation

private static ISimulation createSimulation()
                                     throws NetSimException
Instantiate a simulation.

The simulation implementation is determined by the method getImpl().

The factory relies on the implementation of ISimulationto have a constructor with one String parameter, the repository name.

Returns:
An instance of the default implementation for the project name .
Throws:
NetSimException - if simulation can not be instantiated.

createSimulation

private static ISimulation createSimulation(Events events)
                                     throws NetSimException
Instantiate a simulation createSimulation()

Parameters:
events - inputevents that the simulator schedules initally, including the stoptime and the repository name in the header
Returns:
the simulation
Throws:
NetSimException - if simulation can not be instantiated.

createSimulation

public static ISimulation createSimulation(Document eventDocument)
                                    throws NetSimException
Instantiate a simulation createSimulation()

Parameters:
eventDocument - document that includes the inputevents that the simulator schedules initally, including the stoptime and the repository name in the header
Returns:
the simulation
Throws:
NetSimException - if simulation can not be instantiated. This may be because of invalid input events.

createSimulation

public static ISimulation createSimulation(IVerinecRepository repository,
                                           Document eventDocument)
                                    throws NetSimException
Instantiate a simulation createSimulation()

Parameters:
repository - the repository describing the network topology
eventDocument - document that includes the inputevents that the simulator schedules initally, including the stoptime and the repository name in the header
Returns:
the simulation
Throws:
NetSimException - if simulation can not be instantiated.

createSimulation

private static ISimulation createSimulation(IVerinecRepository repository,
                                            Events events)
                                     throws NetSimException
Instantiate a simulation createSimulation()

Parameters:
repository - the repository describing the network topology
events - inputevents that the simulator schedules initally. the events also contain a stoptime for the simulator.
Returns:
the simulation
Throws:
NetSimException - if simulation can not be instantiated.

createSimulation

private static ISimulation createSimulation(IVerinecRepository repository,
                                            Events events,
                                            double stoptime)
                                     throws NetSimException
Instantiate a simulation. createSimulation(verinec.data.repository.IVerinecRepository, verinec.netsim.loggers.events.Events)

Parameters:
repository - the repository describing the network topology
events - events that the simulator schedules initally
stoptime - the time value when the simulation stops. this value overwrites the value that is contained in the events object.
Returns:
the simulation
Throws:
NetSimException - if simulation can not be instantiated.

createSimulation

public static ISimulation createSimulation(IVerinecRepository repository,
                                           Document eventDocument,
                                           double stoptime)
                                    throws NetSimException
Instantiate a simulation. createSimulation(verinec.data.repository.IVerinecRepository, verinec.netsim.loggers.events.Events)

Parameters:
repository - the repository describing the network topology
eventDocument - document that includes the inputevents that the simulator schedules initally, including the stoptime and the repository name in the header
stoptime - the time value when the simulation stops. this value overwrites the value that is contained in the events object.
Returns:
the simulation
Throws:
NetSimException - if simulation can not be instantiated.

Copyright © 2005 Verinec, DIUF