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

  1.  
  2. package examples.prepriosys;
  3.  
  4.  
  5. import simula.* ;
  6. import simula.simset.* ;
  7. import simula.simset.simulation.* ;
  8. /**
  9.  * A preemptive system with priorities
  10.  * @author Andrea Poltronieri
  11.  * @version 1.0 12 Feb 1998
  12.  */
  13.  
  14. public class PrePrioSysSimulation 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.     /** List of busy Servers*/
  37.     public Head[] busy ;
  38.     
  39.  
  40.  
  41.  
  42. /**
  43.  * Print credits on standar error.
  44.  */
  45. private static void credits ( ) {
  46.     System.err.println("***********************************************************") ;
  47.     System.err.println("*                    Example for Korretto                 *") ;
  48.     System.err.println("*  A system with priorities (preemptive)                  *") ;
  49.     System.err.println("* see 'Simulation techiniques for discrete event systems' *") ;
  50.     System.err.println("*      I. Mitrani -- Cambridge University press           *") ;
  51.     System.err.println("*  example 3.3                                            *") ;
  52.     System.err.println("***********************************************************") ;
  53.     System.err.println("*  author : Andrea Poltronieri                            *") ;
  54.     System.err.println("*  Verona University                                      *") ;
  55.     System.err.println("*    e-mail : poltro@arena.sci.univr.it                     *") ;
  56.     System.err.println("*  http://arena.sci.univr.it/~poltro                      *") ;
  57.     System.err.println("***********************************************************") ;
  58.     return;
  59. }
  60. /**     
  61.   * Start the simualtion, instantiating a new Simulation and launching the main program
  62.   * @param  args[] Ignored
  63.   * @see simula.simset.simulation.Simulation
  64.   * @see simula.simset.simulation.SimulationMain
  65. */
  66.     public static void main (String args[]) {
  67.         try {
  68.             credits();
  69.             PrePrioSysSimulation sim = new PrePrioSysSimulation();
  70.             PrePrioSysMain main = new PrePrioSysMain(sim);
  71.         } catch (Exception e) { 
  72.             System.err.println ("Exception caught in PrePrioSys launcher :\n"+e) ;
  73.         }    
  74.     }
  75. }