TD2: Fix all important bugs in the object passing server and client
[TD_SR.git] / TD2 / client / Message.java
CommitLineData
c4aaaeca
JB
1import java.io.Serializable;
2import java.util.Calendar;
da31e6da 3import java.text.SimpleDateFormat;
c4aaaeca
JB
4
5public class Message implements Serializable {
6 // L'emeteur du message
7 private String emetteur ;
8 // Le contenu du message
9 private String texte ;
10 // Heure du message
11 private Calendar heure ;
12
13 // Les méthodes
14
da31e6da 15 Message(String name, String msg, Calendar c) {
c4aaaeca
JB
16 emetteur = name;
17 texte = msg;
da31e6da 18 heure = c;
c4aaaeca
JB
19 }
20
21 /**
22 * @param name the emetteur to set
23 */
24 public void setEmetteur(String name) {
25 emetteur = name;
26 }
27
28 /**
29 * @return the emetteur
30 */
31 public String getEmetteur() {
32 return emetteur;
33 }
34
35 /**
36 * @param texte the texte to set
37 */
38 public void setTexte(String texte) {
39 this.texte = texte;
40 }
41
42 /**
43 * @return the texte
44 */
45 public String getTexte() {
46 return texte;
47 }
48
49 /**
50 * @param heure the heure to set
51 */
52 public void setHeure(Calendar heure) {
53 this.heure = heure;
54 }
55
56 /**
57 * @return the heure
58 */
59 public Calendar getHeure() {
60 return heure;
61 }
62
63 public String toString() {
da31e6da
JB
64 SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
65 return "<" + emetteur + "|" + dateFormat.format(heure.getTime()) + "> " + texte;
c4aaaeca
JB
66 }
67}