Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (38 loc) · 1.18 KB

File metadata and controls

38 lines (38 loc) · 1.18 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package studsclone;
import java.util.ArrayList;
import studsabstract.Bulletin;
public class Personne implements Cloneable {
private String nom, prenom;
private int nbParticipations = 0, nbOrg = 0;
private ArrayList<Scrutin> scrutins;
public Personne(final String n, final String p) {
this.nom = n;
this.prenom = p;
scrutins = new ArrayList<Scrutin>();
}
public Scrutin organiserScrutin(final String nom) {
Scrutin s = new Scrutin(nom,this);
scrutins.add(s);
nbOrg ++;
return s;
}
/** le clonage est profond, il duplique les objets references. */
@Override
public Personne clone() throws CloneNotSupportedException {
Personne cl = new Personne(new String(nom), new String(prenom));
cl.nbParticipations = nbParticipations;
cl.nbOrg = nbOrg;
for (Scrutin scr : scrutins ) {
Scrutin sclone = scr.clone();
sclone.setOrganisateur(cl);
cl.scrutins.add(sclone);
}
return cl;
}
public String getNom() { return nom; }
public String getPrenom() {return prenom; }
public ArrayList<Scrutin> getScrutins() {return scrutins; }
public void voter(final Bulletin b){ }
public void consulterResultat(Scrutin s) { }
public void seRetirerDUnScrutin(Scrutin s) { }
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.