home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / JSL.ZIP / JSL20 / examples / priosys / PrioSysSimulation.java < prev    next >
Encoding:
Java Source  |  1998-02-20  |  2.4 KB  |  72 lines

  1.  
  2. package examples.priosys;
  3.  
  4.  
  5. import simula.* ;
  6. import simula.simset.* ;
  7. import simula.simset.simulation.* ;
  8. /**
  9.  * A system with priorities
  10.  * @author Andrea Poltronieri
  11.  * @version 1.0 12 Feb 1998
  12.  */
  13.  
  14. public class PrioSysSimulation extends Simulation{
  15.     // Global vars declaration ;
  16.     /** Seed for random generator */
  17.     public int seed;
  18.     /** Top element in the queue */
  19.     public int top ;
  20.     /** Queue index */
  21.     public int i ;
  22.     /** Simulation length*/
  23.     public double simtime ;
  24.     /** Customers served*/
  25.     public int numthrough[] ;
  26.     /** Total sojourn time for customers */
  27.     public double sojourn[] ;
  28.     /** Available servers list*/
  29.     public Head available ;
  30.     /** Queues of customers */
  31.     public Head queue[] ;
  32.     /** Number of queues*/
  33.     public int k ;
  34.     /** Server number*/
  35.     public int c ;
  36.  
  37.  
  38. /**
  39.  * Print credits on standar error.
  40.  */
  41. private static void credits ( ) {
  42.     System.err.println("***********************************************************") ;
  43.     System.err.println("*                    Example for Korretto                 *") ;
  44.     System.err.println("*  A system with priorities                               *") ;
  45.     System.err.println("* see 'Simulation techiniques for discrete event systems' *") ;
  46.     System.err.println("*      I. Mitrani -- Cambridge University press           *") ;
  47.     System.err.println("*  example 3.3                                            *") ;
  48.     System.err.println("***********************************************************") ;
  49.     System.err.println("*  author : Andrea Poltronieri                            *") ;
  50.     System.err.println("*  Verona University                                      *") ;
  51.     System.err.println("*    e-mail : poltro@arena.sci.univr.it                     *") ;
  52.     System.err.println("*  http://arena.sci.univr.it/~poltro                      *") ;
  53.     System.err.println("***********************************************************") ;
  54.     return;
  55. }
  56. /**     
  57.   * Start the simualtion, instantiating a new Simulation and launching the main program
  58.   * @param  args[] Ignored
  59.   * @see simula.simset.simulation.Simulation
  60.   * @see simula.simset.simulation.SimulationMain
  61. */
  62.  
  63.     public static void main (String args[]) {
  64.         try {
  65.             credits();
  66.             PrioSysSimulation sim = new PrioSysSimulation();
  67.             PrioSysMain main = new PrioSysMain(sim);
  68.         } catch (Exception e) { 
  69.             System.err.println ("Exception caught in PrioSys launcher :\n"+e) ;
  70.         }    
  71.     }
  72. }