-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimulation.java
77 lines (48 loc) · 1.04 KB
/
Simulation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import java.util.ArrayList;
import java.util.List;
public class Simulation {
static List<Simulation> simulations = new ArrayList<>();
private Affichage affichage;
private Plateau plateau;
private boolean active = true;
private int id;
public Simulation(Plateau p, int id) {
affichage = new Affichage(p, id);
plateau = p;
}
public Plateau getPlateau() {
return plateau;
}
public void setPlateau(Plateau plateau) {
this.plateau = plateau;
}
public Affichage getAffichage() {
return affichage;
}
public void setAffichage(Affichage affichage) {
this.affichage = affichage;
}
public boolean delete() {
getAffichage().dispose();
return simulations.remove(this);
}
public boolean isActive() {
return active;
}
public void stop() {
active = false;
}
public void start() {
active = true;
}
public static void make(Plateau p) {
Simulation sim = new Simulation(p, simulations.size()+1);
simulations.add(sim);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}