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 RESPAWN.
15   		 *
16   		 * 
17  		Use this to kill bot and force him to respawn, you can specify
18  		start location and rotation. Work also for human players and
19  		spectators in the game. This command can be issued also by bot
20  		on the bot itself (in this case Id attribute is not parsed).
21  	
22           */
23   	public class Respawn 
24  		extends CommandMessage
25  	        {
26  	        	
27  		        
28      	/** Example how the message looks like - used during parser tests. */
29      	public static final String PROTOTYPE =
30      		" {Id unreal_id}  {StartLocation 0,0,0}  {StartRotation 0,0,0} ";
31      
32  		/**
33  		 * Creates new instance of command Respawn.
34  		 * 
35  		Use this to kill bot and force him to respawn, you can specify
36  		start location and rotation. Work also for human players and
37  		spectators in the game. This command can be issued also by bot
38  		on the bot itself (in this case Id attribute is not parsed).
39  	
40  		 * Corresponding GameBots message for this command is
41  		 * RESPAWN.
42  		 *
43  		 * 
44  		 *    @param Id 
45  			Id of the bot to be respawned (not used if command sent to
46  			bot).
47  		
48  		 *    @param StartLocation 
49  			Where bot respawns. If you want to respawn bot at random,
50  			don't specify StartLocation.
51  		
52  		 *    @param StartRotation Initial rotation of the bot.
53  		 */
54  		public Respawn(
55  			UnrealId Id,  Location StartLocation,  Rotation StartRotation
56  		) {
57  			
58  				this.Id = Id;
59              
60  				this.StartLocation = StartLocation;
61              
62  				this.StartRotation = StartRotation;
63              
64  		}
65  
66  		
67  			/**
68  			 * Creates new instance of command Respawn.
69  			 * 
70  		Use this to kill bot and force him to respawn, you can specify
71  		start location and rotation. Work also for human players and
72  		spectators in the game. This command can be issued also by bot
73  		on the bot itself (in this case Id attribute is not parsed).
74  	
75  			 * Corresponding GameBots message for this command is
76  			 * RESPAWN.
77  			 * <p></p>
78  			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
79  		     */
80  		    public Respawn() {
81  		    }
82  			
83  		
84  		/**
85  		 * Cloning constructor.
86  		 *
87  		 * @param original
88  		 */
89  		public Respawn(Respawn original) {
90  		   
91  		        this.Id = original.Id;
92  		   
93  		        this.StartLocation = original.StartLocation;
94  		   
95  		        this.StartRotation = original.StartRotation;
96  		   
97  		}
98      
99  	        /**
100 	        
101 			Id of the bot to be respawned (not used if command sent to
102 			bot).
103 		 
104 	        */
105 	        protected
106 	         UnrealId Id =
107 	       	
108 	        		null
109 	        	;
110 	
111 	        
112 	        
113  		/**
114          * 
115 			Id of the bot to be respawned (not used if command sent to
116 			bot).
117 		 
118          */
119         public UnrealId getId()
120  	
121 	        {
122 	            return
123 	        	 Id;
124 	        }
125 	        
126 	        
127 	        
128  		
129  		/**
130          * 
131 			Id of the bot to be respawned (not used if command sent to
132 			bot).
133 		 
134          */
135         public Respawn 
136         setId(UnrealId Id)
137  	
138 			{
139 				this.Id = Id;
140 				return this;
141 			}
142 		
143 	        /**
144 	        
145 			Where bot respawns. If you want to respawn bot at random,
146 			don't specify StartLocation.
147 		 
148 	        */
149 	        protected
150 	         Location StartLocation =
151 	       	
152 	        		null
153 	        	;
154 	
155 	        
156 	        
157  		/**
158          * 
159 			Where bot respawns. If you want to respawn bot at random,
160 			don't specify StartLocation.
161 		 
162          */
163         public Location getStartLocation()
164  	
165 	        {
166 	            return
167 	        	 StartLocation;
168 	        }
169 	        
170 	        
171 	        
172  		
173  		/**
174          * 
175 			Where bot respawns. If you want to respawn bot at random,
176 			don't specify StartLocation.
177 		 
178          */
179         public Respawn 
180         setStartLocation(Location StartLocation)
181  	
182 			{
183 				this.StartLocation = StartLocation;
184 				return this;
185 			}
186 		
187 	        /**
188 	        Initial rotation of the bot. 
189 	        */
190 	        protected
191 	         Rotation StartRotation =
192 	       	
193 	        		null
194 	        	;
195 	
196 	        
197 	        
198  		/**
199          * Initial rotation of the bot. 
200          */
201         public Rotation getStartRotation()
202  	
203 	        {
204 	            return
205 	        	 StartRotation;
206 	        }
207 	        
208 	        
209 	        
210  		
211  		/**
212          * Initial rotation of the bot. 
213          */
214         public Respawn 
215         setStartRotation(Rotation StartRotation)
216  	
217 			{
218 				this.StartRotation = StartRotation;
219 				return this;
220 			}
221 		
222  	    public String toString() {
223             return toMessage();
224         }
225  	
226  		public String toHtmlString() {
227 			return super.toString() + "[<br/>" +
228             	
229             	"<b>Id</b> = " +
230             	String.valueOf(getId()
231  	) +
232             	" <br/> " +
233             	
234             	"<b>StartLocation</b> = " +
235             	String.valueOf(getStartLocation()
236  	) +
237             	" <br/> " +
238             	
239             	"<b>StartRotation</b> = " +
240             	String.valueOf(getStartRotation()
241  	) +
242             	" <br/> " +
243             	 
244             	"<br/>]"
245             ;
246 		}
247  	
248 		public String toMessage() {
249      		StringBuffer buf = new StringBuffer();
250      		buf.append("RESPAWN");
251      		
252 						if (Id != null) {
253 							buf.append(" {Id " + Id.getStringId() + "}");
254 						}
255 					
256 					    if (StartLocation != null) {
257 					        buf.append(" {StartLocation " +
258 					            StartLocation.getX() + "," +
259 					            StartLocation.getY() + "," +
260 					            StartLocation.getZ() + "}");
261 					    }
262 					
263 					    if (StartRotation != null) {
264 					        buf.append(" {StartRotation " +
265 					            StartRotation.getPitch() + "," +
266 					            StartRotation.getYaw() + "," +
267 					            StartRotation.getRoll() + "}");
268 					    }
269 					
270    			return buf.toString();
271    		}
272  	
273  		// --- Extra Java from XML BEGIN (extra/code/java)
274         	
275 		// --- Extra Java from XML END (extra/code/java)
276  	
277 	        }
278