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