forked from daveagp/java_visualize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCloneDeep.java
More file actions
37 lines (36 loc) · 988 Bytes
/
TestCloneDeep.java
File metadata and controls
37 lines (36 loc) · 988 Bytes
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
import java.util.ArrayList;
import studsclonedeep.Scrutin;
import studsclonedeep.Personne;
public class TestCloneDeep {
public static void main(final String[] args)
throws CloneNotSupportedException {
Personne p = new Personne("Dupont", "Julien");
p.organiserScrutin("Election bde");
Personne p1 = p.clone();
if (p1 == p) {
System.out.println("p == p1");
}
if (p.getNom() == p1.getNom()) {
System.out.println("p et p1 noms ==");
}
if (p.getPrenom() == p1.getPrenom()) {
System.out.println("p et p1 prenoms ==");
}
ArrayList<Scrutin> a1, a2;
a1 = p.getScrutins();
a2 = p1.getScrutins();
if (a1 == a2) {
System.out.println("p et p1 scrutins ==");
} else {
for(int i = 0; i < a1.size(); i++) {
if(a1.get(i) == a2.get(i)) {
System.out.println("Scrutins de rang " + i +" ==");
} else {
if(a1.get(i).getOrganisateur() == a2.get(i).getOrganisateur()) {
System.out.println("Oraganisateur des scrutins de rang" + i +"==");
}
}
}
}
}
}