Class Simulation

java.lang.Object
  extended by Simulation

public class Simulation
extends java.lang.Object

This is a singleton class, which means only one instance can be created.
COMP 2100
Project 3
November 2014


Method Summary
static Simulation getInstance()
          Get the Simulation object.
 WaitingLine getLine()
          Obtain a reference to the WaitingLine for this simulation.
 Server getServer()
          Obtain a reference to the Server for this simulation.
 int getTime()
          Get the current simulation clock time.
 void halt()
          Halt the simulation and exit.
 boolean isTracing()
          Determines whether tracing information should be displayed during the simulation run.
static void main(java.lang.String[] args)
           
 void run()
          Method to perform the simulation run.
 void scheduleArrival()
          Schedule a customer arrival event.
 void scheduleDeparture()
          Schedule a customer departure event.
 void scheduleSimulationEnd(int time)
          Schedule the simulation end event.
 void scheduleSimulationReport(int time)
          Schedule the simulation report event.
 void scheduleSimulationReportSequence(int interval, int endTime)
          Schedule a sequence of simulation report events based on a fixed reporting interval.
 void setTracing(boolean tracing)
          Determine whether tracing information should be displayed during the simulation run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)

getInstance

public static Simulation getInstance()
Get the Simulation object. This is a singleton class so it will always be the same object.


run

public void run()
Method to perform the simulation run.


halt

public void halt()
Halt the simulation and exit.


getTime

public int getTime()
Get the current simulation clock time. The simulation clock is initialized to 0 and is changed only upon event occurrence. Thus it increases in a non-uniform way. It is integer and unit-less.

Returns:
current time

isTracing

public boolean isTracing()
Determines whether tracing information should be displayed during the simulation run. Essential for debugging.

Returns:
true if tracing enabled, false otherwise

setTracing

public void setTracing(boolean tracing)
Determine whether tracing information should be displayed during the simulation run. Essential for debugging.

Parameters:
tracing - Set true to enable tracing and false to disable it

getLine

public WaitingLine getLine()
Obtain a reference to the WaitingLine for this simulation.

Returns:
the waiting line object.

getServer

public Server getServer()
Obtain a reference to the Server for this simulation.

Returns:
the server object.

scheduleArrival

public void scheduleArrival()
Schedule a customer arrival event. The time of event occurrence is determined by the current clock setting and the characteristics of the interarrival time random number generator.


scheduleDeparture

public void scheduleDeparture()
Schedule a customer departure event. This must be done at the time the customer is given access to the server. The time of event occurrence is determined by the current clock setting and the characteristics of the service time time random number generator.


scheduleSimulationReport

public void scheduleSimulationReport(int time)
Schedule the simulation report event. This is done on demand. When this event occurs, a statistical snapshot of the simulation system is compiled and displayed.

Parameters:
time - desired reporting time in simulation clock units

scheduleSimulationReportSequence

public void scheduleSimulationReportSequence(int interval,
                                             int endTime)
Schedule a sequence of simulation report events based on a fixed reporting interval. Each time the reporting event occurs, a statistical snapshot of the simulation system is compiled and displayed.

Parameters:
interval - desired reporting interval in simulation clock units. The first report will be produced this many clock units following the current clock time.
endTime - No reports will be scheduled later than this clock time.

scheduleSimulationEnd

public void scheduleSimulationEnd(int time)
Schedule the simulation end event. This is done automatically but an earlier end time can be scheduled by any other simulation entity. When this event occurs, simulation halts.

Parameters:
time - desired ending time in simulation clock units