Biblioteca Java - Blame information for rev 16
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
16 | mihai | 1 | |
2 | package cfr; | ||
3 | import java.util.*; | ||
4 | import java.util.logging.Level; | ||
5 | import java.util.logging.Logger; | ||
6 | /** | ||
7 | * | ||
8 | * @author Mihai Hulea mihai.hulea@aut.utcluj.ro | ||
9 | */ | ||
10 | public class Simulator{ | ||
11 | |||
12 | int timp = 0; | ||
13 | ConexiuneDb db; | ||
14 | String gara; | ||
15 | |||
16 | public Simulator(String gara, ConexiuneDb db) { | ||
17 | this.db = db; | ||
18 | this.gara = gara; | ||
19 | } | ||
20 | |||
21 | void simuleaza(){ | ||
22 | while(true){ | ||
23 | timp++; | ||
24 | System.out.println("Timpul curent este:"+timp); | ||
25 | ArrayList<Tren> lista = | ||
26 | db.cautaTrenuri(gara, timp); | ||
27 | if(lista.size()>0){ | ||
28 | for(Tren t:lista){ | ||
29 | System.out.println("PLEACA TRENUL"); | ||
30 | t.afisare(); | ||
31 | } | ||
32 | }else{ | ||
33 | System.out.println("Nu exista tren!"); | ||
34 | } | ||
35 | try { | ||
36 | Thread.sleep(1000); | ||
37 | } catch (InterruptedException ex) { | ||
38 | Logger.getLogger(Simulator.class.getName()).log(Level.SEVERE, null, ex); | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | } | ||
43 | |||
44 |