View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.tournament.capturetheflag;
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.communication.messages.gbinfomessages.TeamScore;
11  import cz.cuni.amis.pogamut.ut2004.tournament.match.result.UT2004TeamMatchResult;
12  import cz.cuni.amis.utils.maps.HashMapMap;
13  import cz.cuni.amis.utils.token.IToken;
14  
15  public class UT2004CaptureTheFlagResult extends UT2004TeamMatchResult {
16  	
17  	private List<IToken> bots = new ArrayList<IToken>();
18  	
19  	private List<IToken> nativeBots = new ArrayList<IToken>();
20  	
21  	private List<IToken> humans = new ArrayList<IToken>();
22  	
23  	private Map<IToken, String> names = new HashMap<IToken, String>();
24  	
25  	private Map<IToken, PlayerScore> finalScores = new HashMap<IToken, PlayerScore>();
26  	
27  	private Map<IToken, Integer> totalKills = new HashMap<IToken, Integer>();
28  	
29  	private Map<IToken, Integer> wasKilled = new HashMap<IToken, Integer>();
30  	
31  	private HashMapMap<IToken, IToken, Integer> killCounts = new HashMapMap<IToken, IToken, Integer>(); 
32  	
33  	private Map<IToken, Integer> suicides = new HashMap<IToken, Integer>();
34  	
35  	private Map<IToken, UT2004AnalyzerObsStats> botObservers = new HashMap<IToken, UT2004AnalyzerObsStats>();
36  
37  	private Map<Integer, TeamScore> teamScores = new HashMap<Integer, TeamScore>();
38  	
39  	/**
40  	 * When the match has ended (in seconds);
41  	 */
42  	public double matchTimeEnd;
43  
44  	@Override
45  	public String toString() {
46  		return "UT2004CaptureTheFlagResult[" + (isDraw() ? "DRAW" : ("winnerTeam=" + getWinnerTeam()) ) + "]";
47  	}
48  	
49  	public UT2004CaptureTheFlagResult() {
50  		super();
51  	}
52  	
53  	public UT2004CaptureTheFlagResult(int winnerTeam) {
54  		super(winnerTeam);
55  	}
56  
57  	/**
58  	 * Returns list with custom bots (run by Pogamut platform).
59  	 * @return
60  	 */
61  	public List<IToken> getBots() {
62  		return bots;
63  	}
64  
65  	/**
66  	 * List with custom bots (run by Pogamut platform).
67  	 * @param bots
68  	 */
69  	public void setBots(List<IToken> bots) {
70  		this.bots = bots;
71  	}
72  
73  	/**
74  	 * Returns list with native bots (bots from UT2004 itself).
75  	 * @return
76  	 */
77  	public List<IToken> getNativeBots() {
78  		return nativeBots;
79  	}
80  
81  	/**
82  	 * List with native bots (bots from UT2004 itself).
83  	 * @param nativeBots
84  	 */
85  	public void setNativeBots(List<IToken> nativeBots) {
86  		this.nativeBots = nativeBots;
87  	}
88  	
89  	/**
90  	 * Returns list with humans.
91  	 * @return
92  	 */
93  	public List<IToken> getHumans() {
94  		return humans;
95  	}
96  
97  	/**
98  	 * List with humans.
99  	 * @param HumanBots
100 	 */
101 	public void setHumans(List<IToken> humans) {
102 		this.humans = humans;
103 	}
104 	
105 	/**
106 	 * Returns mapping ID to Name the bot/human had in the game.
107 	 * @return
108 	 */
109 	public Map<IToken, String> getNames() {
110 		return names;
111 	}
112 
113 	/**
114 	 * Sets mapping ID to Name the bot/human had in the game.
115 	 * @param names
116 	 */
117 	public void setNames(Map<IToken, String> names) {
118 		this.names = names;
119 	}
120 
121 	/**
122 	 * Returns list of all bot (custom + native) ids.
123 	 * @return
124 	 */
125 	public List<IToken> getAllBots() {
126 		List<IToken> all = new ArrayList<IToken>(this.bots);
127 		all.addAll(this.nativeBots);
128 		all.addAll(this.humans);
129 		return all;
130 	}
131 
132 	/**
133 	 * When the match has ended (in seconds). I.e., how long was the match.
134 	 */
135 	public double getMatchTimeEnd() {
136 		return matchTimeEnd;
137 	}
138 
139 	/**
140 	 * When the match has ended (in seconds). I.e., how long was the match.
141 	 */
142 	public void setMatchTimeEnd(double matchTimeEnd) {
143 		this.matchTimeEnd = matchTimeEnd;
144 	}
145 
146 	/**
147 	 * Final scores of bots.
148 	 * @return
149 	 */
150 	public Map<IToken, PlayerScore> getFinalScores() {
151 		return finalScores;
152 	}
153 
154 	/**
155 	 * Final scores of bots.
156 	 * @return
157 	 */
158 	public void setFinalScores(Map<IToken, PlayerScore> finalScores) {
159 		this.finalScores = finalScores;
160 	}
161 
162 	/**
163 	 * Who -&gt; killed Whom -&gt; How many times, i.e., map.get(killerId).get(victimId) == how many time killer killed the victim.
164 	 * @return
165 	 */
166 	public HashMapMap<IToken, IToken, Integer> getKillCounts() {
167 		return killCounts;
168 	}
169 
170 	/**
171 	 * Who -&gt; killed Whom -&gt; How many times, i.e., map.get(killerId).get(victimId) == how many time killer killed the victim.
172 	 * @return
173 	 */
174 	public void setKillCounts(HashMapMap<IToken, IToken, Integer> killCounts) {
175 		this.killCounts = killCounts;
176 	}
177 	
178 	
179 	/**
180 	 * How many times one bot killed another bot.
181 	 * @return
182 	 */
183 	public Map<IToken, Integer> getTotalKills() {
184 		return totalKills;
185 	}
186 
187 	/**
188 	 * How many times one bot killed another bot.
189 	 * @return
190 	 */
191 	public void setTotalKills(Map<IToken, Integer> totalKills) {
192 		this.totalKills = totalKills;
193 	}
194 	
195 	/**
196 	 * How many times some bot was killed by ANOTHER bot (== without suicides).
197 	 * @return
198 	 */
199 	public Map<IToken, Integer> getWasKilled() {
200 		return wasKilled;
201 	}
202 
203 	/**
204 	 * How many times some bot was killed by ANOTHER bot (== without suicides).
205 	 * @return
206 	 */
207 	public void setWasKilled(Map<IToken, Integer> wasKilled) {
208 		this.wasKilled = wasKilled;
209 	}
210 
211 	/**
212 	 * How many times the bot (key == botId) has commit suicide.
213 	 * @return
214 	 */
215 	public Map<IToken, Integer> getSuicides() {
216 		return suicides;
217 	}
218 
219 	/**
220 	 * How many times the bot (key == botId) has commit suicide.
221 	 * @param suicides
222 	 */
223 	public void setSuicides(Map<IToken, Integer> suicides) {
224 		this.suicides = suicides;
225 	}
226 
227 	/**
228 	 * Map with observers (custom bots only!) containing detailed statistics about respective bots.
229 	 * @return
230 	 */
231 	public Map<IToken, UT2004AnalyzerObsStats> getBotObservers() {
232 		return botObservers;
233 	}
234 
235 	/**
236 	 * Map with observers (custom bots only!) containing detailed statistics about respective bots.
237 	 * @param botObservers
238 	 */
239 	public void setBotObservers(Map<IToken, UT2004AnalyzerObsStats> botObservers) {
240 		this.botObservers = botObservers;
241 	}
242 
243 	/**
244 	 * Returns scores of respective teams that were in the game.
245 	 * @return
246 	 */
247 	public Map<Integer, TeamScore> getTeamScores() {
248 		return teamScores;
249 	}
250 
251 	/**
252 	 * Sets team scores.
253 	 * @param teamScores
254 	 */
255 	public void setTeamScores(Map<Integer, TeamScore> teamScores) {
256 		this.teamScores = teamScores;
257 	}
258 
259 }