Documentation of 'edu.rit.sim.Simulation' Java class
Simulation
edu.rit.sim

Class Simulation



  • public class Simulation
    extends java.lang.Object
    Class Simulation provides a discrete event simulation. To write a discrete event simulation program:

    1. Create a Simulation object.

    2. Create one or more Events and add them to the simulation (by calling the doAt() or doAfter() methods).

    3. Run the simulation (by calling the run() method). The simulation performs events, by calling each event's perform() method, in order according to the events' simulation times, as returned by each event's time() method. Performing an event may cause further events to be created and added to the simulation.

    4. When there are no more events, the simulation is finished. At this point the simulation's run() method returns.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Simulation()
      Construct a new simulation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void doAfter(double dt, Event event)
      Schedule the given event to be performed at a time dt in the future (at current simulation time + dt) in this simulation.
      void doAt(double t, Event event)
      Schedule the given event to be performed at the given time in this simulation.
      void run()
      Run the simulation.
      double time()
      Returns the current simulation time.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Simulation

        public Simulation()
        Construct a new simulation.
    • Method Detail

      • time

        public double time()
        Returns the current simulation time.
        Returns:
        Simulation time.
      • doAt

        public void doAt(double t,
                         Event event)
        Schedule the given event to be performed at the given time in this simulation.
        Parameters:
        t - Simulation time for event.
        event - Event to be performed.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if t is less than the current simulation time.
        java.lang.NullPointerException - (unchecked exception) Thrown if event is null.
      • doAfter

        public void doAfter(double dt,
                            Event event)
        Schedule the given event to be performed at a time dt in the future (at current simulation time + dt) in this simulation.
        Parameters:
        dt - Simulation time delta for event.
        event - Event to be performed.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if dt is less than zero.
        java.lang.NullPointerException - (unchecked exception) Thrown if event is null.
      • run

        public void run()
        Run the simulation. At the start of the simulation, the simulation time is 0. The run() method returns when there are no more events.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.