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 DODGE.
15   		 *
16   		 * 
17  		Causes the bot to dodge to supported direction. Only one (successful) dodge per second allowed.
18  	
19           */
20   	public class Dodge 
21  		extends CommandMessage
22  	        {
23  	        	
24  		        
25      	/** Example how the message looks like - used during parser tests. */
26      	public static final String PROTOTYPE =
27      		" {Direction 0,0,0}  {FocusPoint 0,0,0}  {Wall False}  {Double False} ";
28      
29  		/**
30  		 * Creates new instance of command Dodge.
31  		 * 
32  		Causes the bot to dodge to supported direction. Only one (successful) dodge per second allowed.
33  	
34  		 * Corresponding GameBots message for this command is
35  		 * DODGE.
36  		 *
37  		 * 
38  		 *    @param Direction 
39  			Relative vector, will be normalized. The direction of the
40  			dodge will be added to current bot rotation.
41  		
42  		 *    @param FocusPoint 
43  			Point the bot should focus after dodge command. Note that if not specified, this will be set automatically by dodge command to 1200 ut units in front of the bot at the time when the dodge command is issued.
44  		
45  		 *    @param Wall 
46  			Attemtps to do a wall dodge. There has to be a wall in the opposite direction of the dodge. If there isn't, nothing will happen! This switch overrides "Double" dodge switch.
47  		
48  		 *    @param Double 
49  			If true performs a double dodge in specified direction.
50  		
51  		 */
52  		public Dodge(
53  			Location Direction,  Location FocusPoint,  Boolean Wall,  Boolean Double
54  		) {
55  			
56  				this.Direction = Direction;
57              
58  				this.FocusPoint = FocusPoint;
59              
60  				this.Wall = Wall;
61              
62  				this.Double = Double;
63              
64  		}
65  
66  		
67  			/**
68  			 * Creates new instance of command Dodge.
69  			 * 
70  		Causes the bot to dodge to supported direction. Only one (successful) dodge per second allowed.
71  	
72  			 * Corresponding GameBots message for this command is
73  			 * DODGE.
74  			 * <p></p>
75  			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
76  		     */
77  		    public Dodge() {
78  		    }
79  			
80  		
81  		/**
82  		 * Cloning constructor.
83  		 *
84  		 * @param original
85  		 */
86  		public Dodge(Dodge original) {
87  		   
88  		        this.Direction = original.Direction;
89  		   
90  		        this.FocusPoint = original.FocusPoint;
91  		   
92  		        this.Wall = original.Wall;
93  		   
94  		        this.Double = original.Double;
95  		   
96  		}
97      
98  	        /**
99  	        
100 			Relative vector, will be normalized. The direction of the
101 			dodge will be added to current bot rotation.
102 		 
103 	        */
104 	        protected
105 	         Location Direction =
106 	       	
107 	        		null
108 	        	;
109 	
110 	        
111 	        
112  		/**
113          * 
114 			Relative vector, will be normalized. The direction of the
115 			dodge will be added to current bot rotation.
116 		 
117          */
118         public Location getDirection()
119  	
120 	        {
121 	            return
122 	        	 Direction;
123 	        }
124 	        
125 	        
126 	        
127  		
128  		/**
129          * 
130 			Relative vector, will be normalized. The direction of the
131 			dodge will be added to current bot rotation.
132 		 
133          */
134         public Dodge 
135         setDirection(Location Direction)
136  	
137 			{
138 				this.Direction = Direction;
139 				return this;
140 			}
141 		
142 	        /**
143 	        
144 			Point the bot should focus after dodge command. Note that if not specified, this will be set automatically by dodge command to 1200 ut units in front of the bot at the time when the dodge command is issued.
145 		 
146 	        */
147 	        protected
148 	         Location FocusPoint =
149 	       	
150 	        		null
151 	        	;
152 	
153 	        
154 	        
155  		/**
156          * 
157 			Point the bot should focus after dodge command. Note that if not specified, this will be set automatically by dodge command to 1200 ut units in front of the bot at the time when the dodge command is issued.
158 		 
159          */
160         public Location getFocusPoint()
161  	
162 	        {
163 	            return
164 	        	 FocusPoint;
165 	        }
166 	        
167 	        
168 	        
169  		
170  		/**
171          * 
172 			Point the bot should focus after dodge command. Note that if not specified, this will be set automatically by dodge command to 1200 ut units in front of the bot at the time when the dodge command is issued.
173 		 
174          */
175         public Dodge 
176         setFocusPoint(Location FocusPoint)
177  	
178 			{
179 				this.FocusPoint = FocusPoint;
180 				return this;
181 			}
182 		
183 	        /**
184 	        
185 			Attemtps to do a wall dodge. There has to be a wall in the opposite direction of the dodge. If there isn't, nothing will happen! This switch overrides "Double" dodge switch.
186 		 
187 	        */
188 	        protected
189 	         Boolean Wall =
190 	       	
191 	        		null
192 	        	;
193 	
194 	        
195 	        
196  		/**
197          * 
198 			Attemtps to do a wall dodge. There has to be a wall in the opposite direction of the dodge. If there isn't, nothing will happen! This switch overrides "Double" dodge switch.
199 		 
200          */
201         public Boolean isWall()
202  	
203 	        {
204 	            return
205 	        	 Wall;
206 	        }
207 	        
208 	        
209 	        
210  		
211  		/**
212          * 
213 			Attemtps to do a wall dodge. There has to be a wall in the opposite direction of the dodge. If there isn't, nothing will happen! This switch overrides "Double" dodge switch.
214 		 
215          */
216         public Dodge 
217         setWall(Boolean Wall)
218  	
219 			{
220 				this.Wall = Wall;
221 				return this;
222 			}
223 		
224 	        /**
225 	        
226 			If true performs a double dodge in specified direction.
227 		 
228 	        */
229 	        protected
230 	         Boolean Double =
231 	       	
232 	        		null
233 	        	;
234 	
235 	        
236 	        
237  		/**
238          * 
239 			If true performs a double dodge in specified direction.
240 		 
241          */
242         public Boolean isDouble()
243  	
244 	        {
245 	            return
246 	        	 Double;
247 	        }
248 	        
249 	        
250 	        
251  		
252  		/**
253          * 
254 			If true performs a double dodge in specified direction.
255 		 
256          */
257         public Dodge 
258         setDouble(Boolean Double)
259  	
260 			{
261 				this.Double = Double;
262 				return this;
263 			}
264 		
265  	    public String toString() {
266             return toMessage();
267         }
268  	
269  		public String toHtmlString() {
270 			return super.toString() + "[<br/>" +
271             	
272             	"<b>Direction</b> = " +
273             	String.valueOf(getDirection()
274  	) +
275             	" <br/> " +
276             	
277             	"<b>FocusPoint</b> = " +
278             	String.valueOf(getFocusPoint()
279  	) +
280             	" <br/> " +
281             	
282             	"<b>Wall</b> = " +
283             	String.valueOf(isWall()
284  	) +
285             	" <br/> " +
286             	
287             	"<b>Double</b> = " +
288             	String.valueOf(isDouble()
289  	) +
290             	" <br/> " +
291             	 
292             	"<br/>]"
293             ;
294 		}
295  	
296 		public String toMessage() {
297      		StringBuffer buf = new StringBuffer();
298      		buf.append("DODGE");
299      		
300 					    if (Direction != null) {
301 					        buf.append(" {Direction " +
302 					            Direction.getX() + "," +
303 					            Direction.getY() + "," +
304 					            Direction.getZ() + "}");
305 					    }
306 					
307 					    if (FocusPoint != null) {
308 					        buf.append(" {FocusPoint " +
309 					            FocusPoint.getX() + "," +
310 					            FocusPoint.getY() + "," +
311 					            FocusPoint.getZ() + "}");
312 					    }
313 					
314 						if (Wall != null) {
315 							buf.append(" {Wall " + Wall + "}");
316 						}
317 					
318 						if (Double != null) {
319 							buf.append(" {Double " + Double + "}");
320 						}
321 					
322    			return buf.toString();
323    		}
324  	
325  		// --- Extra Java from XML BEGIN (extra/code/java)
326         	
327 		// --- Extra Java from XML END (extra/code/java)
328  	
329 	        }
330