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