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=static]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=static]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the static part of the GameBots2004 message NAV.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. NavPoint carries information about UT
25  		navigation point - location, reachability... Also some item can
26  		be respawned at this point. Or some additional information can
27  		be stored here (if it is an ambush point, or sniper point..).
28  	
29           */
30   	public abstract class NavPointStatic 
31    						extends InfoMessage
32    						implements IStaticWorldObject
33    						
34  	    {
35   	
36      	
37      	
38      	/**
39      	 * Parameter-less contructor for the message.
40      	 */
41  		public NavPointStatic()
42  		{
43  		}
44  		
45  				// abstract definition of the static-part of the message, no more constructors is needed
46  			
47  	   		
48  			protected long SimTime;
49  				
50  			/**
51  			 * Simulation time in MILLI SECONDS !!!
52  			 */	
53  			@Override
54  			public long getSimTime() {
55  				return SimTime;
56  			}
57  						
58  			/**
59  			 * Used by Yylex to slip correct time of the object or programmatically.
60  			 */
61  			protected void setSimTime(long SimTime) {
62  				this.SimTime = SimTime;
63  			}
64  	   	
65  	    			
66  	    				@Override
67  		    			public abstract 
68  		    			NavPointStatic clone();
69  		    			
70  						@Override
71  						public Class getCompositeClass() {
72  							return NavPoint.class;
73  						}
74  	
75  						
76  		    			
77   		/**
78           * 
79  			A unique Id of this navigation point assigned by the game.
80  		 
81           */
82          public abstract UnrealId getId()
83   	;
84  		    			
85   		/**
86           * 
87  			Unique Id of the respawned item (the item respawns at this
88  			point). Not sent if point is not an inventory spot. Sent only in HandShake.
89  		 
90           */
91          public abstract UnrealId getItem()
92   	;
93  		    			
94   		/**
95           * 
96              Class of the item (e.g. xWeapons.FlakCannonPickup). Not sent if point is not an inventory spot. Sent only in HandShake.
97           
98           */
99          public abstract ItemType getItemClass()
100  	;
101 		    			
102  		/**
103          * 
104             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.
105          
106          */
107         public abstract UnrealId getMover()
108  	;
109 		    			
110  		/**
111          * 
112             Starting vector between MyLift location and LiftCenter location. Not sent if point is not a LiftCenter. Sent only in HandShake.
113          
114          */
115         public abstract Vector3d getLiftOffset()
116  	;
117 		    			
118  		/**
119          * 
120             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.
121          
122          */
123         public abstract boolean isLiftJumpExit()
124  	;
125 		    			
126  		/**
127          * 
128             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.
129          
130          */
131         public abstract boolean isNoDoubleJump()
132  	;
133 		    			
134  		/**
135          * 
136 			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!
137 		 
138          */
139         public abstract int getTeamNumber()
140  	;
141 		    			
142  		/**
143          * If this point marks a DominationPoint (for BotDoubleDomination game). 
144          */
145         public abstract boolean isDomPoint()
146  	;
147 		    			
148  		/**
149          * Exported if this NavPoint is a DominationPoint (for BotDoubleDomination game) - which team controls this point. 
150          */
151         public abstract int getDomPointController()
152  	;
153 		    			
154  		/**
155          * 
156 			If this point marks a door mover.
157 		 
158          */
159         public abstract boolean isDoor()
160  	;
161 		    			
162  		/**
163          * 
164 			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).
165 		 
166          */
167         public abstract boolean isLiftCenter()
168  	;
169 		    			
170  		/**
171          * 
172 			If this point marks a lift exit (used to mark exit point of a lift mover).
173 		 
174          */
175         public abstract boolean isLiftExit()
176  	;
177 		    			
178  		/**
179          * 
180 			If this point is an AI marker - marks an interesting spot in the environment. May be ambush point or sniping spot, etc.
181 		 
182          */
183         public abstract boolean isAIMarker()
184  	;
185 		    			
186  		/**
187          * 
188 			If this point marks a jump spot (a special device that causes the bot to jump high or far).
189 		 
190          */
191         public abstract boolean isJumpSpot()
192  	;
193 		    			
194  		/**
195          * 
196 			If this point marks a jump pad (a special device that causes the bot to jump high or far).
197 		 
198          */
199         public abstract boolean isJumpPad()
200  	;
201 		    			
202  		/**
203          * 
204 			If this point marks a jump destination - some place that can be reached by some special jump.
205 		 
206          */
207         public abstract boolean isJumpDest()
208  	;
209 		    			
210  		/**
211          * 
212 			If this point marks a teleport. 
213 		 
214          */
215         public abstract boolean isTeleporter()
216  	;
217 		    			
218  		/**
219          * 
220 			If the type is AIMarker. The rotation the bot should be
221 			facing, when doing the action specified by AIMarker. Sent only in HandShake.
222 		 
223          */
224         public abstract Rotation getRotation()
225  	;
226 		    			
227  		/**
228          * 
229 			Some ambush point, where is good chance to intercept
230 			approaching opponents. Sent only in HandShake.
231 		 
232          */
233         public abstract boolean isRoamingSpot()
234  	;
235 		    			
236  		/**
237          * Point good for sniping. Sent only in HandShake. 
238          */
239         public abstract boolean isSnipingSpot()
240  	;
241 		    			
242  		/**
243          * If item should be present at this navpoint it's instance will be here. 
244          */
245         public abstract Item getItemInstance()
246  	;
247 		    			
248  		/**
249          * 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). 
250          */
251         public abstract Map<UnrealId, NavPointNeighbourLink> getOutgoingEdges()
252  	;
253 		    			
254  		/**
255          * 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). 
256          */
257         public abstract Map<UnrealId, NavPointNeighbourLink> getIncomingEdges()
258  	;
259 		    			
260  		/**
261          * 
262 			Class of the weapon that should be prefered when using this
263 			point for AIMarker specified action. Sent only in HandShake.
264 		 
265          */
266         public abstract String getPreferedWeapon()
267  	;
268 		    			
269  		
270  		@Override
271  		public boolean isDifferentFrom(IStaticWorldObject other)
272  		{
273  			if (other == null) //early fail
274  			{
275  				return true;
276  			}
277  			else if (other == this) //early out
278  			{
279  				return false;
280  			}
281  			else
282  			{
283  				NavPointStatic obj = (NavPointStatic) other;
284 
285  				
286  						if ( !(
287  	 			AdvancedEquals.equalsOrNull(this.getId()
288  	, obj.getId()
289  	)
290  	 		) )
291 						{
292 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class NavPointStatic");
293 							return true;
294 						}
295  					
296  						if ( !(
297  	 			AdvancedEquals.equalsOrNull(this.getItem()
298  	, obj.getItem()
299  	)
300  	 		) )
301 						{
302 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Item on object class NavPointStatic");
303 							return true;
304 						}
305  					
306  						if ( !(
307  	 			AdvancedEquals.equalsOrNull(this.getItemClass()
308  	, obj.getItemClass()
309  	)
310  	 		) )
311 						{
312 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property ItemClass on object class NavPointStatic");
313 							return true;
314 						}
315  					
316  						if ( !(
317  	 			AdvancedEquals.equalsOrNull(this.getMover()
318  	, obj.getMover()
319  	)
320  	 		) )
321 						{
322 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Mover on object class NavPointStatic");
323 							return true;
324 						}
325  					
326  						if ( !(
327  	 			AdvancedEquals.equalsOrNull(this.getLiftOffset()
328  	, obj.getLiftOffset()
329  	)
330  	 		) )
331 						{
332 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftOffset on object class NavPointStatic");
333 							return true;
334 						}
335  					
336  						if ( !(this.isLiftJumpExit()
337  	
338  	 			== obj.isLiftJumpExit()
339  	) )
340 						{
341 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftJumpExit on object class NavPointStatic");
342 							return true;
343 						}
344  					
345  						if ( !(this.isNoDoubleJump()
346  	
347  	 			== obj.isNoDoubleJump()
348  	) )
349 						{
350 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NoDoubleJump on object class NavPointStatic");
351 							return true;
352 						}
353  					
354  						if ( !(this.getTeamNumber()
355  	
356  	 			== obj.getTeamNumber()
357  	) )
358 						{
359 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property TeamNumber on object class NavPointStatic");
360 							return true;
361 						}
362  					
363  						if ( !(this.isDomPoint()
364  	
365  	 			== obj.isDomPoint()
366  	) )
367 						{
368 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DomPoint on object class NavPointStatic");
369 							return true;
370 						}
371  					
372  						if ( !(this.getDomPointController()
373  	
374  	 			== obj.getDomPointController()
375  	) )
376 						{
377 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DomPointController on object class NavPointStatic");
378 							return true;
379 						}
380  					
381  						if ( !(this.isDoor()
382  	
383  	 			== obj.isDoor()
384  	) )
385 						{
386 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Door on object class NavPointStatic");
387 							return true;
388 						}
389  					
390  						if ( !(this.isLiftCenter()
391  	
392  	 			== obj.isLiftCenter()
393  	) )
394 						{
395 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftCenter on object class NavPointStatic");
396 							return true;
397 						}
398  					
399  						if ( !(this.isLiftExit()
400  	
401  	 			== obj.isLiftExit()
402  	) )
403 						{
404 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftExit on object class NavPointStatic");
405 							return true;
406 						}
407  					
408  						if ( !(this.isAIMarker()
409  	
410  	 			== obj.isAIMarker()
411  	) )
412 						{
413 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property AIMarker on object class NavPointStatic");
414 							return true;
415 						}
416  					
417  						if ( !(this.isJumpSpot()
418  	
419  	 			== obj.isJumpSpot()
420  	) )
421 						{
422 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpSpot on object class NavPointStatic");
423 							return true;
424 						}
425  					
426  						if ( !(this.isJumpPad()
427  	
428  	 			== obj.isJumpPad()
429  	) )
430 						{
431 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpPad on object class NavPointStatic");
432 							return true;
433 						}
434  					
435  						if ( !(this.isJumpDest()
436  	
437  	 			== obj.isJumpDest()
438  	) )
439 						{
440 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpDest on object class NavPointStatic");
441 							return true;
442 						}
443  					
444  						if ( !(this.isTeleporter()
445  	
446  	 			== obj.isTeleporter()
447  	) )
448 						{
449 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Teleporter on object class NavPointStatic");
450 							return true;
451 						}
452  					
453  						if ( !(
454  	 			AdvancedEquals.equalsOrNull(this.getRotation()
455  	, obj.getRotation()
456  	)
457  	 		) )
458 						{
459 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Rotation on object class NavPointStatic");
460 							return true;
461 						}
462  					
463  						if ( !(this.isRoamingSpot()
464  	
465  	 			== obj.isRoamingSpot()
466  	) )
467 						{
468 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property RoamingSpot on object class NavPointStatic");
469 							return true;
470 						}
471  					
472  						if ( !(this.isSnipingSpot()
473  	
474  	 			== obj.isSnipingSpot()
475  	) )
476 						{
477 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property SnipingSpot on object class NavPointStatic");
478 							return true;
479 						}
480  					
481  						if ( !(
482  	 			AdvancedEquals.equalsOrNull(this.getItemInstance()
483  	, obj.getItemInstance()
484  	)
485  	 		) )
486 						{
487 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property ItemInstance on object class NavPointStatic");
488 							return true;
489 						}
490  					
491  						//Skipping outgoing and incoming edges tests because the navGraph is sent only once
492  					
493  						//Skipping outgoing and incoming edges tests because the navGraph is sent only once
494  					
495  						if ( !(
496  	 			AdvancedEquals.equalsOrNull(this.getPreferedWeapon()
497  	, obj.getPreferedWeapon()
498  	)
499  	 		) )
500 						{
501 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property PreferedWeapon on object class NavPointStatic");
502 							return true;
503 						}
504  					
505  			}
506  			return false;
507  		}
508  	 
509  		
510  	    public String toString() {
511             return
512             	super.toString() + "[" +
513             	
514 		              			"Id = " + String.valueOf(getId()
515  	) + " | " + 
516 		              		
517 		              			"Item = " + String.valueOf(getItem()
518  	) + " | " + 
519 		              		
520 		              			"ItemClass = " + String.valueOf(getItemClass()
521  	) + " | " + 
522 		              		
523 		              			"Mover = " + String.valueOf(getMover()
524  	) + " | " + 
525 		              		
526 		              			"LiftOffset = " + String.valueOf(getLiftOffset()
527  	) + " | " + 
528 		              		
529 		              			"LiftJumpExit = " + String.valueOf(isLiftJumpExit()
530  	) + " | " + 
531 		              		
532 		              			"NoDoubleJump = " + String.valueOf(isNoDoubleJump()
533  	) + " | " + 
534 		              		
535 		              			"TeamNumber = " + String.valueOf(getTeamNumber()
536  	) + " | " + 
537 		              		
538 		              			"DomPoint = " + String.valueOf(isDomPoint()
539  	) + " | " + 
540 		              		
541 		              			"DomPointController = " + String.valueOf(getDomPointController()
542  	) + " | " + 
543 		              		
544 		              			"Door = " + String.valueOf(isDoor()
545  	) + " | " + 
546 		              		
547 		              			"LiftCenter = " + String.valueOf(isLiftCenter()
548  	) + " | " + 
549 		              		
550 		              			"LiftExit = " + String.valueOf(isLiftExit()
551  	) + " | " + 
552 		              		
553 		              			"AIMarker = " + String.valueOf(isAIMarker()
554  	) + " | " + 
555 		              		
556 		              			"JumpSpot = " + String.valueOf(isJumpSpot()
557  	) + " | " + 
558 		              		
559 		              			"JumpPad = " + String.valueOf(isJumpPad()
560  	) + " | " + 
561 		              		
562 		              			"JumpDest = " + String.valueOf(isJumpDest()
563  	) + " | " + 
564 		              		
565 		              			"Teleporter = " + String.valueOf(isTeleporter()
566  	) + " | " + 
567 		              		
568 		              			"Rotation = " + String.valueOf(getRotation()
569  	) + " | " + 
570 		              		
571 		              			"RoamingSpot = " + String.valueOf(isRoamingSpot()
572  	) + " | " + 
573 		              		
574 		              			"SnipingSpot = " + String.valueOf(isSnipingSpot()
575  	) + " | " + 
576 		              		
577 		              			"PreferedWeapon = " + String.valueOf(getPreferedWeapon()
578  	) + " | " + 
579 		              		
580 				"]";           		
581         }
582  	
583  		
584  		public String toHtmlString() {
585  			return super.toString() + "[<br/>" +
586             	
587 		              			"<b>Id</b> = " + String.valueOf(getId()
588  	) + " <br/> " + 
589 		              		
590 		              			"<b>Item</b> = " + String.valueOf(getItem()
591  	) + " <br/> " + 
592 		              		
593 		              			"<b>ItemClass</b> = " + String.valueOf(getItemClass()
594  	) + " <br/> " + 
595 		              		
596 		              			"<b>Mover</b> = " + String.valueOf(getMover()
597  	) + " <br/> " + 
598 		              		
599 		              			"<b>LiftOffset</b> = " + String.valueOf(getLiftOffset()
600  	) + " <br/> " + 
601 		              		
602 		              			"<b>LiftJumpExit</b> = " + String.valueOf(isLiftJumpExit()
603  	) + " <br/> " + 
604 		              		
605 		              			"<b>NoDoubleJump</b> = " + String.valueOf(isNoDoubleJump()
606  	) + " <br/> " + 
607 		              		
608 		              			"<b>TeamNumber</b> = " + String.valueOf(getTeamNumber()
609  	) + " <br/> " + 
610 		              		
611 		              			"<b>DomPoint</b> = " + String.valueOf(isDomPoint()
612  	) + " <br/> " + 
613 		              		
614 		              			"<b>DomPointController</b> = " + String.valueOf(getDomPointController()
615  	) + " <br/> " + 
616 		              		
617 		              			"<b>Door</b> = " + String.valueOf(isDoor()
618  	) + " <br/> " + 
619 		              		
620 		              			"<b>LiftCenter</b> = " + String.valueOf(isLiftCenter()
621  	) + " <br/> " + 
622 		              		
623 		              			"<b>LiftExit</b> = " + String.valueOf(isLiftExit()
624  	) + " <br/> " + 
625 		              		
626 		              			"<b>AIMarker</b> = " + String.valueOf(isAIMarker()
627  	) + " <br/> " + 
628 		              		
629 		              			"<b>JumpSpot</b> = " + String.valueOf(isJumpSpot()
630  	) + " <br/> " + 
631 		              		
632 		              			"<b>JumpPad</b> = " + String.valueOf(isJumpPad()
633  	) + " <br/> " + 
634 		              		
635 		              			"<b>JumpDest</b> = " + String.valueOf(isJumpDest()
636  	) + " <br/> " + 
637 		              		
638 		              			"<b>Teleporter</b> = " + String.valueOf(isTeleporter()
639  	) + " <br/> " + 
640 		              		
641 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
642  	) + " <br/> " + 
643 		              		
644 		              			"<b>RoamingSpot</b> = " + String.valueOf(isRoamingSpot()
645  	) + " <br/> " + 
646 		              		
647 		              			"<b>SnipingSpot</b> = " + String.valueOf(isSnipingSpot()
648  	) + " <br/> " + 
649 		              		
650 		              			"<b>PreferedWeapon</b> = " + String.valueOf(getPreferedWeapon()
651  	) + " <br/> " + 
652 		              		
653 				"<br/>]";     
654 		}
655  	
656  		
657  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
658         	
659 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
660 		
661 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---
662 	        
663 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---        	            	
664  	
665 		}
666