1 package org.enhydra.shark.wrd; 2 3 import java.io.Serializable ; 4 5 public class Participant implements Serializable , Cloneable { 6 7 private String id; 8 private Counter score=new Counter(); 9 10 public Participant () {} 11 12 public Participant (String 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 getId () { 25 return id; 26 } 27 28 public String toString () { 29 return "I'm "+id+", and my score is "+score.value(); 30 } 31 32 public Object clone () { 33 try { 34 return super.clone(); 35 } catch (Exception ex) { 37 return null; 38 } 39 } 40 41 } 42 | Popular Tags |