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=composite]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=composite]+classtype[@name=impl] END
15      
16   		/**
17           *  
18              		Composite implementation of the PLR abstract message. It wraps Local/Shared/Static parts in single object
19              		allowing to presenting a nice facade for users.
20              	
21           *
22           *  <p></p><p></p>
23           *  Complete message documentation:               
24           *  
25  		Synchronous message. Contains information about other players in
26  		the game, like their current velocity, position, weapon and
27  		reachability. Only reports those players that are visible.
28  		(within field of view and not occluded).
29  	
30           */
31   	public class PlayerCompositeImpl 
32    				extends Player
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public PlayerCompositeImpl()
41  		{
42  		}
43  	
44  		
45  		/**
46  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
47  		 *
48  		 * @param partLocal local-part of the message
49  		 * @param partShared shared-part of the message
50  		 * @param partStatic static-part of the message
51  		 */
52  		public PlayerCompositeImpl(
53  			PlayerLocalImpl partLocal,
54  			PlayerSharedImpl partShared,
55  			PlayerStaticImpl partStatic
56  		) {
57  			this.partLocal  = partLocal;
58  			this.partShared = partShared;
59  			this.partStatic = partStatic;
60  		}
61  		
62  		/**
63  		 * Cloning constructor.
64  		 *
65  		 * @param original		 
66  		 */
67  		public PlayerCompositeImpl(PlayerCompositeImpl original) {
68  			this.partLocal = partLocal;
69  			this.partShared = partShared;
70  			this.partStatic = partStatic;
71  		}
72      
73     				
74     				@Override
75     				public void setSimTime(long SimTime) {
76  					super.setSimTime(SimTime);
77  				}
78     			
79      			
80      			protected 
81      			PlayerStaticImpl
82      			partStatic;
83      			
84      			@Override
85  				public PlayerStatic getStatic() {
86  					return partStatic;
87  				}
88      			
89      			protected
90      			PlayerLocalImpl
91      			partLocal;
92      	
93      			@Override
94  				public PlayerLocal getLocal() {
95  					return partLocal;
96  				}
97  			
98      			PlayerSharedImpl
99      			partShared;
100     			
101 				@Override
102 				public PlayerShared getShared() {
103 					return partShared;
104 				}
105 			
106 				
107   				
108   					@Override
109     				
110  		/**
111          * Unique Id of the player. 
112          */
113         public  UnrealId getId()
114  	 {
115     					return 
116     						
117     								partStatic.
118     							getId()
119  	;
120     				}
121     			
122   					@Override
123     				
124  		/**
125          * 
126 			Exported just for control server. Holds jmx address we need to connect to
127             when we want to debug our bot.
128 		 
129          */
130         public  String getJmx()
131  	 {
132     					return 
133     						
134     								partLocal.
135     							getJmx()
136  	;
137     				}
138     			
139   					@Override
140     				
141  		/**
142          * 
143 			Human readable name of the player.
144 		 
145          */
146         public  String getName()
147  	 {
148     					return 
149     						
150     								partShared.
151     							getName()
152  	;
153     				}
154     			
155   					@Override
156     				
157  		/**
158          * 
159 			Atomic action this bot is doing (BDI).
160 		 
161          */
162         public  String getAction()
163  	 {
164     					return 
165     						
166     								partShared.
167     							getAction()
168  	;
169     				}
170     			
171   					@Override
172     				
173  		/**
174          * 
175             If the player is in the field of view of the bot.
176          
177          */
178         public  boolean isVisible()
179  	 {
180     					return 
181     						
182     								partLocal.
183     							isVisible()
184  	;
185     				}
186     			
187   					@Override
188     				
189  		/**
190          * 
191 			Which direction the player is facing in absolute terms.
192 		 
193          */
194         public  Rotation getRotation()
195  	 {
196     					return 
197     						
198     								partShared.
199     							getRotation()
200  	;
201     				}
202     			
203   					@Override
204     				
205  		/**
206          * 
207 			An absolute location of the player within the map.
208 		 
209          */
210         public  Location getLocation()
211  	 {
212     					return 
213     						
214     								partShared.
215     							getLocation()
216  	;
217     				}
218     			
219   					@Override
220     				
221  		/**
222          * 
223 			Absolute velocity of the player as a vector of movement per one
224 			game second.
225 		 
226          */
227         public  Velocity getVelocity()
228  	 {
229     					return 
230     						
231     								partShared.
232     							getVelocity()
233  	;
234     				}
235     			
236   					@Override
237     				
238  		/**
239          * 
240 			What team the player is on. 255 is no team. 0-3 are red,
241 			blue, green, gold in that order.
242 		 
243          */
244         public  int getTeam()
245  	 {
246     					return 
247     						
248     								partShared.
249     							getTeam()
250  	;
251     				}
252     			
253   					@Override
254     				
255  		/**
256          * 
257 			Class of the weapon the player is holding. Weapon strings to
258 			look for include: "AssaultRifle", "ShieldGun", "FlakCannon",
259 			"BioRifle", "ShockRifle", "LinkGun", "SniperRifle",
260 			"RocketLauncher", "Minigun", "LightingGun", "Translocator".
261 			TODO: Look if this is all.
262 		 
263          */
264         public  String getWeapon()
265  	 {
266     					return 
267     						
268     								partShared.
269     							getWeapon()
270  	;
271     				}
272     			
273   					@Override
274     				
275  		/**
276          * 
277 			True if the bot is crouched.
278 		 
279          */
280         public  boolean isCrouched()
281  	 {
282     					return 
283     						
284     								partShared.
285     							isCrouched()
286  	;
287     				}
288     			
289   					@Override
290     				
291  		/**
292          * 
293 			0 means is not firing, 1 - firing in primary mode, 2 -
294 			firing in secondary mode (alt firing).
295 		 
296          */
297         public  int getFiring()
298  	 {
299     					return 
300     						
301     								partShared.
302     							getFiring()
303  	;
304     				}
305     			
306   					@Override
307     				
308  		/**
309          * 
310 			For UE2. Holds left emoticon of the bot, "None" means none set.
311 		 
312          */
313         public  String getEmotLeft()
314  	 {
315     					return 
316     						
317     								partShared.
318     							getEmotLeft()
319  	;
320     				}
321     			
322   					@Override
323     				
324  		/**
325          * 
326 			For UE2. Holds center emoticon of the bot, "None" means none set.
327 		 
328          */
329         public  String getEmotCenter()
330  	 {
331     					return 
332     						
333     								partShared.
334     							getEmotCenter()
335  	;
336     				}
337     			
338   					@Override
339     				
340  		/**
341          * 
342 			For UE2. Holds right emoticon of the bot, "None" means none set.
343 		 
344          */
345         public  String getEmotRight()
346  	 {
347     					return 
348     						
349     								partShared.
350     							getEmotRight()
351  	;
352     				}
353     			
354   					@Override
355     				
356  		/**
357          * 
358 			For UE2. Holds the bubble of the emoticon of the bot, "None" means none set.
359 		 
360          */
361         public  String getBubble()
362  	 {
363     					return 
364     						
365     								partShared.
366     							getBubble()
367  	;
368     				}
369     			
370   					@Override
371     				
372  		/**
373          * 
374 			For UE2. Current played animation of the bot.
375 		 
376          */
377         public  String getAnim()
378  	 {
379     					return 
380     						
381     								partShared.
382     							getAnim()
383  	;
384     				}
385     			
386  		
387  	    public String toString() {
388             return
389             	super.toString() + "[" +
390             	
391             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
392             		
393 				"]";           		
394         }
395  	
396  		
397  		public String toHtmlString() {
398  			return super.toString() + "[<br/>" +
399             	
400             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
401             		
402 				"<br/>]";     
403 		}
404  	
405  		
406  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
407         	
408 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
409 		
410 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
411 	        
412 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
413  	
414 		}
415