View Javadoc

1   
2   	 	/**
3            IMPORTANT !!!
4   
5            DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbcommands BY
6            THE JavaClassesGenerator.xslt. MODIFY THAT FILE INSTEAD OF THIS ONE.
7            
8            Use Ant task process-gb-messages after that to generate .java files again.
9            
10           IMPORTANT END !!!
11          */
12   	package cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands;import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;
13   		/**
14   		 * Representation of the GameBots2004 command ADDBOT.
15   		 *
16   		 * 
17  		Will add original epic bot to a game. May have issues with team
18  		balancing.
19  	
20           */
21   	public class AddBot 
22  		extends CommandMessage
23  	        {
24  	        	
25  		        
26      	/** Example how the message looks like - used during parser tests. */
27      	public static final String PROTOTYPE =
28      		" {Name text}  {StartLocation 0,0,0}  {StartRotation 0,0,0}  {Skill 0}  {Team 0}  {Type text} ";
29      
30  		/**
31  		 * Creates new instance of command AddBot.
32  		 * 
33  		Will add original epic bot to a game. May have issues with team
34  		balancing.
35  	
36  		 * Corresponding GameBots message for this command is
37  		 * ADDBOT.
38  		 *
39  		 * 
40  		 *    @param Name Optional name of the bot.
41  		 *    @param StartLocation 
42  			Optional start location of the bot.
43  		
44  		 *    @param StartRotation 
45  			Optional start rotation of the bot.
46  		
47  		 *    @param Skill 
48  			Skill of the bot - from 1 to 7 (best).
49  		
50  		 *    @param Team 
51  	Desired team of the of the bot (0 red, 1 blue).
52        
53  		 *    @param Type 
54  			The class of the added bot - optional.
55  		
56  		 */
57  		public AddBot(
58  			String Name,  Location StartLocation,  Rotation StartRotation,  Integer Skill,  Integer Team,  String Type
59  		) {
60  			
61  				this.Name = Name;
62              
63  				this.StartLocation = StartLocation;
64              
65  				this.StartRotation = StartRotation;
66              
67  				this.Skill = Skill;
68              
69  				this.Team = Team;
70              
71  				this.Type = Type;
72              
73  		}
74  
75  		
76  			/**
77  			 * Creates new instance of command AddBot.
78  			 * 
79  		Will add original epic bot to a game. May have issues with team
80  		balancing.
81  	
82  			 * Corresponding GameBots message for this command is
83  			 * ADDBOT.
84  			 * <p></p>
85  			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
86  		     */
87  		    public AddBot() {
88  		    }
89  			
90  		
91  		/**
92  		 * Cloning constructor.
93  		 *
94  		 * @param original
95  		 */
96  		public AddBot(AddBot original) {
97  		   
98  		        this.Name = original.Name;
99  		   
100 		        this.StartLocation = original.StartLocation;
101 		   
102 		        this.StartRotation = original.StartRotation;
103 		   
104 		        this.Skill = original.Skill;
105 		   
106 		        this.Team = original.Team;
107 		   
108 		        this.Type = original.Type;
109 		   
110 		}
111     
112 	        /**
113 	        Optional name of the bot. 
114 	        */
115 	        protected
116 	         String Name =
117 	       	
118 	        		null
119 	        	;
120 	
121 	        
122 	        
123  		/**
124          * Optional name of the bot. 
125          */
126         public String getName()
127  	
128 	        {
129 	            return
130 	        	 Name;
131 	        }
132 	        
133 	        
134 	        
135  		
136  		/**
137          * Optional name of the bot. 
138          */
139         public AddBot 
140         setName(String Name)
141  	
142 			{
143 				this.Name = Name;
144 				return this;
145 			}
146 		
147 	        /**
148 	        
149 			Optional start location of the bot.
150 		 
151 	        */
152 	        protected
153 	         Location StartLocation =
154 	       	
155 	        		null
156 	        	;
157 	
158 	        
159 	        
160  		/**
161          * 
162 			Optional start location of the bot.
163 		 
164          */
165         public Location getStartLocation()
166  	
167 	        {
168 	            return
169 	        	 StartLocation;
170 	        }
171 	        
172 	        
173 	        
174  		
175  		/**
176          * 
177 			Optional start location of the bot.
178 		 
179          */
180         public AddBot 
181         setStartLocation(Location StartLocation)
182  	
183 			{
184 				this.StartLocation = StartLocation;
185 				return this;
186 			}
187 		
188 	        /**
189 	        
190 			Optional start rotation of the bot.
191 		 
192 	        */
193 	        protected
194 	         Rotation StartRotation =
195 	       	
196 	        		null
197 	        	;
198 	
199 	        
200 	        
201  		/**
202          * 
203 			Optional start rotation of the bot.
204 		 
205          */
206         public Rotation getStartRotation()
207  	
208 	        {
209 	            return
210 	        	 StartRotation;
211 	        }
212 	        
213 	        
214 	        
215  		
216  		/**
217          * 
218 			Optional start rotation of the bot.
219 		 
220          */
221         public AddBot 
222         setStartRotation(Rotation StartRotation)
223  	
224 			{
225 				this.StartRotation = StartRotation;
226 				return this;
227 			}
228 		
229 	        /**
230 	        
231 			Skill of the bot - from 1 to 7 (best).
232 		 
233 	        */
234 	        protected
235 	         Integer Skill =
236 	       	3;
237 	
238 	        
239 	        
240  		/**
241          * 
242 			Skill of the bot - from 1 to 7 (best).
243 		 
244          */
245         public Integer getSkill()
246  	
247 	        {
248 	            return
249 	        	 Skill;
250 	        }
251 	        
252 	        
253 	        
254  		
255  		/**
256          * 
257 			Skill of the bot - from 1 to 7 (best).
258 		 
259          */
260         public AddBot 
261         setSkill(Integer Skill)
262  	
263 			{
264 				this.Skill = Skill;
265 				return this;
266 			}
267 		
268 	        /**
269 	        
270 	Desired team of the of the bot (0 red, 1 blue).
271        
272 	        */
273 	        protected
274 	         Integer Team =
275 	       	
276 	        		null
277 	        	;
278 	
279 	        
280 	        
281  		/**
282          * 
283 	Desired team of the of the bot (0 red, 1 blue).
284        
285          */
286         public Integer getTeam()
287  	
288 	        {
289 	            return
290 	        	 Team;
291 	        }
292 	        
293 	        
294 	        
295  		
296  		/**
297          * 
298 	Desired team of the of the bot (0 red, 1 blue).
299        
300          */
301         public AddBot 
302         setTeam(Integer Team)
303  	
304 			{
305 				this.Team = Team;
306 				return this;
307 			}
308 		
309 	        /**
310 	        
311 			The class of the added bot - optional.
312 		 
313 	        */
314 	        protected
315 	         String Type =
316 	       	
317 	        		null
318 	        	;
319 	
320 	        
321 	        
322  		/**
323          * 
324 			The class of the added bot - optional.
325 		 
326          */
327         public String getType()
328  	
329 	        {
330 	            return
331 	        	 Type;
332 	        }
333 	        
334 	        
335 	        
336  		
337  		/**
338          * 
339 			The class of the added bot - optional.
340 		 
341          */
342         public AddBot 
343         setType(String Type)
344  	
345 			{
346 				this.Type = Type;
347 				return this;
348 			}
349 		
350  	    public String toString() {
351             return toMessage();
352         }
353  	
354  		public String toHtmlString() {
355 			return super.toString() + "[<br/>" +
356             	
357             	"<b>Name</b> = " +
358             	String.valueOf(getName()
359  	) +
360             	" <br/> " +
361             	
362             	"<b>StartLocation</b> = " +
363             	String.valueOf(getStartLocation()
364  	) +
365             	" <br/> " +
366             	
367             	"<b>StartRotation</b> = " +
368             	String.valueOf(getStartRotation()
369  	) +
370             	" <br/> " +
371             	
372             	"<b>Skill</b> = " +
373             	String.valueOf(getSkill()
374  	) +
375             	" <br/> " +
376             	
377             	"<b>Team</b> = " +
378             	String.valueOf(getTeam()
379  	) +
380             	" <br/> " +
381             	
382             	"<b>Type</b> = " +
383             	String.valueOf(getType()
384  	) +
385             	" <br/> " +
386             	 
387             	"<br/>]"
388             ;
389 		}
390  	
391 		public String toMessage() {
392      		StringBuffer buf = new StringBuffer();
393      		buf.append("ADDBOT");
394      		
395 						if (Name != null) {
396 							buf.append(" {Name " + Name + "}");
397 						}
398 					
399 					    if (StartLocation != null) {
400 					        buf.append(" {StartLocation " +
401 					            StartLocation.getX() + "," +
402 					            StartLocation.getY() + "," +
403 					            StartLocation.getZ() + "}");
404 					    }
405 					
406 					    if (StartRotation != null) {
407 					        buf.append(" {StartRotation " +
408 					            StartRotation.getPitch() + "," +
409 					            StartRotation.getYaw() + "," +
410 					            StartRotation.getRoll() + "}");
411 					    }
412 					
413 						if (Skill != null) {
414 							buf.append(" {Skill " + Skill + "}");
415 						}
416 					
417 						if (Team != null) {
418 							buf.append(" {Team " + Team + "}");
419 						}
420 					
421 						if (Type != null) {
422 							buf.append(" {Type " + Type + "}");
423 						}
424 					
425    			return buf.toString();
426    		}
427  	
428  		// --- Extra Java from XML BEGIN (extra/code/java)
429         	
430 		// --- Extra Java from XML END (extra/code/java)
431  	
432 	        }
433