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