Elo History
authorMartin Rexa <martin.rexa@centrum.cz>
Tue, 12 Jan 2010 15:59:17 +0100
changeset 199e23dcb2ef35e
parent 198 8eb871e208d2
child 200 11c1287c7802
Elo History
statistics/src/main/java/cz/xelfi/quoridor/statistics/EloList.java
     1.1 --- a/statistics/src/main/java/cz/xelfi/quoridor/statistics/EloList.java	Tue Jan 12 15:58:54 2010 +0100
     1.2 +++ b/statistics/src/main/java/cz/xelfi/quoridor/statistics/EloList.java	Tue Jan 12 15:59:17 2010 +0100
     1.3 @@ -32,6 +32,7 @@
     1.4  import java.util.Collections;
     1.5  import java.util.ArrayList;
     1.6  import javax.xml.bind.annotation.XmlElement;
     1.7 +import javax.xml.bind.annotation.XmlAttribute;
     1.8  import javax.xml.bind.annotation.XmlElementWrapper;
     1.9  import javax.xml.bind.annotation.XmlRootElement;
    1.10  import javax.xml.bind.annotation.XmlAccessType;
    1.11 @@ -49,14 +50,22 @@
    1.12      static int KVAL_FOLLOW = 10;
    1.13      static int KVAL_LIMIT = 30;
    1.14  
    1.15 -    private Map<String, Double> players;
    1.16 -    private Map<String, Integer> playerGames;
    1.17 +    Map<String, Double> players;
    1.18 +    Map<String, Integer> playerGames;
    1.19 +    long modified = 0;
    1.20 +
    1.21  
    1.22      public EloList () {
    1.23          players = new HashMap<String, Double>();
    1.24          playerGames = new HashMap<String, Integer>();
    1.25      }
    1.26  
    1.27 +    public EloList(EloList src){
    1.28 +        this.players = new HashMap<String, Double>(src.players);
    1.29 +        this.playerGames = new HashMap<String, Integer>(src.playerGames);
    1.30 +        this.modified = src.modified;
    1.31 +    }
    1.32 +
    1.33      @XmlElementWrapper(name="elolist")
    1.34      @XmlElement(name="item")
    1.35      public List<EloEntry> getFinalList(){
    1.36 @@ -69,6 +78,11 @@
    1.37      }
    1.38  
    1.39      public EloList putResult(String winner, String looser){
    1.40 +        return putResult(winner, looser, System.currentTimeMillis());
    1.41 +    }
    1.42 +
    1.43 +    public EloList putResult(String winner, String looser, long modified){
    1.44 +        this.modified = modified;
    1.45          double wElo = getElo(winner);
    1.46          double lElo = getElo(looser);
    1.47