View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2    		
3    		// --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
4   			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.*;
5   		// --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6   		
7   		
8   		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9   				
10  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11  		
12  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15      
16   		/**
17           *  
18           			Definition of the event SEL.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Player selected an object in the environment in PlayerMousing state (by pressing ALT + SHIFT to switch to this state).
25  	
26           */
27   	public class ObjectSelected 
28    				extends InfoMessage
29      			implements IWorldEvent, IWorldChangeEvent
30      			
31  	    {
32   	
33      	/** Example how the message looks like - used during parser tests. */
34      	public static final String PROTOTYPE =
35      		"SEL {PlayerId unreal_id}  {PlayerName text}  {ObjectId unreal_id}  {ObjectLocation 0,0,0}  {ObjectHitLocation 0,0,0} ";
36      
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public ObjectSelected()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message ObjectSelected.
51  		 * 
52  		Asynchronous message. Player selected an object in the environment in PlayerMousing state (by pressing ALT + SHIFT to switch to this state).
53  	
54  		 * Corresponding GameBots message
55  		 *   
56  		 *   is
57  		 *   SEL.
58  		 * 
59   	  	 * 
60  		 *   
61  		 *     @param PlayerId 
62  			Unique Id of the player that this event is for.
63  		
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param PlayerName 
68  			Name of the player that this event is for.
69  		
70  		 *   
71  		 * 
72  		 *   
73  		 *     @param ObjectId 
74  			Id of the actor the player selected (actors include
75  			other players or bots and other physical objects that can
76  			block your path and even level geometry actors). Will be "None" if nothing was selected (or actor was deselected).
77  		
78  		 *   
79  		 * 
80  		 *   
81  		 *     @param ObjectLocation 
82  			Location of the actor the player selected. Sent only if some object selected.
83  		
84  		 *   
85  		 * 
86  		 *   
87  		 *     @param ObjectHitLocation 
88  			Location of the hit point that we have selected this actor through. Sent only if some object selected.
89  		
90  		 *   
91  		 * 
92  		 */
93  		public ObjectSelected(
94  			UnrealId PlayerId,  String PlayerName,  UnrealId ObjectId,  Location ObjectLocation,  Location ObjectHitLocation
95  		) {
96  			
97  					this.PlayerId = PlayerId;
98  				
99  					this.PlayerName = PlayerName;
100 				
101 					this.ObjectId = ObjectId;
102 				
103 					this.ObjectLocation = ObjectLocation;
104 				
105 					this.ObjectHitLocation = ObjectHitLocation;
106 				
107 		}
108     
109     	/**
110 		 * Cloning constructor from the full message.
111 		 *
112 		 * @param original
113 		 */
114 		public ObjectSelected(ObjectSelected original) {		
115 			
116 					this.PlayerId = original.getPlayerId()
117  	;
118 				
119 					this.PlayerName = original.getPlayerName()
120  	;
121 				
122 					this.ObjectId = original.getObjectId()
123  	;
124 				
125 					this.ObjectLocation = original.getObjectLocation()
126  	;
127 				
128 					this.ObjectHitLocation = original.getObjectHitLocation()
129  	;
130 				
131 			this.SimTime = original.getSimTime();			
132 		}
133 		
134 	   		
135 			protected long SimTime;
136 				
137 			/**
138 			 * Simulation time in MILLI SECONDS !!!
139 			 */	
140 			@Override
141 			public long getSimTime() {
142 				return SimTime;
143 			}
144 						
145 			/**
146 			 * Used by Yylex to slip correct time of the object or programmatically.
147 			 */
148 			protected void setSimTime(long SimTime) {
149 				this.SimTime = SimTime;
150 			}
151 	   	
152     	
153 	    /**
154          * 
155 			Unique Id of the player that this event is for.
156 		 
157          */
158         protected
159          UnrealId PlayerId =
160        	null;
161 	
162  		/**
163          * 
164 			Unique Id of the player that this event is for.
165 		 
166          */
167         public  UnrealId getPlayerId()
168  	 {
169     					return PlayerId;
170     				}
171     			
172     	
173 	    /**
174          * 
175 			Name of the player that this event is for.
176 		 
177          */
178         protected
179          String PlayerName =
180        	null;
181 	
182  		/**
183          * 
184 			Name of the player that this event is for.
185 		 
186          */
187         public  String getPlayerName()
188  	 {
189     					return PlayerName;
190     				}
191     			
192     	
193 	    /**
194          * 
195 			Id of the actor the player selected (actors include
196 			other players or bots and other physical objects that can
197 			block your path and even level geometry actors). Will be "None" if nothing was selected (or actor was deselected).
198 		 
199          */
200         protected
201          UnrealId ObjectId =
202        	null;
203 	
204  		/**
205          * 
206 			Id of the actor the player selected (actors include
207 			other players or bots and other physical objects that can
208 			block your path and even level geometry actors). Will be "None" if nothing was selected (or actor was deselected).
209 		 
210          */
211         public  UnrealId getObjectId()
212  	 {
213     					return ObjectId;
214     				}
215     			
216     	
217 	    /**
218          * 
219 			Location of the actor the player selected. Sent only if some object selected.
220 		 
221          */
222         protected
223          Location ObjectLocation =
224        	null;
225 	
226  		/**
227          * 
228 			Location of the actor the player selected. Sent only if some object selected.
229 		 
230          */
231         public  Location getObjectLocation()
232  	 {
233     					return ObjectLocation;
234     				}
235     			
236     	
237 	    /**
238          * 
239 			Location of the hit point that we have selected this actor through. Sent only if some object selected.
240 		 
241          */
242         protected
243          Location ObjectHitLocation =
244        	null;
245 	
246  		/**
247          * 
248 			Location of the hit point that we have selected this actor through. Sent only if some object selected.
249 		 
250          */
251         public  Location getObjectHitLocation()
252  	 {
253     					return ObjectHitLocation;
254     				}
255     			
256  		
257  	    public String toString() {
258             return
259             	super.toString() + "[" +
260             	
261 		              			"PlayerId = " + String.valueOf(getPlayerId()
262  	) + " | " + 
263 		              		
264 		              			"PlayerName = " + String.valueOf(getPlayerName()
265  	) + " | " + 
266 		              		
267 		              			"ObjectId = " + String.valueOf(getObjectId()
268  	) + " | " + 
269 		              		
270 		              			"ObjectLocation = " + String.valueOf(getObjectLocation()
271  	) + " | " + 
272 		              		
273 		              			"ObjectHitLocation = " + String.valueOf(getObjectHitLocation()
274  	) + " | " + 
275 		              		
276 				"]";           		
277         }
278  	
279  		
280  		public String toHtmlString() {
281  			return super.toString() + "[<br/>" +
282             	
283 		              			"<b>PlayerId</b> = " + String.valueOf(getPlayerId()
284  	) + " <br/> " + 
285 		              		
286 		              			"<b>PlayerName</b> = " + String.valueOf(getPlayerName()
287  	) + " <br/> " + 
288 		              		
289 		              			"<b>ObjectId</b> = " + String.valueOf(getObjectId()
290  	) + " <br/> " + 
291 		              		
292 		              			"<b>ObjectLocation</b> = " + String.valueOf(getObjectLocation()
293  	) + " <br/> " + 
294 		              		
295 		              			"<b>ObjectHitLocation</b> = " + String.valueOf(getObjectHitLocation()
296  	) + " <br/> " + 
297 		              		
298 				"<br/>]";     
299 		}
300  	 
301  	    public String toJsonLiteral() {
302             return "ObjectSelected(null, "
303             		
304                    + ")";
305         }
306  	
307  		
308  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
309         	
310 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
311 		
312 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
313 	        
314 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
315  	
316 		}
317