Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nl.tudelft.simulation.dsol.simulators
Class Simulator

    java.lang.Object
      nl.tudelft.simulation.event.EventProducer
          nl.tudelft.simulation.dsol.simulators.Simulator

All Implemented Interfaces:
  nl.tudelft.simulation.event.EventProducerInterface, java.rmi.Remote, java.lang.Runnable, java.io.Serializable, SimulatorInterface

Direct Known Subclasses:
  DESSSimulator, DEVSSimulator

public abstract class Simulator
extends nl.tudelft.simulation.event.EventProducer
implements SimulatorInterface, java.lang.Runnable

The Simulator class is an abstract implementation of the SimulatorInterface.

(c) copyright 2003 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Since:
  1.0
Version:
  1.13 2004-03-18
Author:
  Peter Jacobs
See Also:
  Serialized Form

Field Summary
`protected Replication` | `replication` replication represents the currently active replication
`protected boolean` | `running` running represents the binary state of the simulator
`protected java.lang.Object` | `semaphore` the simulatorSemaphore
`protected double` | `simulatorTime` simulatorTime represents the simulationTime
`protected nl.tudelft.simulation.language.concurrent.WorkerThread` | `worker` a worker

Fields inherited from class nl.tudelft.simulation.event.EventProducer
`listeners`

Fields inherited from interface nl.tudelft.simulation.dsol.simulators.SimulatorInterface
`END_OF_REPLICATION_EVENT, START_EVENT, START_REPLICATION_EVENT, STEP_EVENT, STOP_EVENT, TIME_CHANGED_EVENT, WARMUP_EVENT`

Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
`FIRST_POSITION, LAST_POSITION`

Constructor Summary
`Simulator()` constructs a new Simulator

Method Summary
`Replication` | `getReplication()` returns the currently executed replication.
`double` | `getSimulatorTime()` returns the actual simulator time.
`void` | `initialize(Replication replication)` initializes the simulator with a specified replication.
`boolean` | `isRunning()` is the simulator running.
`abstract void` | `run()` The run method defines the actual time step mechanism of the simulator.
`void` | `start()` starts the simulator
`void` | `step()` steps the simulator.
`void` | `stop()` stops the simulator.

Methods inherited from class nl.tudelft.simulation.event.EventProducer
`addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
`addListener, addListener, addListener, addListener, getEventTypes, removeListener`

Field Detail

### simulatorTime

    protected double simulatorTime

  simulatorTime represents the simulationTime

### running

    protected boolean running

  running represents the binary state of the simulator

### replication

    protected Replication replication

  replication represents the currently active replication

### worker

    protected nl.tudelft.simulation.language.concurrent.WorkerThread worker

  a worker

### semaphore

    protected java.lang.Object semaphore

  the simulatorSemaphore

Constructor Detail

### Simulator

    public Simulator()

  constructs a new Simulator

Method Detail

### getSimulatorTime

    public double getSimulatorTime()

  Description copied from interface: `SimulatorInterface`
  returns the actual simulator time.

  Specified by:
    `getSimulatorTime` in interface `SimulatorInterface`
  Returns:
    the simulator time.
  See Also:
    `#getSimulatorTime()`

### getReplication

    public Replication getReplication()

  Description copied from interface: `SimulatorInterface`
  returns the currently executed replication.

  Specified by:
    `getReplication` in interface `SimulatorInterface`
  Returns:
    the current replication
  See Also:
    `#getReplication()`

### initialize

    public void initialize(Replication replication)
                    throws java.rmi.RemoteException,
                           SimRuntimeException

  Description copied from interface: `SimulatorInterface`
  initializes the simulator with a specified replication.

  Specified by:
    `initialize` in interface `SimulatorInterface`
  Parameters:
    `replication` - the replication
  Throws:
    `java.rmi.RemoteException` - on network failure
    `SimRuntimeException` - on simulator failure (simulator is running)
  See Also:
    `#initialize(Replication)`

### isRunning

    public boolean isRunning()

  Description copied from interface: `SimulatorInterface`
  is the simulator running.

  Specified by:
    `isRunning` in interface `SimulatorInterface`
  Returns:
    boolean
  See Also:
    `SimulatorInterface.isRunning()`

### run

    public abstract void run()

  The run method defines the actual time step mechanism of the simulator. The implementation of this method depends on the formalism. Where discrete event formalisms loop over an eventlist continuous simulators take pre-defined time steps.

  Specified by:
    `run` in interface `java.lang.Runnable`

### start

    public void start()
               throws SimRuntimeException,
                      java.rmi.RemoteException

  Description copied from interface: `SimulatorInterface`
  starts the simulator

  Specified by:
    `start` in interface `SimulatorInterface`
  Throws:
    `java.rmi.RemoteException` - on network failure
    `SimRuntimeException` - whenever starting fails. Possible occasions include starting a started simulator
  See Also:
    `SimulatorInterface.start()`

### step

    public void step()
              throws SimRuntimeException

  Description copied from interface: `SimulatorInterface`
  steps the simulator.

  Specified by:
    `step` in interface `SimulatorInterface`
  Throws:
    `SimRuntimeException` - whenever stepping fails. Possible occasions include stepping a stopped simulator
  See Also:
    `SimulatorInterface.step()`

### stop

    public void stop()

  Description copied from interface: `SimulatorInterface`
  stops the simulator.

  Specified by:
    `stop` in interface `SimulatorInterface`
  See Also:
    `SimulatorInterface.stop()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2004 Delft University of Technology, the Netherlands. All Rights Reserved.