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 INGP.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Info batch message. Start with SNGP, ends with ENGP. Sent for
25  		each INAV message at the beginning of the communication. Holds
26  		information about NavPoint neighbours. This way the reachability
27  		graph can be exported from UT2004. You should interpret this as
28  		a DIRECTED EDGE of the navpoint GRAPH that describes the the edge
29  		from FromNavPoint to ToNavPoint.
30  	
31           */
32   	public class NavPointNeighbourLink 
33    				extends InfoMessage
34      			implements IWorldEvent, IWorldChangeEvent
35      			
36  	    {
37   	
38      	/** Example how the message looks like - used during parser tests. */
39      	public static final String PROTOTYPE =
40      		"INGP {Id unreal_id}  {Flags 0}  {CollisionR 0}  {CollisionH 0}  {TranslocZOffset 0}  {TranslocTargetTag text}  {OnlyTranslocator False}  {ForceDoubleJump False}  {NeededJump 0,0,0}  {NeverImpactJump False}  {NoLowGrav False}  {CalculatedGravityZ 0} ";
41      
42      	
43      	
44      	/**
45      	 * Parameter-less contructor for the message.
46      	 */
47  		public NavPointNeighbourLink()
48  		{
49  		}
50  	
51      	
52      	
53      	
54      	/**
55  		 * Creates new instance of the message NavPointNeighbourLink.
56  		 * 
57  		Info batch message. Start with SNGP, ends with ENGP. Sent for
58  		each INAV message at the beginning of the communication. Holds
59  		information about NavPoint neighbours. This way the reachability
60  		graph can be exported from UT2004. You should interpret this as
61  		a DIRECTED EDGE of the navpoint GRAPH that describes the the edge
62  		from FromNavPoint to ToNavPoint.
63  	
64  		 * Corresponding GameBots message
65  		 *   
66  		 *   is
67  		 *   INGP.
68  		 * 
69   	  	 * 
70  		 *   
71  		 *     @param Id 
72  			Unique Id of the NavPoint the link is leading to (end of the link). Always identical to ToNavPoint.getStringId().
73  		
74  		 *   
75  		 * 
76  		 *   
77  		 *     @param Flags 
78  			Holds information about the path from the NavPoint to its
79  			neighbour that is represented by this message. TODO: see
80  			reachspecs on UnrealWiki.
81  		
82  		 *   
83  		 * 
84  		 *   
85  		 *     @param CollisionR 
86  			Maximum collision radius of the path between navigation
87  			points. Bot bigger then this cannot use this path.
88  		
89  		 *   
90  		 * 
91  		 *   
92  		 *     @param CollisionH 
93  			Maximum collision height of the path between navigation
94  			points. Bot bigger then this cannot use this path.
95  		
96  		 *   
97  		 * 
98  		 *   
99  		 *     @param TranslocZOffset 
100 	       TODO: mystery - we haven't figure it out so far.
101 	       Can be:
102 	       a) z-coord of the translocator target
103 	       b) translocator z-force for the translocator shot
104 	   
105 		 *   
106 		 * 
107 		 *   
108 		 *     @param TranslocTargetTag 
109            TODO: mystery - we haven't figure it out so far.
110            Can be: where you should appear when successfully translocated or where to aim at
111        
112 		 *   
113 		 * 
114 		 *   
115 		 *     @param OnlyTranslocator 
116            Whether the translocator is the only way how to traverse this navigation edge.
117        
118 		 *   
119 		 * 
120 		 *   
121 		 *     @param ForceDoubleJump 
122            Whether you need to double jump to get to the neighbour navpoint.
123        
124 		 *   
125 		 * 
126 		 *   
127 		 *     @param NeededJump 
128            TODO: mystery how to interpret
129        
130 		 *   
131 		 * 
132 		 *   
133 		 *     @param NeverImpactJump 
134            TODO: mystery how to interpret
135        
136 		 *   
137 		 * 
138 		 *   
139 		 *     @param NoLowGrav 
140            TODO: mystery how to interpret
141        
142 		 *   
143 		 * 
144 		 *   
145 		 *     @param CalculatedGravityZ 
146            TODO: mystery how to interpret
147        
148 		 *   
149 		 * 
150 		 *   
151 		 *     @param FromNavPoint 
152 			Start of the link (edge), where the link originates.
153 		
154 		 *   
155 		 * 
156 		 *   
157 		 *     @param ToNavPoint 
158             End of the link (edge), where the link ends.
159         
160 		 *   
161 		 * 
162 		 */
163 		public NavPointNeighbourLink(
164 			UnrealId Id,  int Flags,  int CollisionR,  int CollisionH,  double TranslocZOffset,  String TranslocTargetTag,  boolean OnlyTranslocator,  boolean ForceDoubleJump,  Vector3d NeededJump,  boolean NeverImpactJump,  boolean NoLowGrav,  double CalculatedGravityZ,  NavPoint FromNavPoint,  NavPoint ToNavPoint
165 		) {
166 			
167 					this.Id = Id;
168 				
169 					this.Flags = Flags;
170 				
171 					this.CollisionR = CollisionR;
172 				
173 					this.CollisionH = CollisionH;
174 				
175 					this.TranslocZOffset = TranslocZOffset;
176 				
177 					this.TranslocTargetTag = TranslocTargetTag;
178 				
179 					this.OnlyTranslocator = OnlyTranslocator;
180 				
181 					this.ForceDoubleJump = ForceDoubleJump;
182 				
183 					this.NeededJump = NeededJump;
184 				
185 					this.NeverImpactJump = NeverImpactJump;
186 				
187 					this.NoLowGrav = NoLowGrav;
188 				
189 					this.CalculatedGravityZ = CalculatedGravityZ;
190 				
191 					this.FromNavPoint = FromNavPoint;
192 				
193 					this.ToNavPoint = ToNavPoint;
194 				
195 		}
196     
197     	/**
198 		 * Cloning constructor from the full message.
199 		 *
200 		 * @param original
201 		 */
202 		public NavPointNeighbourLink(NavPointNeighbourLink original) {		
203 			
204 					this.Id = original.getId()
205  	;
206 				
207 					this.Flags = original.getFlags()
208  	;
209 				
210 					this.CollisionR = original.getCollisionR()
211  	;
212 				
213 					this.CollisionH = original.getCollisionH()
214  	;
215 				
216 					this.TranslocZOffset = original.getTranslocZOffset()
217  	;
218 				
219 					this.TranslocTargetTag = original.getTranslocTargetTag()
220  	;
221 				
222 					this.OnlyTranslocator = original.isOnlyTranslocator()
223  	;
224 				
225 					this.ForceDoubleJump = original.isForceDoubleJump()
226  	;
227 				
228 					this.NeededJump = original.getNeededJump()
229  	;
230 				
231 					this.NeverImpactJump = original.isNeverImpactJump()
232  	;
233 				
234 					this.NoLowGrav = original.isNoLowGrav()
235  	;
236 				
237 					this.CalculatedGravityZ = original.getCalculatedGravityZ()
238  	;
239 				
240 					this.FromNavPoint = original.getFromNavPoint()
241  	;
242 				
243 					this.ToNavPoint = original.getToNavPoint()
244  	;
245 				
246 			this.SimTime = original.getSimTime();			
247 		}
248 		
249 	   		
250 			protected long SimTime;
251 				
252 			/**
253 			 * Simulation time in MILLI SECONDS !!!
254 			 */	
255 			@Override
256 			public long getSimTime() {
257 				return SimTime;
258 			}
259 						
260 			/**
261 			 * Used by Yylex to slip correct time of the object or programmatically.
262 			 */
263 			protected void setSimTime(long SimTime) {
264 				this.SimTime = SimTime;
265 			}
266 	   	
267     	
268 	    /**
269          * 
270 			Unique Id of the NavPoint the link is leading to (end of the link). Always identical to ToNavPoint.getStringId().
271 		 
272          */
273         protected
274          UnrealId Id =
275        	null;
276 	
277  		/**
278          * 
279 			Unique Id of the NavPoint the link is leading to (end of the link). Always identical to ToNavPoint.getStringId().
280 		 
281          */
282         public  UnrealId getId()
283  	 {
284     					return Id;
285     				}
286     			
287     	
288 	    /**
289          * 
290 			Holds information about the path from the NavPoint to its
291 			neighbour that is represented by this message. TODO: see
292 			reachspecs on UnrealWiki.
293 		 
294          */
295         protected
296          int Flags =
297        	0;
298 	
299  		/**
300          * 
301 			Holds information about the path from the NavPoint to its
302 			neighbour that is represented by this message. TODO: see
303 			reachspecs on UnrealWiki.
304 		 
305          */
306         public  int getFlags()
307  	 {
308     					return Flags;
309     				}
310     			
311     	
312 	    /**
313          * 
314 			Maximum collision radius of the path between navigation
315 			points. Bot bigger then this cannot use this path.
316 		 
317          */
318         protected
319          int CollisionR =
320        	0;
321 	
322  		/**
323          * 
324 			Maximum collision radius of the path between navigation
325 			points. Bot bigger then this cannot use this path.
326 		 
327          */
328         public  int getCollisionR()
329  	 {
330     					return CollisionR;
331     				}
332     			
333     	
334 	    /**
335          * 
336 			Maximum collision height of the path between navigation
337 			points. Bot bigger then this cannot use this path.
338 		 
339          */
340         protected
341          int CollisionH =
342        	0;
343 	
344  		/**
345          * 
346 			Maximum collision height of the path between navigation
347 			points. Bot bigger then this cannot use this path.
348 		 
349          */
350         public  int getCollisionH()
351  	 {
352     					return CollisionH;
353     				}
354     			
355     	
356 	    /**
357          * 
358 	       TODO: mystery - we haven't figure it out so far.
359 	       Can be:
360 	       a) z-coord of the translocator target
361 	       b) translocator z-force for the translocator shot
362 	    
363          */
364         protected
365          double TranslocZOffset =
366        	0;
367 	
368  		/**
369          * 
370 	       TODO: mystery - we haven't figure it out so far.
371 	       Can be:
372 	       a) z-coord of the translocator target
373 	       b) translocator z-force for the translocator shot
374 	    
375          */
376         public  double getTranslocZOffset()
377  	 {
378     					return TranslocZOffset;
379     				}
380     			
381     	
382 	    /**
383          * 
384            TODO: mystery - we haven't figure it out so far.
385            Can be: where you should appear when successfully translocated or where to aim at
386         
387          */
388         protected
389          String TranslocTargetTag =
390        	null;
391 	
392  		/**
393          * 
394            TODO: mystery - we haven't figure it out so far.
395            Can be: where you should appear when successfully translocated or where to aim at
396         
397          */
398         public  String getTranslocTargetTag()
399  	 {
400     					return TranslocTargetTag;
401     				}
402     			
403     	
404 	    /**
405          * 
406            Whether the translocator is the only way how to traverse this navigation edge.
407         
408          */
409         protected
410          boolean OnlyTranslocator =
411        	false;
412 	
413  		/**
414          * 
415            Whether the translocator is the only way how to traverse this navigation edge.
416         
417          */
418         public  boolean isOnlyTranslocator()
419  	 {
420     					return OnlyTranslocator;
421     				}
422     			
423     	
424 	    /**
425          * 
426            Whether you need to double jump to get to the neighbour navpoint.
427         
428          */
429         protected
430          boolean ForceDoubleJump =
431        	false;
432 	
433  		/**
434          * 
435            Whether you need to double jump to get to the neighbour navpoint.
436         
437          */
438         public  boolean isForceDoubleJump()
439  	 {
440     					return ForceDoubleJump;
441     				}
442     			
443     	
444 	    /**
445          * 
446            TODO: mystery how to interpret
447         
448          */
449         protected
450          Vector3d NeededJump =
451        	null;
452 	
453  		/**
454          * 
455            TODO: mystery how to interpret
456         
457          */
458         public  Vector3d getNeededJump()
459  	 {
460     					return NeededJump;
461     				}
462     			
463     	
464 	    /**
465          * 
466            TODO: mystery how to interpret
467         
468          */
469         protected
470          boolean NeverImpactJump =
471        	false;
472 	
473  		/**
474          * 
475            TODO: mystery how to interpret
476         
477          */
478         public  boolean isNeverImpactJump()
479  	 {
480     					return NeverImpactJump;
481     				}
482     			
483     	
484 	    /**
485          * 
486            TODO: mystery how to interpret
487         
488          */
489         protected
490          boolean NoLowGrav =
491        	false;
492 	
493  		/**
494          * 
495            TODO: mystery how to interpret
496         
497          */
498         public  boolean isNoLowGrav()
499  	 {
500     					return NoLowGrav;
501     				}
502     			
503     	
504 	    /**
505          * 
506            TODO: mystery how to interpret
507         
508          */
509         protected
510          double CalculatedGravityZ =
511        	0;
512 	
513  		/**
514          * 
515            TODO: mystery how to interpret
516         
517          */
518         public  double getCalculatedGravityZ()
519  	 {
520     					return CalculatedGravityZ;
521     				}
522     			
523     	
524 	    /**
525          * 
526 			Start of the link (edge), where the link originates.
527 		 
528          */
529         protected
530          NavPoint FromNavPoint =
531        	null;
532 	
533  		/**
534          * 
535 			Start of the link (edge), where the link originates.
536 		 
537          */
538         public  NavPoint getFromNavPoint()
539  	 {
540     					return FromNavPoint;
541     				}
542     			
543     	
544 	    /**
545          * 
546             End of the link (edge), where the link ends.
547          
548          */
549         protected
550          NavPoint ToNavPoint =
551        	null;
552 	
553  		/**
554          * 
555             End of the link (edge), where the link ends.
556          
557          */
558         public  NavPoint getToNavPoint()
559  	 {
560     					return ToNavPoint;
561     				}
562     			
563  		
564  	    public String toString() {
565             return
566             	super.toString() + "[" +
567             	
568 		              			"Id = " + String.valueOf(getId()
569  	) + " | " + 
570 		              		
571 		              			"Flags = " + String.valueOf(getFlags()
572  	) + " | " + 
573 		              		
574 		              			"CollisionR = " + String.valueOf(getCollisionR()
575  	) + " | " + 
576 		              		
577 		              			"CollisionH = " + String.valueOf(getCollisionH()
578  	) + " | " + 
579 		              		
580 		              			"TranslocZOffset = " + String.valueOf(getTranslocZOffset()
581  	) + " | " + 
582 		              		
583 		              			"TranslocTargetTag = " + String.valueOf(getTranslocTargetTag()
584  	) + " | " + 
585 		              		
586 		              			"OnlyTranslocator = " + String.valueOf(isOnlyTranslocator()
587  	) + " | " + 
588 		              		
589 		              			"ForceDoubleJump = " + String.valueOf(isForceDoubleJump()
590  	) + " | " + 
591 		              		
592 		              			"NeededJump = " + String.valueOf(getNeededJump()
593  	) + " | " + 
594 		              		
595 		              			"NeverImpactJump = " + String.valueOf(isNeverImpactJump()
596  	) + " | " + 
597 		              		
598 		              			"NoLowGrav = " + String.valueOf(isNoLowGrav()
599  	) + " | " + 
600 		              		
601 		              			"CalculatedGravityZ = " + String.valueOf(getCalculatedGravityZ()
602  	) + " | " + 
603 		              		
604 				"]";           		
605         }
606  	
607  		
608  		public String toHtmlString() {
609  			return super.toString() + "[<br/>" +
610             	
611 		              			"<b>Id</b> = " + String.valueOf(getId()
612  	) + " <br/> " + 
613 		              		
614 		              			"<b>Flags</b> = " + String.valueOf(getFlags()
615  	) + " <br/> " + 
616 		              		
617 		              			"<b>CollisionR</b> = " + String.valueOf(getCollisionR()
618  	) + " <br/> " + 
619 		              		
620 		              			"<b>CollisionH</b> = " + String.valueOf(getCollisionH()
621  	) + " <br/> " + 
622 		              		
623 		              			"<b>TranslocZOffset</b> = " + String.valueOf(getTranslocZOffset()
624  	) + " <br/> " + 
625 		              		
626 		              			"<b>TranslocTargetTag</b> = " + String.valueOf(getTranslocTargetTag()
627  	) + " <br/> " + 
628 		              		
629 		              			"<b>OnlyTranslocator</b> = " + String.valueOf(isOnlyTranslocator()
630  	) + " <br/> " + 
631 		              		
632 		              			"<b>ForceDoubleJump</b> = " + String.valueOf(isForceDoubleJump()
633  	) + " <br/> " + 
634 		              		
635 		              			"<b>NeededJump</b> = " + String.valueOf(getNeededJump()
636  	) + " <br/> " + 
637 		              		
638 		              			"<b>NeverImpactJump</b> = " + String.valueOf(isNeverImpactJump()
639  	) + " <br/> " + 
640 		              		
641 		              			"<b>NoLowGrav</b> = " + String.valueOf(isNoLowGrav()
642  	) + " <br/> " + 
643 		              		
644 		              			"<b>CalculatedGravityZ</b> = " + String.valueOf(getCalculatedGravityZ()
645  	) + " <br/> " + 
646 		              		
647 				"<br/>]";     
648 		}
649  	 
650  	    public String toJsonLiteral() {
651             return "NavPointNeighbourLink(null, "
652             		
653                    + ")";
654         }
655  	
656  		
657  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
658         	
659          	  
660          		    
661          	  
662             /**
663              * Use to fill missing fields of the Item when creating MapObtained event before
664              * INIT command is requested.
665              */ 
666             public NavPointNeighbourLink(
667               NavPointNeighbourLink orig, 
668               NavPoint from,
669               NavPoint to
670             ) {
671                 this(orig);
672                 this.FromNavPoint = from;
673                 this.ToNavPoint = to;
674             }   
675 		
676 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
677 		
678 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
679 	        
680 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
681  	
682 		}
683