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 NAV 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. NavPoint carries information about UT
26  		navigation point - location, reachability... Also some item can
27  		be respawned at this point. Or some additional information can
28  		be stored here (if it is an ambush point, or sniper point..).
29  	
30           */
31   	public class NavPointCompositeImpl 
32    				extends NavPoint
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public NavPointCompositeImpl()
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 NavPointCompositeImpl(
53  			NavPointLocalImpl partLocal,
54  			NavPointSharedImpl partShared,
55  			NavPointStaticImpl 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 NavPointCompositeImpl(NavPointCompositeImpl 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      			NavPointStaticImpl
82      			partStatic;
83      			
84      			@Override
85  				public NavPointStatic getStatic() {
86  					return partStatic;
87  				}
88      			
89      			protected
90      			NavPointLocalImpl
91      			partLocal;
92      	
93      			@Override
94  				public NavPointLocal getLocal() {
95  					return partLocal;
96  				}
97  			
98      			NavPointSharedImpl
99      			partShared;
100     			
101 				@Override
102 				public NavPointShared getShared() {
103 					return partShared;
104 				}
105 			
106 				
107   				
108   					@Override
109     				
110  		/**
111          * 
112 			A unique Id of this navigation point assigned by the game.
113 		 
114          */
115         public  UnrealId getId()
116  	 {
117     					return 
118     						
119     								partStatic.
120     							getId()
121  	;
122     				}
123     			
124   					@Override
125     				
126  		/**
127          * Location of navigation point. 
128          */
129         public  Location getLocation()
130  	 {
131     					return 
132     						
133     								partShared.
134     							getLocation()
135  	;
136     				}
137     			
138   					@Override
139     				
140  		/**
141          * 
142 			Velocity of the navigation point (if the navigation point is
143 			currently moving). Not sent at the moment.
144 		 
145          */
146         public  Velocity getVelocity()
147  	 {
148     					return 
149     						
150     								partShared.
151     							getVelocity()
152  	;
153     				}
154     			
155   					@Override
156     				
157  		/**
158          * 
159 			If the point is in the field of view of the bot.
160 		 
161          */
162         public  boolean isVisible()
163  	 {
164     					return 
165     						
166     								partLocal.
167     							isVisible()
168  	;
169     				}
170     			
171   					@Override
172     				
173  		/**
174          * 
175 			Unique Id of the respawned item (the item respawns at this
176 			point). Not sent if point is not an inventory spot. Sent only in HandShake.
177 		 
178          */
179         public  UnrealId getItem()
180  	 {
181     					return 
182     						
183     								partStatic.
184     							getItem()
185  	;
186     				}
187     			
188   					@Override
189     				
190  		/**
191          * 
192             Class of the item (e.g. xWeapons.FlakCannonPickup). Not sent if point is not an inventory spot. Sent only in HandShake.
193          
194          */
195         public  ItemType getItemClass()
196  	 {
197     					return 
198     						
199     								partStatic.
200     							getItemClass()
201  	;
202     				}
203     			
204   					@Override
205     				
206  		/**
207          * 
208             True if the item is spawned at the point. Not sent if point is not an inventory spot. 
209          
210          */
211         public  boolean isItemSpawned()
212  	 {
213     					return 
214     						
215     								partShared.
216     							isItemSpawned()
217  	;
218     				}
219     			
220   					@Override
221     				
222  		/**
223          * 
224             True if this NavPoint is a Door and door is opened. Not sent if point is not a door.
225          
226          */
227         public  boolean isDoorOpened()
228  	 {
229     					return 
230     						
231     								partShared.
232     							isDoorOpened()
233  	;
234     				}
235     			
236   					@Override
237     				
238  		/**
239          * 
240             If this NavPoint is marking some mover, the mover id will be here. Not sent if point is not a Door, a LiftCenter or a LiftExit. Sent only in HandShake.
241          
242          */
243         public  UnrealId getMover()
244  	 {
245     					return 
246     						
247     								partStatic.
248     							getMover()
249  	;
250     				}
251     			
252   					@Override
253     				
254  		/**
255          * 
256             Starting vector between MyLift location and LiftCenter location. Not sent if point is not a LiftCenter. Sent only in HandShake.
257          
258          */
259         public  Vector3d getLiftOffset()
260  	 {
261     					return 
262     						
263     								partStatic.
264     							getLiftOffset()
265  	;
266     				}
267     			
268   					@Override
269     				
270  		/**
271          * 
272             Boolean. If we can/should exit the lift by a jump when near the destination place. Not sent if point is not a LiftExit. Sent only in HandShake.
273          
274          */
275         public  boolean isLiftJumpExit()
276  	 {
277     					return 
278     						
279     								partStatic.
280     							isLiftJumpExit()
281  	;
282     				}
283     			
284   					@Override
285     				
286  		/**
287          * 
288             Boolean. If we should or not use double jump when exiting lift with a jump. Not sent if point is not a LiftExit. Sent only in HandShake.
289          
290          */
291         public  boolean isNoDoubleJump()
292  	 {
293     					return 
294     						
295     								partStatic.
296     							isNoDoubleJump()
297  	;
298     				}
299     			
300   					@Override
301     				
302  		/**
303          * 
304 			If this is an inventory spot (item is respawned at this point).
305 		 
306          */
307         public  boolean isInvSpot()
308  	 {
309     					return 
310     						
311     								partShared.
312     							isInvSpot()
313  	;
314     				}
315     			
316   					@Override
317     				
318  		/**
319          * 
320 			If this is a player start (players and/or bots are respawned at this point).
321 		 
322          */
323         public  boolean isPlayerStart()
324  	 {
325     					return 
326     						
327     								partShared.
328     							isPlayerStart()
329  	;
330     				}
331     			
332   					@Override
333     				
334  		/**
335          * 
336 			Will be sent if this is a player start. In Team games (team deathmatch, capture the flag, domination) holds information about which team respawns at this player start spot. In non-team games will return 0!
337 		 
338          */
339         public  int getTeamNumber()
340  	 {
341     					return 
342     						
343     								partStatic.
344     							getTeamNumber()
345  	;
346     				}
347     			
348   					@Override
349     				
350  		/**
351          * If this point marks a DominationPoint (for BotDoubleDomination game). 
352          */
353         public  boolean isDomPoint()
354  	 {
355     					return 
356     						
357     								partStatic.
358     							isDomPoint()
359  	;
360     				}
361     			
362   					@Override
363     				
364  		/**
365          * Exported if this NavPoint is a DominationPoint (for BotDoubleDomination game) - which team controls this point. 
366          */
367         public  int getDomPointController()
368  	 {
369     					return 
370     						
371     								partStatic.
372     							getDomPointController()
373  	;
374     				}
375     			
376   					@Override
377     				
378  		/**
379          * 
380 			If this point marks a door mover.
381 		 
382          */
383         public  boolean isDoor()
384  	 {
385     					return 
386     						
387     								partStatic.
388     							isDoor()
389  	;
390     				}
391     			
392   					@Override
393     				
394  		/**
395          * 
396 			If this point marks a lift center (used to mark center of a lift mover, note that this point will be always moved with the lift).
397 		 
398          */
399         public  boolean isLiftCenter()
400  	 {
401     					return 
402     						
403     								partStatic.
404     							isLiftCenter()
405  	;
406     				}
407     			
408   					@Override
409     				
410  		/**
411          * 
412 			If this point marks a lift exit (used to mark exit point of a lift mover).
413 		 
414          */
415         public  boolean isLiftExit()
416  	 {
417     					return 
418     						
419     								partStatic.
420     							isLiftExit()
421  	;
422     				}
423     			
424   					@Override
425     				
426  		/**
427          * 
428 			If this point is an AI marker - marks an interesting spot in the environment. May be ambush point or sniping spot, etc.
429 		 
430          */
431         public  boolean isAIMarker()
432  	 {
433     					return 
434     						
435     								partStatic.
436     							isAIMarker()
437  	;
438     				}
439     			
440   					@Override
441     				
442  		/**
443          * 
444 			If this point marks a jump spot (a special device that causes the bot to jump high or far).
445 		 
446          */
447         public  boolean isJumpSpot()
448  	 {
449     					return 
450     						
451     								partStatic.
452     							isJumpSpot()
453  	;
454     				}
455     			
456   					@Override
457     				
458  		/**
459          * 
460 			If this point marks a jump pad (a special device that causes the bot to jump high or far).
461 		 
462          */
463         public  boolean isJumpPad()
464  	 {
465     					return 
466     						
467     								partStatic.
468     							isJumpPad()
469  	;
470     				}
471     			
472   					@Override
473     				
474  		/**
475          * 
476 			If this point marks a jump destination - some place that can be reached by some special jump.
477 		 
478          */
479         public  boolean isJumpDest()
480  	 {
481     					return 
482     						
483     								partStatic.
484     							isJumpDest()
485  	;
486     				}
487     			
488   					@Override
489     				
490  		/**
491          * 
492 			If this point marks a teleport. 
493 		 
494          */
495         public  boolean isTeleporter()
496  	 {
497     					return 
498     						
499     								partStatic.
500     							isTeleporter()
501  	;
502     				}
503     			
504   					@Override
505     				
506  		/**
507          * 
508 			If the type is AIMarker. The rotation the bot should be
509 			facing, when doing the action specified by AIMarker. Sent only in HandShake.
510 		 
511          */
512         public  Rotation getRotation()
513  	 {
514     					return 
515     						
516     								partStatic.
517     							getRotation()
518  	;
519     				}
520     			
521   					@Override
522     				
523  		/**
524          * 
525 			Some ambush point, where is good chance to intercept
526 			approaching opponents. Sent only in HandShake.
527 		 
528          */
529         public  boolean isRoamingSpot()
530  	 {
531     					return 
532     						
533     								partStatic.
534     							isRoamingSpot()
535  	;
536     				}
537     			
538   					@Override
539     				
540  		/**
541          * Point good for sniping. Sent only in HandShake. 
542          */
543         public  boolean isSnipingSpot()
544  	 {
545     					return 
546     						
547     								partStatic.
548     							isSnipingSpot()
549  	;
550     				}
551     			
552   					@Override
553     				
554  		/**
555          * If item should be present at this navpoint it's instance will be here. 
556          */
557         public  Item getItemInstance()
558  	 {
559     					return 
560     						
561     								partStatic.
562     							getItemInstance()
563  	;
564     				}
565     			
566   					@Override
567     				
568  		/**
569          * Maps edge-LEADING_TO-navpoint-UnrealId to neighbour link, those are outgoing edges (those edges that originates in this navpoint going to another one, those you may usually travel). 
570          */
571         public  Map<UnrealId, NavPointNeighbourLink> getOutgoingEdges()
572  	 {
573     					return 
574     						
575     								partStatic.
576     							getOutgoingEdges()
577  	;
578     				}
579     			
580   					@Override
581     				
582  		/**
583          * Maps edge-ORIGINATES_FROM-navpoint-UnrealId to neighbour link, those are incoming edges (those edges that originates in different navpoint and ends here, do not use this to ask whether you can get to navpoint of specific unreal id, use OutgoingEdges instead). 
584          */
585         public  Map<UnrealId, NavPointNeighbourLink> getIncomingEdges()
586  	 {
587     					return 
588     						
589     								partStatic.
590     							getIncomingEdges()
591  	;
592     				}
593     			
594   					@Override
595     				
596  		/**
597          * 
598 			Class of the weapon that should be prefered when using this
599 			point for AIMarker specified action. Sent only in HandShake.
600 		 
601          */
602         public  String getPreferedWeapon()
603  	 {
604     					return 
605     						
606     								partStatic.
607     							getPreferedWeapon()
608  	;
609     				}
610     			
611  		
612  	    public String toString() {
613             return
614             	super.toString() + "[" +
615             	
616             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
617             		
618 				"]";           		
619         }
620  	
621  		
622  		public String toHtmlString() {
623  			return super.toString() + "[<br/>" +
624             	
625             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
626             		
627 				"<br/>]";     
628 		}
629  	
630  		
631  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
632         	
633 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
634 		
635 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
636 	        
637 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
638  	
639 		}
640