home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-02-20 | 1.0 KB | 53 lines |
-
- package examples.network;
-
-
- import simula.*;
- import simula.simset.* ;
- import simula.simset.simulation.*;
- import simula.random.* ;
-
- /**
- * The job is an object without actions (= empty constructor)
- * @author Andrea Poltronieri
- * @version 1.0 12 Feb 1998
- */
-
- public class Job extends simula.simset.Link {
- /** The active simulation */
- NetworkSimulation sim ;
- /** Starting job time */
- double arrtime ;
-
-
-
- /**
- * @param _sim The active Simulation
- */
-
- public Job (NetworkSimulation sim) {
- super();
- this.sim=sim ;
- }
- public void move(int n, double a[]) {
- try {
- int i ;
- i=sim.choice(n,a) ;
- if (i>0) {
- this.into(sim.node[i].queue) ;
- if (sim.node[i].device.idle())
- sim.activate(sim.node[i].device) ;
- }
- else {
- sim.sojourn+=sim.time()-arrtime ;
- sim.numthrough++ ;
- this.out() ;
- }
-
-
- } catch (Exception e ) {
- System.err.println ("Exception caught in " + this.toString() + " :\n" + e) ;
- System.exit(1) ;
- }
- }
- }