KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > wrd > Participant


1 package org.enhydra.shark.wrd;
2
3 import java.io.Serializable JavaDoc;
4
5 public class Participant implements Serializable JavaDoc, Cloneable JavaDoc {
6
7    private String JavaDoc id;
8    private Counter score=new Counter();
9
10    public Participant () {}
11
12    public Participant (String JavaDoc id) {
13       this.id=id;
14    }
15
16    public void incrementScore () {
17       score.increment();
18    }
19
20    public int getScore () {
21       return score.value();
22    }
23
24    public String JavaDoc getId () {
25       return id;
26    }
27
28    public String JavaDoc toString () {
29       return "I'm "+id+", and my score is "+score.value();
30    }
31
32    public Object JavaDoc clone () {
33       try {
34          return super.clone();
35          //return super.clone();
36
} catch (Exception JavaDoc ex) {
37          return null;
38       }
39    }
40
41 }
42
Popular Tags