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=base]+classtype[@name=message] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=base]+classtype[@name=message] END
15      
16   		/**
17           *  
18               				Implementation of the GameBots2004 message ATR contains also its Local/Shared/Static subpart class definitions..  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Contains the results of automatically
25  		casted rays. One ATR message is for one casted ray. New
26  		automatically casted rays can be defined by ADDRAY command and
27  		removed by REMOVERAY command.
28  	
29           */
30   	public class AutoTraceRayMessage   
31    				extends 
32    				AutoTraceRay
33    						implements IWorldObjectUpdatedEvent, ICompositeWorldObjectUpdatedEvent
34    						
35  	    {
36   	
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public AutoTraceRayMessage()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message AutoTraceRay.
51  		 * 
52  		Synchronous message. Contains the results of automatically
53  		casted rays. One ATR message is for one casted ray. New
54  		automatically casted rays can be defined by ADDRAY command and
55  		removed by REMOVERAY command.
56  	
57  		 * Corresponding GameBots message
58  		 *   
59  		 *   is
60  		 *   ATR.
61  		 * 
62   	  	 * 
63  		 *   
64  		 *     @param Id 
65  			An Id for this ray (should be unique), assigned by the user
66  			when adding ray.
67  		
68  		 *   
69  		 * 
70  		 *   
71  		 *     @param From 
72  			Location from which the ray is emitted.
73  		
74  		 *   
75  		 * 
76  		 *   
77  		 *     @param To 
78  			Location to which the ray is sent.
79  		
80  		 *   
81  		 * 
82  		 *   
83  		 *     @param FastTrace 
84  			True if it is a fast trace, false if not (fast trace is a
85  			bit faster version of UT2004 ray trace - but provides us
86  			with less information - just true/false if we hit something
87  			on the way or not).
88  		
89  		 *   
90  		 * 
91  		 *   
92  		 *     @param FloorCorrection 
93        If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
94  		
95  		 *   
96  		 * 
97  		 *   
98  		 *     @param Result 
99  			True if it hit something, false if not.
100 		
101 		 *   
102 		 * 
103 		 *   
104 		 *     @param HitNormal 
105 			Vector with normal of the plane we have hit (not sent if
106 			FastTrace is True).
107 		
108 		 *   
109 		 * 
110 		 *   
111 		 *     @param HitLocation 
112 			Vector with location of the collision (not sent if FastTrace
113 			is True).
114 		
115 		 *   
116 		 * 
117 		 *   
118 		 *     @param TraceActors 
119 			If we traced also actors with this ray (actors – moving
120 			things in a game – bots, players, monsters, pickup …) (only
121 			if NOT using FastTrace)
122 		
123 		 *   
124 		 * 
125 		 *   
126 		 *     @param HitId 
127 			Id of the actor we have hit. (Sent if FastTrace is False and
128 			TraceActors is True).
129 		
130 		 *   
131 		 * 
132 		 */
133 		public AutoTraceRayMessage(
134 			UnrealId Id,  Location From,  Location To,  boolean FastTrace,  boolean FloorCorrection,  boolean Result,  Vector3d HitNormal,  Location HitLocation,  boolean TraceActors,  UnrealId HitId
135 		) {
136 			
137 					this.Id = Id;
138 				
139 					this.From = From;
140 				
141 					this.To = To;
142 				
143 					this.FastTrace = FastTrace;
144 				
145 					this.FloorCorrection = FloorCorrection;
146 				
147 					this.Result = Result;
148 				
149 					this.HitNormal = HitNormal;
150 				
151 					this.HitLocation = HitLocation;
152 				
153 					this.TraceActors = TraceActors;
154 				
155 					this.HitId = HitId;
156 				
157 		}
158     
159 		/**
160 		 * Cloning constructor from the full message.
161 		 *
162 		 * @param original
163 		 */
164 		public AutoTraceRayMessage(AutoTraceRayMessage original) {		
165 			
166 					this.Id = original.getId()
167  	;
168 				
169 					this.From = original.getFrom()
170  	;
171 				
172 					this.To = original.getTo()
173  	;
174 				
175 					this.FastTrace = original.isFastTrace()
176  	;
177 				
178 					this.FloorCorrection = original.isFloorCorrection()
179  	;
180 				
181 					this.Result = original.isResult()
182  	;
183 				
184 					this.HitNormal = original.getHitNormal()
185  	;
186 				
187 					this.HitLocation = original.getHitLocation()
188  	;
189 				
190 					this.TraceActors = original.isTraceActors()
191  	;
192 				
193 					this.HitId = original.getHitId()
194  	;
195 				
196 				this.TeamId = original.getTeamId();
197 			
198 			this.SimTime = original.getSimTime();
199 		}
200 		
201     				
202     					protected ITeamId TeamId;
203     					
204     					/**
205     					 * Used by Yylex to slip corretn TeamId.
206     					 */
207     					protected void setTeamId(ITeamId TeamId) {
208     					    this.TeamId = TeamId;
209     					}
210     				
211     					public ITeamId getTeamId() {
212 							return TeamId;
213 						}
214     	
215     					
216     					
217     	
218 	    /**
219          * 
220 			An Id for this ray (should be unique), assigned by the user
221 			when adding ray.
222 		 
223          */
224         protected
225          UnrealId Id =
226        	null;
227 	
228     						
229     						/**
230 		 					 * Whether property 'Id' was received from GB2004.
231 		 					 */
232 							protected boolean Id_Set = false;
233 							
234     						@Override
235 		    				
236  		/**
237          * 
238 			An Id for this ray (should be unique), assigned by the user
239 			when adding ray.
240 		 
241          */
242         public  UnrealId getId()
243  	 {
244 		    					return Id;
245 		    				}
246 		    			
247     	
248 	    /**
249          * 
250 			Location from which the ray is emitted.
251 		 
252          */
253         protected
254          Location From =
255        	null;
256 	
257     						
258     						/**
259 		 					 * Whether property 'From' was received from GB2004.
260 		 					 */
261 							protected boolean From_Set = false;
262 							
263     						@Override
264 		    				
265  		/**
266          * 
267 			Location from which the ray is emitted.
268 		 
269          */
270         public  Location getFrom()
271  	 {
272 		    					return From;
273 		    				}
274 		    			
275     	
276 	    /**
277          * 
278 			Location to which the ray is sent.
279 		 
280          */
281         protected
282          Location To =
283        	null;
284 	
285     						
286     						/**
287 		 					 * Whether property 'To' was received from GB2004.
288 		 					 */
289 							protected boolean To_Set = false;
290 							
291     						@Override
292 		    				
293  		/**
294          * 
295 			Location to which the ray is sent.
296 		 
297          */
298         public  Location getTo()
299  	 {
300 		    					return To;
301 		    				}
302 		    			
303     	
304 	    /**
305          * 
306 			True if it is a fast trace, false if not (fast trace is a
307 			bit faster version of UT2004 ray trace - but provides us
308 			with less information - just true/false if we hit something
309 			on the way or not).
310 		 
311          */
312         protected
313          boolean FastTrace =
314        	false;
315 	
316     						
317     						/**
318 		 					 * Whether property 'FastTrace' was received from GB2004.
319 		 					 */
320 							protected boolean FastTrace_Set = false;
321 							
322     						@Override
323 		    				
324  		/**
325          * 
326 			True if it is a fast trace, false if not (fast trace is a
327 			bit faster version of UT2004 ray trace - but provides us
328 			with less information - just true/false if we hit something
329 			on the way or not).
330 		 
331          */
332         public  boolean isFastTrace()
333  	 {
334 		    					return FastTrace;
335 		    				}
336 		    			
337     	
338 	    /**
339          * 
340       If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
341 		 
342          */
343         protected
344          boolean FloorCorrection =
345        	false;
346 	
347     						
348     						/**
349 		 					 * Whether property 'FloorCorrection' was received from GB2004.
350 		 					 */
351 							protected boolean FloorCorrection_Set = false;
352 							
353     						@Override
354 		    				
355  		/**
356          * 
357       If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
358 		 
359          */
360         public  boolean isFloorCorrection()
361  	 {
362 		    					return FloorCorrection;
363 		    				}
364 		    			
365     	
366 	    /**
367          * 
368 			True if it hit something, false if not.
369 		 
370          */
371         protected
372          boolean Result =
373        	false;
374 	
375     						
376     						/**
377 		 					 * Whether property 'Result' was received from GB2004.
378 		 					 */
379 							protected boolean Result_Set = false;
380 							
381     						@Override
382 		    				
383  		/**
384          * 
385 			True if it hit something, false if not.
386 		 
387          */
388         public  boolean isResult()
389  	 {
390 		    					return Result;
391 		    				}
392 		    			
393     	
394 	    /**
395          * 
396 			Vector with normal of the plane we have hit (not sent if
397 			FastTrace is True).
398 		 
399          */
400         protected
401          Vector3d HitNormal =
402        	null;
403 	
404     						
405     						/**
406 		 					 * Whether property 'HitNormal' was received from GB2004.
407 		 					 */
408 							protected boolean HitNormal_Set = false;
409 							
410     						@Override
411 		    				
412  		/**
413          * 
414 			Vector with normal of the plane we have hit (not sent if
415 			FastTrace is True).
416 		 
417          */
418         public  Vector3d getHitNormal()
419  	 {
420 		    					return HitNormal;
421 		    				}
422 		    			
423     	
424 	    /**
425          * 
426 			Vector with location of the collision (not sent if FastTrace
427 			is True).
428 		 
429          */
430         protected
431          Location HitLocation =
432        	null;
433 	
434     						
435     						/**
436 		 					 * Whether property 'HitLocation' was received from GB2004.
437 		 					 */
438 							protected boolean HitLocation_Set = false;
439 							
440     						@Override
441 		    				
442  		/**
443          * 
444 			Vector with location of the collision (not sent if FastTrace
445 			is True).
446 		 
447          */
448         public  Location getHitLocation()
449  	 {
450 		    					return HitLocation;
451 		    				}
452 		    			
453     	
454 	    /**
455          * 
456 			If we traced also actors with this ray (actors – moving
457 			things in a game – bots, players, monsters, pickup …) (only
458 			if NOT using FastTrace)
459 		 
460          */
461         protected
462          boolean TraceActors =
463        	false;
464 	
465     						
466     						/**
467 		 					 * Whether property 'TraceActors' was received from GB2004.
468 		 					 */
469 							protected boolean TraceActors_Set = false;
470 							
471     						@Override
472 		    				
473  		/**
474          * 
475 			If we traced also actors with this ray (actors – moving
476 			things in a game – bots, players, monsters, pickup …) (only
477 			if NOT using FastTrace)
478 		 
479          */
480         public  boolean isTraceActors()
481  	 {
482 		    					return TraceActors;
483 		    				}
484 		    			
485     	
486 	    /**
487          * 
488 			Id of the actor we have hit. (Sent if FastTrace is False and
489 			TraceActors is True).
490 		 
491          */
492         protected
493          UnrealId HitId =
494        	null;
495 	
496     						
497     						/**
498 		 					 * Whether property 'HitId' was received from GB2004.
499 		 					 */
500 							protected boolean HitId_Set = false;
501 							
502     						@Override
503 		    				
504  		/**
505          * 
506 			Id of the actor we have hit. (Sent if FastTrace is False and
507 			TraceActors is True).
508 		 
509          */
510         public  UnrealId getHitId()
511  	 {
512 		    					return HitId;
513 		    				}
514 		    			
515 		    			
516 		    			private AutoTraceRayLocal localPart = null;
517 		    			
518 		    			@Override
519 						public AutoTraceRayLocal 
520 						getLocal() {
521 							if (localPart != null) return localPart;
522 							return localPart = new 
523 								AutoTraceRayLocalMessage();
524 						}
525 					
526 						private AutoTraceRayShared sharedPart = null;
527 					
528 						@Override
529 						public AutoTraceRayShared 
530 						getShared() {
531 							if (sharedPart != null) return sharedPart;							
532 							return sharedPart = new 
533 								AutoTraceRaySharedMessage();
534 						}
535 					
536 						private AutoTraceRayStatic staticPart = null; 
537 					
538 						@Override
539 						public AutoTraceRayStatic 
540 						getStatic() {
541 							if (staticPart != null) return staticPart;
542 							return staticPart = new 
543 								AutoTraceRayStaticMessage();
544 						}
545     				
546  		/**
547          *  
548             				Implementation of the local part of the GameBots2004 message ATR, used
549             				to facade ATRMessage.  
550             			
551          *
552          *  <p></p><p></p>
553          *  Complete message documentation:               
554          *  
555 		Synchronous message. Contains the results of automatically
556 		casted rays. One ATR message is for one casted ray. New
557 		automatically casted rays can be defined by ADDRAY command and
558 		removed by REMOVERAY command.
559 	
560          */
561  	public class AutoTraceRayLocalMessage 
562 	  					extends
563   						AutoTraceRayLocal
564 	    {
565  	
566 		    			@Override
567 		    			public 
568 		    			AutoTraceRayLocalMessage clone() {
569 		    				return this;
570 		    			}
571 		    			
572 		    				public AutoTraceRayLocalMessage getLocal() {
573 								return this;
574 					    	}
575 							public ISharedWorldObject getShared() {
576 							 	throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
577 							}
578 							public IStaticWorldObject getStatic() {
579 							    throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
580 							}
581 		    			
582  		/**
583          * 
584 			An Id for this ray (should be unique), assigned by the user
585 			when adding ray.
586 		 
587          */
588         public  UnrealId getId()
589  	 {
590 				    					return Id;
591 				    				}
592 				    			
593  		/**
594          * 
595 			Location from which the ray is emitted.
596 		 
597          */
598         public  Location getFrom()
599  	 {
600 				    					return From;
601 				    				}
602 				    			
603  		/**
604          * 
605 			Location to which the ray is sent.
606 		 
607          */
608         public  Location getTo()
609  	 {
610 				    					return To;
611 				    				}
612 				    			
613  		/**
614          * 
615 			True if it is a fast trace, false if not (fast trace is a
616 			bit faster version of UT2004 ray trace - but provides us
617 			with less information - just true/false if we hit something
618 			on the way or not).
619 		 
620          */
621         public  boolean isFastTrace()
622  	 {
623 				    					return FastTrace;
624 				    				}
625 				    			
626  		/**
627          * 
628       If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.
629 		 
630          */
631         public  boolean isFloorCorrection()
632  	 {
633 				    					return FloorCorrection;
634 				    				}
635 				    			
636  		/**
637          * 
638 			True if it hit something, false if not.
639 		 
640          */
641         public  boolean isResult()
642  	 {
643 				    					return Result;
644 				    				}
645 				    			
646  		/**
647          * 
648 			Vector with normal of the plane we have hit (not sent if
649 			FastTrace is True).
650 		 
651          */
652         public  Vector3d getHitNormal()
653  	 {
654 				    					return HitNormal;
655 				    				}
656 				    			
657  		/**
658          * 
659 			Vector with location of the collision (not sent if FastTrace
660 			is True).
661 		 
662          */
663         public  Location getHitLocation()
664  	 {
665 				    					return HitLocation;
666 				    				}
667 				    			
668  		/**
669          * 
670 			If we traced also actors with this ray (actors – moving
671 			things in a game – bots, players, monsters, pickup …) (only
672 			if NOT using FastTrace)
673 		 
674          */
675         public  boolean isTraceActors()
676  	 {
677 				    					return TraceActors;
678 				    				}
679 				    			
680  		/**
681          * 
682 			Id of the actor we have hit. (Sent if FastTrace is False and
683 			TraceActors is True).
684 		 
685          */
686         public  UnrealId getHitId()
687  	 {
688 				    					return HitId;
689 				    				}
690 				    			
691  		
692  	    public String toString() {
693             return
694             	super.toString() + "[" +
695             	
696 		              			"Id = " + String.valueOf(getId()
697  	) + " | " + 
698 		              		
699 		              			"From = " + String.valueOf(getFrom()
700  	) + " | " + 
701 		              		
702 		              			"To = " + String.valueOf(getTo()
703  	) + " | " + 
704 		              		
705 		              			"FastTrace = " + String.valueOf(isFastTrace()
706  	) + " | " + 
707 		              		
708 		              			"FloorCorrection = " + String.valueOf(isFloorCorrection()
709  	) + " | " + 
710 		              		
711 		              			"Result = " + String.valueOf(isResult()
712  	) + " | " + 
713 		              		
714 		              			"HitNormal = " + String.valueOf(getHitNormal()
715  	) + " | " + 
716 		              		
717 		              			"HitLocation = " + String.valueOf(getHitLocation()
718  	) + " | " + 
719 		              		
720 		              			"TraceActors = " + String.valueOf(isTraceActors()
721  	) + " | " + 
722 		              		
723 		              			"HitId = " + String.valueOf(getHitId()
724  	) + " | " + 
725 		              		
726 				"]";           		
727         }
728  	
729  		
730  		public String toHtmlString() {
731  			return super.toString() + "[<br/>" +
732             	
733 		              			"<b>Id</b> = " + String.valueOf(getId()
734  	) + " <br/> " + 
735 		              		
736 		              			"<b>From</b> = " + String.valueOf(getFrom()
737  	) + " <br/> " + 
738 		              		
739 		              			"<b>To</b> = " + String.valueOf(getTo()
740  	) + " <br/> " + 
741 		              		
742 		              			"<b>FastTrace</b> = " + String.valueOf(isFastTrace()
743  	) + " <br/> " + 
744 		              		
745 		              			"<b>FloorCorrection</b> = " + String.valueOf(isFloorCorrection()
746  	) + " <br/> " + 
747 		              		
748 		              			"<b>Result</b> = " + String.valueOf(isResult()
749  	) + " <br/> " + 
750 		              		
751 		              			"<b>HitNormal</b> = " + String.valueOf(getHitNormal()
752  	) + " <br/> " + 
753 		              		
754 		              			"<b>HitLocation</b> = " + String.valueOf(getHitLocation()
755  	) + " <br/> " + 
756 		              		
757 		              			"<b>TraceActors</b> = " + String.valueOf(isTraceActors()
758  	) + " <br/> " + 
759 		              		
760 		              			"<b>HitId</b> = " + String.valueOf(getHitId()
761  	) + " <br/> " + 
762 		              		
763 				"<br/>]";     
764 		}
765  	
766  		
767  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
768         	
769 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
770 		
771 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=local+classtype[@name=message]) ---
772 	        
773 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=local+classtype[@name=message]) ---        	            	
774  	
775 		}
776  	
777  		/**
778          *  
779             				Implementation of the static part of the GameBots2004 message ATR, used
780             				to facade ATRMessage.  
781             			
782          *
783          *  <p></p><p></p>
784          *  Complete message documentation:               
785          *  
786 		Synchronous message. Contains the results of automatically
787 		casted rays. One ATR message is for one casted ray. New
788 		automatically casted rays can be defined by ADDRAY command and
789 		removed by REMOVERAY command.
790 	
791          */
792  	public class AutoTraceRayStaticMessage 
793 	  					extends
794   						AutoTraceRayStatic
795 	    {
796  	
797 		    			@Override
798 		    			public 
799 		    			AutoTraceRayStaticMessage clone() {
800 		    				return this;
801 		    			}
802 		    			
803  		/**
804          * 
805 			An Id for this ray (should be unique), assigned by the user
806 			when adding ray.
807 		 
808          */
809         public  UnrealId getId()
810  	 {
811 				    					return Id;
812 				    				}
813 				    			
814  		
815  		@Override
816  		public boolean isDifferentFrom(IStaticWorldObject other)
817  		{
818  			if (other == null) //early fail
819  			{
820  				return true;
821  			}
822  			else if (other == this) //early out
823  			{
824  				return false;
825  			}
826  			else
827  			{
828  				AutoTraceRayStatic obj = (AutoTraceRayStatic) other;
829 
830  				
831  						if ( !(
832  	 			AdvancedEquals.equalsOrNull(this.getId()
833  	, obj.getId()
834  	)
835  	 		) )
836 						{
837 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class AutoTraceRayStatic");
838 							return true;
839 						}
840  					
841  			}
842  			return false;
843  		}
844  	 
845  		
846  	    public String toString() {
847             return
848             	super.toString() + "[" +
849             	
850 		              			"Id = " + String.valueOf(getId()
851  	) + " | " + 
852 		              		
853 				"]";           		
854         }
855  	
856  		
857  		public String toHtmlString() {
858  			return super.toString() + "[<br/>" +
859             	
860 		              			"<b>Id</b> = " + String.valueOf(getId()
861  	) + " <br/> " + 
862 		              		
863 				"<br/>]";     
864 		}
865  	
866  		
867  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
868         	
869 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
870 		
871 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=message]) ---
872 	        
873 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=message]) ---        	            	
874  	
875 		}
876  	
877  		/**
878          *  
879             				Implementation of the shared part of the GameBots2004 message ATR, used
880             				to facade ATRMessage.  
881             			
882          *
883          *  <p></p><p></p>
884          *  Complete message documentation:               
885          *  
886 		Synchronous message. Contains the results of automatically
887 		casted rays. One ATR message is for one casted ray. New
888 		automatically casted rays can be defined by ADDRAY command and
889 		removed by REMOVERAY command.
890 	
891          */
892  	public class AutoTraceRaySharedMessage 
893 	  					extends
894   						AutoTraceRayShared
895 	    {
896  	
897     	
898     	
899 		public AutoTraceRaySharedMessage()
900 		{
901 			
902 		}		
903     
904 		    			@Override
905 		    			public 
906 		    			AutoTraceRaySharedMessage clone() {
907 		    				return this;
908 		    			}
909 		    			
910 		
911 		
912 		
913 		protected HashMap<PropertyId, ISharedProperty> propertyMap = new HashMap<PropertyId, ISharedProperty>(
914 			0
915 		);
916 		
917 		@Override
918 		public ISharedProperty getProperty(PropertyId id) {
919 			return propertyMap.get(id);
920 		}
921 
922 		@Override
923 		public Map<PropertyId, ISharedProperty> getProperties() {
924 			return propertyMap;
925 		}
926 	
927 		
928 		
929  		/**
930          * 
931 			An Id for this ray (should be unique), assigned by the user
932 			when adding ray.
933 		 
934          */
935         public  UnrealId getId()
936  	 {
937   			return Id;
938   		}
939   		
940  		
941  	    public String toString() {
942             return
943             	super.toString() + "[" +
944             	
945 		              			"Id = " + String.valueOf(getId()
946  	) + " | " + 
947 		              		
948 				"]";           		
949         }
950  	
951  		
952  		public String toHtmlString() {
953  			return super.toString() + "[<br/>" +
954             	
955 		              			"<b>Id</b> = " + String.valueOf(getId()
956  	) + " <br/> " + 
957 		              		
958 				"<br/>]";     
959 		}
960  	
961  		
962  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
963         	
964 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
965 		
966 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=message]) ---
967 	        
968 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=message]) ---        	            	
969  	
970 		}
971  	
972     	
973     	
974  	
975 		@Override
976 		public IWorldObjectUpdateResult<IWorldObject> update(IWorldObject object) {
977 			if (object == null)
978 			{
979 				return new IWorldObjectUpdateResult.WorldObjectUpdateResult(IWorldObjectUpdateResult.Result.CREATED, this);
980 			}
981 			if (!( object instanceof AutoTraceRayMessage) ) {
982 				throw new PogamutException("Can't update different class than AutoTraceRayMessage, got class " + object.getClass().getSimpleName() + "!", this);		
983 			}
984 			AutoTraceRayMessage toUpdate = (AutoTraceRayMessage)object;
985 			
986 			boolean updated = false;
987 			
988 			// UPDATING LOCAL PROPERTIES
989 			
990 	            if (!SafeEquals.equals(toUpdate.From, getFrom()
991  	)) {
992 					toUpdate.From=getFrom()
993  	;
994 					updated = true;
995 				}
996 			
997 	            if (!SafeEquals.equals(toUpdate.To, getTo()
998  	)) {
999 					toUpdate.To=getTo()
1000  	;
1001 					updated = true;
1002 				}
1003 			
1004 				if (toUpdate.FastTrace != isFastTrace()
1005  	) {
1006 				    toUpdate.FastTrace=isFastTrace()
1007  	;
1008 					updated = true;
1009 				}
1010 			
1011 				if (toUpdate.FloorCorrection != isFloorCorrection()
1012  	) {
1013 				    toUpdate.FloorCorrection=isFloorCorrection()
1014  	;
1015 					updated = true;
1016 				}
1017 			
1018 				if (toUpdate.Result != isResult()
1019  	) {
1020 				    toUpdate.Result=isResult()
1021  	;
1022 					updated = true;
1023 				}
1024 			
1025 				if (!SafeEquals.equals(toUpdate.HitNormal, getHitNormal()
1026  	)) {
1027 					toUpdate.HitNormal=getHitNormal()
1028  	;
1029 					updated = true;
1030 				}
1031 			
1032 	            if (!SafeEquals.equals(toUpdate.HitLocation, getHitLocation()
1033  	)) {
1034 					toUpdate.HitLocation=getHitLocation()
1035  	;
1036 					updated = true;
1037 				}
1038 			
1039 				if (toUpdate.TraceActors != isTraceActors()
1040  	) {
1041 				    toUpdate.TraceActors=isTraceActors()
1042  	;
1043 					updated = true;
1044 				}
1045 			
1046 				if (!SafeEquals.equals(toUpdate.HitId, getHitId()
1047  	)) {
1048 					toUpdate.HitId=getHitId()
1049  	;
1050 					updated = true;
1051 				}
1052 			
1053          	
1054          	// UPDATING SHARED PROPERTIES
1055          	
1056          	
1057          	// UPDATE TIME
1058          	toUpdate.SimTime = SimTime;
1059 			
1060 			if (updated) {
1061 				return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, toUpdate);
1062 			} else {
1063 				return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IWorldObject>(IWorldObjectUpdateResult.Result.SAME, toUpdate);
1064 			}
1065 		}
1066 		
1067 		@Override
1068 		public ILocalWorldObjectUpdatedEvent getLocalEvent() {
1069 			return new AutoTraceRayLocalImpl.AutoTraceRayLocalUpdate
1070     (this.getLocal(), SimTime);
1071 		}
1072 
1073 		@Override
1074 		public ISharedWorldObjectUpdatedEvent getSharedEvent() {
1075 			return new AutoTraceRaySharedImpl.AutoTraceRaySharedUpdate
1076     (this.getShared(), SimTime, this.getTeamId());
1077 		}
1078 
1079 		@Override
1080 		public IStaticWorldObjectUpdatedEvent getStaticEvent() {
1081 			return new AutoTraceRayStaticImpl.AutoTraceRayStaticUpdate
1082     (this.getStatic(), SimTime);
1083 		}
1084  	
1085  		
1086  	    public String toString() {
1087             return
1088             	super.toString() + "[" +
1089             	
1090 		              			"Id = " + String.valueOf(getId()
1091  	) + " | " + 
1092 		              		
1093 		              			"From = " + String.valueOf(getFrom()
1094  	) + " | " + 
1095 		              		
1096 		              			"To = " + String.valueOf(getTo()
1097  	) + " | " + 
1098 		              		
1099 		              			"FastTrace = " + String.valueOf(isFastTrace()
1100  	) + " | " + 
1101 		              		
1102 		              			"FloorCorrection = " + String.valueOf(isFloorCorrection()
1103  	) + " | " + 
1104 		              		
1105 		              			"Result = " + String.valueOf(isResult()
1106  	) + " | " + 
1107 		              		
1108 		              			"HitNormal = " + String.valueOf(getHitNormal()
1109  	) + " | " + 
1110 		              		
1111 		              			"HitLocation = " + String.valueOf(getHitLocation()
1112  	) + " | " + 
1113 		              		
1114 		              			"TraceActors = " + String.valueOf(isTraceActors()
1115  	) + " | " + 
1116 		              		
1117 		              			"HitId = " + String.valueOf(getHitId()
1118  	) + " | " + 
1119 		              		
1120 				"]";           		
1121         }
1122  	
1123  		
1124  		public String toHtmlString() {
1125  			return super.toString() + "[<br/>" +
1126             	
1127 		              			"<b>Id</b> = " + String.valueOf(getId()
1128  	) + " <br/> " + 
1129 		              		
1130 		              			"<b>From</b> = " + String.valueOf(getFrom()
1131  	) + " <br/> " + 
1132 		              		
1133 		              			"<b>To</b> = " + String.valueOf(getTo()
1134  	) + " <br/> " + 
1135 		              		
1136 		              			"<b>FastTrace</b> = " + String.valueOf(isFastTrace()
1137  	) + " <br/> " + 
1138 		              		
1139 		              			"<b>FloorCorrection</b> = " + String.valueOf(isFloorCorrection()
1140  	) + " <br/> " + 
1141 		              		
1142 		              			"<b>Result</b> = " + String.valueOf(isResult()
1143  	) + " <br/> " + 
1144 		              		
1145 		              			"<b>HitNormal</b> = " + String.valueOf(getHitNormal()
1146  	) + " <br/> " + 
1147 		              		
1148 		              			"<b>HitLocation</b> = " + String.valueOf(getHitLocation()
1149  	) + " <br/> " + 
1150 		              		
1151 		              			"<b>TraceActors</b> = " + String.valueOf(isTraceActors()
1152  	) + " <br/> " + 
1153 		              		
1154 		              			"<b>HitId</b> = " + String.valueOf(getHitId()
1155  	) + " <br/> " + 
1156 		              		
1157 				"<br/>]";     
1158 		}
1159  	
1160  		
1161  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1162         	
1163 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1164 		
1165 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=base+classtype[@name=message]) ---
1166 	        
1167 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=base+classtype[@name=message]) ---        	            	
1168  	
1169 		}
1170