View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.tournament.deathmatch;
2   
3   import java.util.ArrayList;
4   import java.util.HashMap;
5   import java.util.List;
6   import java.util.Map;
7   
8   import cz.cuni.amis.pogamut.ut2004.analyzer.stats.UT2004AnalyzerObsStats;
9   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerScore;
10  import cz.cuni.amis.pogamut.ut2004.tournament.match.result.UT2004IndividualMatchResult;
11  import cz.cuni.amis.pogamut.ut2004.tournament.match.result.UT2004MatchResult;
12  import cz.cuni.amis.utils.maps.HashMapMap;
13  import cz.cuni.amis.utils.token.IToken;
14  
15  public class UT2004DeathMatchResult extends UT2004IndividualMatchResult {
16  	
17  	private List<IToken> bots = new ArrayList<IToken>();
18  	
19  	private List<IToken> nativeBots = new ArrayList<IToken>();
20  	
21  	private Map<IToken, PlayerScore> finalScores = new HashMap<IToken, PlayerScore>();
22  	
23  	private Map<IToken, Integer> totalKills = new HashMap<IToken, Integer>();
24  	
25  	private Map<IToken, Integer> wasKilled = new HashMap<IToken, Integer>();
26  	
27  	private HashMapMap<IToken, IToken, Integer> killCounts = new HashMapMap<IToken, IToken, Integer>(); 
28  	
29  	private Map<IToken, Integer> suicides = new HashMap<IToken, Integer>();
30  	
31  	private Map<IToken, UT2004AnalyzerObsStats> botObservers = new HashMap<IToken, UT2004AnalyzerObsStats>();
32  
33  	/**
34  	 * When the match has ended (in seconds);
35  	 */
36  	public double matchTimeEnd;
37  
38  	@Override
39  	public String toString() {
40  		return "UT2004DeathMatchResult[" + (isDraw() ? "DRAW" : ("winnerBot=" + getWinnerBot()) ) + "]";
41  	}
42  	
43  	public UT2004DeathMatchResult() {
44  		super();
45  	}
46  	
47  	public UT2004DeathMatchResult(IToken winnerBot) {
48  		super(winnerBot);
49  	}
50  
51  	/**
52  	 * Returns list with custom bots (run by Pogamut platform).
53  	 * @return
54  	 */
55  	public List<IToken> getBots() {
56  		return bots;
57  	}
58  
59  	/**
60  	 * List with custom bots (run by Pogamut platform).
61  	 * @param bots
62  	 */
63  	public void setBots(List<IToken> bots) {
64  		this.bots = bots;
65  	}
66  
67  	/**
68  	 * Returns list with native bots (bots from UT2004 itself).
69  	 * @return
70  	 */
71  	public List<IToken> getNativeBots() {
72  		return nativeBots;
73  	}
74  
75  	/**
76  	 * List with native bots (bots from UT2004 itself).
77  	 * @param nativeBots
78  	 */
79  	public void setNativeBots(List<IToken> nativeBots) {
80  		this.nativeBots = nativeBots;
81  	}
82  	
83  	/**
84  	 * Returns list of all bot (custom + native) ids.
85  	 * @return
86  	 */
87  	public List<IToken> getAllBots() {
88  		List<IToken> all = new ArrayList<IToken>(this.bots);
89  		all.addAll(this.nativeBots);
90  		return all;
91  	}
92  
93  	/**
94  	 * When the match has ended (in seconds). I.e., how long was the match.
95  	 */
96  	public double getMatchTimeEnd() {
97  		return matchTimeEnd;
98  	}
99  
100 	/**
101 	 * When the match has ended (in seconds). I.e., how long was the match.
102 	 */
103 	public void setMatchTimeEnd(double matchTimeEnd) {
104 		this.matchTimeEnd = matchTimeEnd;
105 	}
106 
107 	/**
108 	 * Final scores of bots.
109 	 * @return
110 	 */
111 	public Map<IToken, PlayerScore> getFinalScores() {
112 		return finalScores;
113 	}
114 
115 	/**
116 	 * Final scores of bots.
117 	 * @return
118 	 */
119 	public void setFinalScores(Map<IToken, PlayerScore> finalScores) {
120 		this.finalScores = finalScores;
121 	}
122 
123 	/**
124 	 * Who -&gt; killed Whom -&gt; How many times, i.e., map.get(killerId).get(victimId) == how many time killer killed the victim.
125 	 * @return
126 	 */
127 	public HashMapMap<IToken, IToken, Integer> getKillCounts() {
128 		return killCounts;
129 	}
130 
131 	/**
132 	 * Who -&gt; killed Whom -&gt; How many times, i.e., map.get(killerId).get(victimId) == how many time killer killed the victim.
133 	 * @return
134 	 */
135 	public void setKillCounts(HashMapMap<IToken, IToken, Integer> killCounts) {
136 		this.killCounts = killCounts;
137 	}
138 	
139 	
140 	/**
141 	 * How many times one bot killed another bot.
142 	 * @return
143 	 */
144 	public Map<IToken, Integer> getTotalKills() {
145 		return totalKills;
146 	}
147 
148 	/**
149 	 * How many times one bot killed another bot.
150 	 * @return
151 	 */
152 	public void setTotalKills(Map<IToken, Integer> totalKills) {
153 		this.totalKills = totalKills;
154 	}
155 	
156 	/**
157 	 * How many times some bot was killed by ANOTHER bot (== without suicides).
158 	 * @return
159 	 */
160 	public Map<IToken, Integer> getWasKilled() {
161 		return wasKilled;
162 	}
163 
164 	/**
165 	 * How many times some bot was killed by ANOTHER bot (== without suicides).
166 	 * @return
167 	 */
168 	public void setWasKilled(Map<IToken, Integer> wasKilled) {
169 		this.wasKilled = wasKilled;
170 	}
171 
172 	/**
173 	 * How many times the bot (key == botId) has commit suicide.
174 	 * @return
175 	 */
176 	public Map<IToken, Integer> getSuicides() {
177 		return suicides;
178 	}
179 
180 	/**
181 	 * How many times the bot (key == botId) has commit suicide.
182 	 * @param suicides
183 	 */
184 	public void setSuicides(Map<IToken, Integer> suicides) {
185 		this.suicides = suicides;
186 	}
187 
188 	/**
189 	 * Map with observers (custom bots only!) containing detailed statistics about respective bots.
190 	 * @return
191 	 */
192 	public Map<IToken, UT2004AnalyzerObsStats> getBotObservers() {
193 		return botObservers;
194 	}
195 
196 	/**
197 	 * Map with observers (custom bots only!) containing detailed statistics about respective bots.
198 	 * @param botObservers
199 	 */
200 	public void setBotObservers(Map<IToken, UT2004AnalyzerObsStats> botObservers) {
201 		this.botObservers = botObservers;
202 	}
203 	
204 }