View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.tag.tournament;
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.unreal.communication.messages.UnrealId;
9   import cz.cuni.amis.pogamut.ut2004.analyzer.stats.UT2004AnalyzerObsStats;
10  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerMessage;
11  import cz.cuni.amis.pogamut.ut2004.tag.server.BotTagRecord;
12  import cz.cuni.amis.pogamut.ut2004.tournament.match.UT2004MatchResult;
13  import cz.cuni.amis.utils.maps.HashMapMap;
14  import cz.cuni.amis.utils.token.IToken;
15  
16  public class UT2004TagResult extends UT2004MatchResult {
17  	private List<IToken> bots = new ArrayList<IToken>();
18  	
19  	private List<IToken> nativeBots = new ArrayList<IToken>();
20  	
21  	private Map<IToken, BotTagRecord<PlayerMessage>> playerScores = new HashMap<IToken, BotTagRecord<PlayerMessage>>();
22  	
23  	private Map<UnrealId, Integer> tagsPassed = new HashMap<UnrealId, Integer>();
24  	
25  	private Map<IToken, Integer> tagsReceived = new HashMap<IToken, Integer>();
26  	
27  	private HashMapMap<IToken, IToken, Integer> tagCounts = new HashMapMap<IToken, IToken, Integer>(); 
28  	
29  	private Map<IToken, UT2004AnalyzerObsStats> botObservers = new HashMap<IToken, UT2004AnalyzerObsStats>();
30  
31  	/**
32  	 * When the match has ended (in seconds);
33  	 */
34  	public double matchTimeEnd;
35  
36  	/**
37  	 * No side has won.
38  	 */
39  	private boolean draw = false;
40  	
41  	@Override
42  	public String toString() {
43  		return "UT2004TagGameResult[" + (isDraw() ? "DRAW" : (isIndividual() ? "winnerBot=" + getWinnerBot() : "winnerTeam=" + getWinnerTeam()) ) + "]";
44  	}
45  	
46  	public UT2004TagResult() {
47  		super();
48  	}
49  	
50  	public UT2004TagResult(IToken winnerBot) {
51  		super(winnerBot);
52  	}
53  
54  	
55  	/**
56  	 * Get all players tag scores.
57  	 * @return
58  	 */
59  	public Map<IToken, BotTagRecord<PlayerMessage>> getPlayerScores() {
60  		return playerScores;
61  	}
62  
63  	/**
64  	 * Set all players tag scores.
65  	 * @param playerScores
66  	 */
67  	public void setPlayerScores(Map<IToken, BotTagRecord<PlayerMessage>> playerScores) {
68  		this.playerScores = playerScores;
69  	}
70  
71  	/**
72  	 * Returns list with custom bots (run by Pogamut platform).
73  	 * @return
74  	 */
75  	public List<IToken> getBots() {
76  		return bots;
77  	}
78  
79  	/**
80  	 * List with custom bots (run by Pogamut platform).
81  	 * @param bots
82  	 */
83  	public void setBots(List<IToken> bots) {
84  		this.bots = bots;
85  	}
86  
87  	/**
88  	 * Returns list with native bots (bots from UT2004 itself).
89  	 * @return
90  	 */
91  	public List<IToken> getNativeBots() {
92  		return nativeBots;
93  	}
94  
95  	/**
96  	 * List with native bots (bots from UT2004 itself).
97  	 * @param nativeBots
98  	 */
99  	public void setNativeBots(List<IToken> nativeBots) {
100 		this.nativeBots = nativeBots;
101 	}
102 	
103 	/**
104 	 * Returns list of all bot (custom + native) ids.
105 	 * @return
106 	 */
107 	public List<IToken> getAllBots() {
108 		List<IToken> all = new ArrayList<IToken>(this.bots);
109 		all.addAll(this.nativeBots);
110 		return all;
111 	}
112 
113 	/**
114 	 * When the match has ended (in seconds). I.e., how long was the match.
115 	 */
116 	public double getMatchTimeEnd() {
117 		return matchTimeEnd;
118 	}
119 
120 	/**
121 	 * When the match has ended (in seconds). I.e., how long was the match.
122 	 */
123 	public void setMatchTimeEnd(double matchTimeEnd) {
124 		this.matchTimeEnd = matchTimeEnd;
125 	}
126 
127 	/**
128 	 * Who -&gt; tagged Whom -&gt; How many times, i.e., map.get(taggerId).get(victimId) == how many time tagger tagged the victim.
129 	 * @return
130 	 */
131 	public HashMapMap<IToken, IToken, Integer> getTagCounts() {
132 		return tagCounts;
133 	}
134 
135 	/**
136 	 * Who -&gt; tagged Whom -&gt; How many times, i.e., map.get(taggerId).get(victimId) == how many time tagger tagged the victim.
137 	 * @return
138 	 */
139 	public void setTagCounts(HashMapMap<IToken, IToken, Integer> tagCounts) {
140 		this.tagCounts = tagCounts;
141 	}
142 	
143 	
144 	/**
145 	 * How many times one bot tagged another bot.
146 	 * @return
147 	 */
148 	public Map<UnrealId, Integer> getTotalTags() {
149 		return tagsPassed;
150 	}
151 
152 	/**
153 	 * How many times one bot tagged another bot.
154 	 * @return
155 	 */
156 	public void setTotalTags(Map<UnrealId, Integer> totalTags) {
157 		this.tagsPassed = totalTags;
158 	}
159 	
160 	/**
161 	 * How many times some bot was tagged by ANOTHER bot.
162 	 * @return
163 	 */
164 	public Map<IToken, Integer> getWasTagged() {
165 		return tagsReceived;
166 	}
167 
168 	/**
169 	 * How many times some bot was tagged by ANOTHER bot.
170 	 * @return
171 	 */
172 	public void setWasTagged(Map<IToken, Integer> tagsReceived) {
173 		this.tagsReceived = tagsReceived;
174 	}
175 
176 
177 	/**
178 	 * Map with observers (custom bots only!) containing detailed statistics about respective bots.
179 	 * @return
180 	 */
181 	public Map<IToken, UT2004AnalyzerObsStats> getBotObservers() {
182 		return botObservers;
183 	}
184 
185 	/**
186 	 * Map with observers (custom bots only!) containing detailed statistics about respective bots.
187 	 * @param botObservers
188 	 */
189 	public void setBotObservers(Map<IToken, UT2004AnalyzerObsStats> botObservers) {
190 		this.botObservers = botObservers;
191 	}
192 }