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 VEH contains also its Local/Shared/Static subpart class definitions..  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Holds vehicles we see. Id for vehicles doesn't work, so 
25  		this message is without Id. We can join vehicles by ENTER command if we are 
26  		close enough - ussually 100 ut units or less. Note: Vehicle support is 
27  		in aplha testing right now.
28  	
29           */
30   	public class VehicleMessage   
31    				extends 
32    				Vehicle
33    						implements IWorldObjectUpdatedEvent, ICompositeWorldObjectUpdatedEvent
34    						
35  	    {
36   	
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public VehicleMessage()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message Vehicle.
51  		 * 
52  		Synchronous message. Holds vehicles we see. Id for vehicles doesn't work, so 
53  		this message is without Id. We can join vehicles by ENTER command if we are 
54  		close enough - ussually 100 ut units or less. Note: Vehicle support is 
55  		in aplha testing right now.
56  	
57  		 * Corresponding GameBots message
58  		 *   
59  		 *   is
60  		 *   VEH.
61  		 * 
62   	  	 * 
63  		 *   
64  		 *     @param Id Unique Id of the vehicle or vehicle part.
65  		 *   
66  		 * 
67  		 *   
68  		 *     @param Rotation 
69  			Which direction the vehicle is facing in absolute terms.
70  		
71  		 *   
72  		 * 
73  		 *   
74  		 *     @param Location 
75  			An absolute location of the vehicle within the map.
76  		
77  		 *   
78  		 * 
79  		 *   
80  		 *     @param Velocity 
81  			Absolute velocity of the vehicle as a vector of movement per one
82  			game second.
83  		
84  		 *   
85  		 * 
86  		 *   
87  		 *     @param Visible 
88              If the vehicle is in the field of view of the bot.
89          
90  		 *   
91  		 * 
92  		 *   
93  		 *     @param Team 
94  			What team the vehicle is on. 255 is no team. 0-3 are red,
95  			blue, green, gold in that order.
96  		
97  		 *   
98  		 * 
99  		 *   
100 		 *     @param Health 
101 			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
102 		
103 		 *   
104 		 * 
105 		 *   
106 		 *     @param Armor 
107 			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
108 		
109 		 *   
110 		 * 
111 		 *   
112 		 *     @param Driver Unique Id of the driver - if any.
113 		 *   
114 		 * 
115 		 *   
116 		 *     @param TeamLocked 
117             If the vehicle is locked just for its current team.
118         
119 		 *   
120 		 * 
121 		 *   
122 		 *     @param Type 
123 			Class of the vehicle. If it is a car, turret etc.
124 		
125 		 *   
126 		 * 
127 		 */
128 		public VehicleMessage(
129 			UnrealId Id,  Rotation Rotation,  Location Location,  Velocity Velocity,  boolean Visible,  Integer Team,  Integer Health,  Integer Armor,  UnrealId Driver,  boolean TeamLocked,  String Type
130 		) {
131 			
132 					this.Id = Id;
133 				
134 					this.Rotation = Rotation;
135 				
136 					this.Location = Location;
137 				
138 					this.Velocity = Velocity;
139 				
140 					this.Visible = Visible;
141 				
142 					this.Team = Team;
143 				
144 					this.Health = Health;
145 				
146 					this.Armor = Armor;
147 				
148 					this.Driver = Driver;
149 				
150 					this.TeamLocked = TeamLocked;
151 				
152 					this.Type = Type;
153 				
154 		}
155     
156 		/**
157 		 * Cloning constructor from the full message.
158 		 *
159 		 * @param original
160 		 */
161 		public VehicleMessage(VehicleMessage original) {		
162 			
163 					this.Id = original.getId()
164  	;
165 				
166 					this.Rotation = original.getRotation()
167  	;
168 				
169 					this.Location = original.getLocation()
170  	;
171 				
172 					this.Velocity = original.getVelocity()
173  	;
174 				
175 					this.Visible = original.isVisible()
176  	;
177 				
178 					this.Team = original.getTeam()
179  	;
180 				
181 					this.Health = original.getHealth()
182  	;
183 				
184 					this.Armor = original.getArmor()
185  	;
186 				
187 					this.Driver = original.getDriver()
188  	;
189 				
190 					this.TeamLocked = original.isTeamLocked()
191  	;
192 				
193 					this.Type = original.getType()
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          * Unique Id of the vehicle or vehicle part. 
220          */
221         protected
222          UnrealId Id =
223        	null;
224 	
225     						
226     						/**
227 		 					 * Whether property 'Id' was received from GB2004.
228 		 					 */
229 							protected boolean Id_Set = false;
230 							
231     						@Override
232 		    				
233  		/**
234          * Unique Id of the vehicle or vehicle part. 
235          */
236         public  UnrealId getId()
237  	 {
238 		    					return Id;
239 		    				}
240 		    			
241     	
242 	    /**
243          * 
244 			Which direction the vehicle is facing in absolute terms.
245 		 
246          */
247         protected
248          Rotation Rotation =
249        	null;
250 	
251     						
252     						/**
253 		 					 * Whether property 'Rotation' was received from GB2004.
254 		 					 */
255 							protected boolean Rotation_Set = false;
256 							
257     						@Override
258 		    				
259  		/**
260          * 
261 			Which direction the vehicle is facing in absolute terms.
262 		 
263          */
264         public  Rotation getRotation()
265  	 {
266 		    					return Rotation;
267 		    				}
268 		    			
269     	
270 	    /**
271          * 
272 			An absolute location of the vehicle within the map.
273 		 
274          */
275         protected
276          Location Location =
277        	null;
278 	
279     						
280     						/**
281 		 					 * Whether property 'Location' was received from GB2004.
282 		 					 */
283 							protected boolean Location_Set = false;
284 							
285     						@Override
286 		    				
287  		/**
288          * 
289 			An absolute location of the vehicle within the map.
290 		 
291          */
292         public  Location getLocation()
293  	 {
294 		    					return Location;
295 		    				}
296 		    			
297     	
298 	    /**
299          * 
300 			Absolute velocity of the vehicle as a vector of movement per one
301 			game second.
302 		 
303          */
304         protected
305          Velocity Velocity =
306        	null;
307 	
308     						
309     						/**
310 		 					 * Whether property 'Velocity' was received from GB2004.
311 		 					 */
312 							protected boolean Velocity_Set = false;
313 							
314     						@Override
315 		    				
316  		/**
317          * 
318 			Absolute velocity of the vehicle as a vector of movement per one
319 			game second.
320 		 
321          */
322         public  Velocity getVelocity()
323  	 {
324 		    					return Velocity;
325 		    				}
326 		    			
327     	
328 	    /**
329          * 
330             If the vehicle is in the field of view of the bot.
331          
332          */
333         protected
334          boolean Visible =
335        	false;
336 	
337     						
338     						/**
339 		 					 * Whether property 'Visible' was received from GB2004.
340 		 					 */
341 							protected boolean Visible_Set = false;
342 							
343     						@Override
344 		    				
345  		/**
346          * 
347             If the vehicle is in the field of view of the bot.
348          
349          */
350         public  boolean isVisible()
351  	 {
352 		    					return Visible;
353 		    				}
354 		    			
355     	
356 	    /**
357          * 
358 			What team the vehicle is on. 255 is no team. 0-3 are red,
359 			blue, green, gold in that order.
360 		 
361          */
362         protected
363          Integer Team =
364        	255;
365 	
366     						
367     						/**
368 		 					 * Whether property 'Team' was received from GB2004.
369 		 					 */
370 							protected boolean Team_Set = false;
371 							
372     						@Override
373 		    				
374  		/**
375          * 
376 			What team the vehicle is on. 255 is no team. 0-3 are red,
377 			blue, green, gold in that order.
378 		 
379          */
380         public  Integer getTeam()
381  	 {
382 		    					return Team;
383 		    				}
384 		    			
385     	
386 	    /**
387          * 
388 			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
389 		 
390          */
391         protected
392          Integer Health =
393        	0;
394 	
395     						
396     						/**
397 		 					 * Whether property 'Health' was received from GB2004.
398 		 					 */
399 							protected boolean Health_Set = false;
400 							
401     						@Override
402 		    				
403  		/**
404          * 
405 			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
406 		 
407          */
408         public  Integer getHealth()
409  	 {
410 		    					return Health;
411 		    				}
412 		    			
413     	
414 	    /**
415          * 
416 			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
417 		 
418          */
419         protected
420          Integer Armor =
421        	0;
422 	
423     						
424     						/**
425 		 					 * Whether property 'Armor' was received from GB2004.
426 		 					 */
427 							protected boolean Armor_Set = false;
428 							
429     						@Override
430 		    				
431  		/**
432          * 
433 			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
434 		 
435          */
436         public  Integer getArmor()
437  	 {
438 		    					return Armor;
439 		    				}
440 		    			
441     	
442 	    /**
443          * Unique Id of the driver - if any. 
444          */
445         protected
446          UnrealId Driver =
447        	null;
448 	
449     						
450     						/**
451 		 					 * Whether property 'Driver' was received from GB2004.
452 		 					 */
453 							protected boolean Driver_Set = false;
454 							
455     						@Override
456 		    				
457  		/**
458          * Unique Id of the driver - if any. 
459          */
460         public  UnrealId getDriver()
461  	 {
462 		    					return Driver;
463 		    				}
464 		    			
465     	
466 	    /**
467          * 
468             If the vehicle is locked just for its current team.
469          
470          */
471         protected
472          boolean TeamLocked =
473        	false;
474 	
475     						
476     						/**
477 		 					 * Whether property 'TeamLocked' was received from GB2004.
478 		 					 */
479 							protected boolean TeamLocked_Set = false;
480 							
481     						@Override
482 		    				
483  		/**
484          * 
485             If the vehicle is locked just for its current team.
486          
487          */
488         public  boolean isTeamLocked()
489  	 {
490 		    					return TeamLocked;
491 		    				}
492 		    			
493     	
494 	    /**
495          * 
496 			Class of the vehicle. If it is a car, turret etc.
497 		 
498          */
499         protected
500          String Type =
501        	null;
502 	
503     						
504     						/**
505 		 					 * Whether property 'Type' was received from GB2004.
506 		 					 */
507 							protected boolean Type_Set = false;
508 							
509     						@Override
510 		    				
511  		/**
512          * 
513 			Class of the vehicle. If it is a car, turret etc.
514 		 
515          */
516         public  String getType()
517  	 {
518 		    					return Type;
519 		    				}
520 		    			
521 		    			
522 		    			private VehicleLocal localPart = null;
523 		    			
524 		    			@Override
525 						public VehicleLocal 
526 						getLocal() {
527 							if (localPart != null) return localPart;
528 							return localPart = new 
529 								VehicleLocalMessage();
530 						}
531 					
532 						private VehicleShared sharedPart = null;
533 					
534 						@Override
535 						public VehicleShared 
536 						getShared() {
537 							if (sharedPart != null) return sharedPart;							
538 							return sharedPart = new 
539 								VehicleSharedMessage();
540 						}
541 					
542 						private VehicleStatic staticPart = null; 
543 					
544 						@Override
545 						public VehicleStatic 
546 						getStatic() {
547 							if (staticPart != null) return staticPart;
548 							return staticPart = new 
549 								VehicleStaticMessage();
550 						}
551     				
552  		/**
553          *  
554             				Implementation of the local part of the GameBots2004 message VEH, used
555             				to facade VEHMessage.  
556             			
557          *
558          *  <p></p><p></p>
559          *  Complete message documentation:               
560          *  
561 		Synchronous message. Holds vehicles we see. Id for vehicles doesn't work, so 
562 		this message is without Id. We can join vehicles by ENTER command if we are 
563 		close enough - ussually 100 ut units or less. Note: Vehicle support is 
564 		in aplha testing right now.
565 	
566          */
567  	public class VehicleLocalMessage 
568 	  					extends
569   						VehicleLocal
570 	    {
571  	
572 		    			@Override
573 		    			public 
574 		    			VehicleLocalMessage clone() {
575 		    				return this;
576 		    			}
577 		    			
578 		    				public VehicleLocalMessage getLocal() {
579 								return this;
580 					    	}
581 							public ISharedWorldObject getShared() {
582 							 	throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
583 							}
584 							public IStaticWorldObject getStatic() {
585 							    throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
586 							}
587 		    			
588  		/**
589          * Unique Id of the vehicle or vehicle part. 
590          */
591         public  UnrealId getId()
592  	 {
593 				    					return Id;
594 				    				}
595 				    			
596  		/**
597          * 
598             If the vehicle is in the field of view of the bot.
599          
600          */
601         public  boolean isVisible()
602  	 {
603 				    					return Visible;
604 				    				}
605 				    			
606  		
607  	    public String toString() {
608             return
609             	super.toString() + "[" +
610             	
611 		              			"Id = " + String.valueOf(getId()
612  	) + " | " + 
613 		              		
614 		              			"Visible = " + String.valueOf(isVisible()
615  	) + " | " + 
616 		              		
617 				"]";           		
618         }
619  	
620  		
621  		public String toHtmlString() {
622  			return super.toString() + "[<br/>" +
623             	
624 		              			"<b>Id</b> = " + String.valueOf(getId()
625  	) + " <br/> " + 
626 		              		
627 		              			"<b>Visible</b> = " + String.valueOf(isVisible()
628  	) + " <br/> " + 
629 		              		
630 				"<br/>]";     
631 		}
632  	
633  		
634  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
635         	
636 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
637 		
638 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=local+classtype[@name=message]) ---
639 	        
640 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=local+classtype[@name=message]) ---        	            	
641  	
642 		}
643  	
644  		/**
645          *  
646             				Implementation of the static part of the GameBots2004 message VEH, used
647             				to facade VEHMessage.  
648             			
649          *
650          *  <p></p><p></p>
651          *  Complete message documentation:               
652          *  
653 		Synchronous message. Holds vehicles we see. Id for vehicles doesn't work, so 
654 		this message is without Id. We can join vehicles by ENTER command if we are 
655 		close enough - ussually 100 ut units or less. Note: Vehicle support is 
656 		in aplha testing right now.
657 	
658          */
659  	public class VehicleStaticMessage 
660 	  					extends
661   						VehicleStatic
662 	    {
663  	
664 		    			@Override
665 		    			public 
666 		    			VehicleStaticMessage clone() {
667 		    				return this;
668 		    			}
669 		    			
670  		/**
671          * Unique Id of the vehicle or vehicle part. 
672          */
673         public  UnrealId getId()
674  	 {
675 				    					return Id;
676 				    				}
677 				    			
678  		/**
679          * 
680 			Class of the vehicle. If it is a car, turret etc.
681 		 
682          */
683         public  String getType()
684  	 {
685 				    					return Type;
686 				    				}
687 				    			
688  		
689  		@Override
690  		public boolean isDifferentFrom(IStaticWorldObject other)
691  		{
692  			if (other == null) //early fail
693  			{
694  				return true;
695  			}
696  			else if (other == this) //early out
697  			{
698  				return false;
699  			}
700  			else
701  			{
702  				VehicleStatic obj = (VehicleStatic) other;
703 
704  				
705  						if ( !(
706  	 			AdvancedEquals.equalsOrNull(this.getId()
707  	, obj.getId()
708  	)
709  	 		) )
710 						{
711 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class VehicleStatic");
712 							return true;
713 						}
714  					
715  						if ( !(
716  	 			AdvancedEquals.equalsOrNull(this.getType()
717  	, obj.getType()
718  	)
719  	 		) )
720 						{
721 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Type on object class VehicleStatic");
722 							return true;
723 						}
724  					
725  			}
726  			return false;
727  		}
728  	 
729  		
730  	    public String toString() {
731             return
732             	super.toString() + "[" +
733             	
734 		              			"Id = " + String.valueOf(getId()
735  	) + " | " + 
736 		              		
737 		              			"Type = " + String.valueOf(getType()
738  	) + " | " + 
739 		              		
740 				"]";           		
741         }
742  	
743  		
744  		public String toHtmlString() {
745  			return super.toString() + "[<br/>" +
746             	
747 		              			"<b>Id</b> = " + String.valueOf(getId()
748  	) + " <br/> " + 
749 		              		
750 		              			"<b>Type</b> = " + String.valueOf(getType()
751  	) + " <br/> " + 
752 		              		
753 				"<br/>]";     
754 		}
755  	
756  		
757  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
758         	
759 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
760 		
761 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=message]) ---
762 	        
763 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=message]) ---        	            	
764  	
765 		}
766  	
767  		/**
768          *  
769             				Implementation of the shared part of the GameBots2004 message VEH, used
770             				to facade VEHMessage.  
771             			
772          *
773          *  <p></p><p></p>
774          *  Complete message documentation:               
775          *  
776 		Synchronous message. Holds vehicles we see. Id for vehicles doesn't work, so 
777 		this message is without Id. We can join vehicles by ENTER command if we are 
778 		close enough - ussually 100 ut units or less. Note: Vehicle support is 
779 		in aplha testing right now.
780 	
781          */
782  	public class VehicleSharedMessage 
783 	  					extends
784   						VehicleShared
785 	    {
786  	
787     	
788     	
789 		public VehicleSharedMessage()
790 		{
791 			
792 				propertyMap.put(myRotation.getPropertyId(), myRotation);
793 			
794 				propertyMap.put(myLocation.getPropertyId(), myLocation);
795 			
796 				propertyMap.put(myVelocity.getPropertyId(), myVelocity);
797 			
798 				propertyMap.put(myTeam.getPropertyId(), myTeam);
799 			
800 				propertyMap.put(myHealth.getPropertyId(), myHealth);
801 			
802 				propertyMap.put(myArmor.getPropertyId(), myArmor);
803 			
804 				propertyMap.put(myDriver.getPropertyId(), myDriver);
805 			
806 				propertyMap.put(myTeamLocked.getPropertyId(), myTeamLocked);
807 			
808 		}		
809     
810 		    			@Override
811 		    			public 
812 		    			VehicleSharedMessage clone() {
813 		    				return this;
814 		    			}
815 		    			
816 		
817 		
818 		
819 		protected HashMap<PropertyId, ISharedProperty> propertyMap = new HashMap<PropertyId, ISharedProperty>(
820 			8
821 		);
822 		
823 		@Override
824 		public ISharedProperty getProperty(PropertyId id) {
825 			return propertyMap.get(id);
826 		}
827 
828 		@Override
829 		public Map<PropertyId, ISharedProperty> getProperties() {
830 			return propertyMap;
831 		}
832 	
833 		
834 		
835  		/**
836          * Unique Id of the vehicle or vehicle part. 
837          */
838         public  UnrealId getId()
839  	 {
840   			return Id;
841   		}
842   		
843     	
844 	    /**
845          * 
846 			Which direction the vehicle is facing in absolute terms.
847 		 
848          */
849         protected
850          RotationProperty 
851         myRotation
852 					= new
853 					RotationProperty
854 					(
855 						getId(), 
856 						"Rotation", 
857 						Rotation, 
858 						Vehicle.class
859 					);
860 					
861  		/**
862          * 
863 			Which direction the vehicle is facing in absolute terms.
864 		 
865          */
866         public  Rotation getRotation()
867  	 {
868 			  			return myRotation.getValue();
869 			  		}
870 				
871     	
872 	    /**
873          * 
874 			An absolute location of the vehicle within the map.
875 		 
876          */
877         protected
878          LocationProperty 
879         myLocation
880 					= new
881 					LocationProperty
882 					(
883 						getId(), 
884 						"Location", 
885 						Location, 
886 						Vehicle.class
887 					);
888 					
889  		/**
890          * 
891 			An absolute location of the vehicle within the map.
892 		 
893          */
894         public  Location getLocation()
895  	 {
896 			  			return myLocation.getValue();
897 			  		}
898 				
899     	
900 	    /**
901          * 
902 			Absolute velocity of the vehicle as a vector of movement per one
903 			game second.
904 		 
905          */
906         protected
907          VelocityProperty 
908         myVelocity
909 					= new
910 					VelocityProperty
911 					(
912 						getId(), 
913 						"Velocity", 
914 						Velocity, 
915 						Vehicle.class
916 					);
917 					
918  		/**
919          * 
920 			Absolute velocity of the vehicle as a vector of movement per one
921 			game second.
922 		 
923          */
924         public  Velocity getVelocity()
925  	 {
926 			  			return myVelocity.getValue();
927 			  		}
928 				
929     	
930 	    /**
931          * 
932 			What team the vehicle is on. 255 is no team. 0-3 are red,
933 			blue, green, gold in that order.
934 		 
935          */
936         protected
937          IntegerProperty 
938         myTeam
939 					= new
940 					IntegerProperty
941 					(
942 						getId(), 
943 						"Team", 
944 						Team, 
945 						Vehicle.class
946 					);
947 					
948  		/**
949          * 
950 			What team the vehicle is on. 255 is no team. 0-3 are red,
951 			blue, green, gold in that order.
952 		 
953          */
954         public  Integer getTeam()
955  	 {
956 			  			return myTeam.getValue();
957 			  		}
958 				
959     	
960 	    /**
961          * 
962 			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
963 		 
964          */
965         protected
966          IntegerProperty 
967         myHealth
968 					= new
969 					IntegerProperty
970 					(
971 						getId(), 
972 						"Health", 
973 						Health, 
974 						Vehicle.class
975 					);
976 					
977  		/**
978          * 
979 			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
980 		 
981          */
982         public  Integer getHealth()
983  	 {
984 			  			return myHealth.getValue();
985 			  		}
986 				
987     	
988 	    /**
989          * 
990 			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
991 		 
992          */
993         protected
994          IntegerProperty 
995         myArmor
996 					= new
997 					IntegerProperty
998 					(
999 						getId(), 
1000 						"Armor", 
1001 						Armor, 
1002 						Vehicle.class
1003 					);
1004 					
1005  		/**
1006          * 
1007 			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
1008 		 
1009          */
1010         public  Integer getArmor()
1011  	 {
1012 			  			return myArmor.getValue();
1013 			  		}
1014 				
1015     	
1016 	    /**
1017          * Unique Id of the driver - if any. 
1018          */
1019         protected
1020          UnrealIdProperty 
1021         myDriver
1022 					= new
1023 					UnrealIdProperty
1024 					(
1025 						getId(), 
1026 						"Driver", 
1027 						Driver, 
1028 						Vehicle.class
1029 					);
1030 					
1031  		/**
1032          * Unique Id of the driver - if any. 
1033          */
1034         public  UnrealId getDriver()
1035  	 {
1036 			  			return myDriver.getValue();
1037 			  		}
1038 				
1039     	
1040 	    /**
1041          * 
1042             If the vehicle is locked just for its current team.
1043          
1044          */
1045         protected
1046          BooleanProperty 
1047         myTeamLocked
1048 					= new
1049 					BooleanProperty
1050 					(
1051 						getId(), 
1052 						"TeamLocked", 
1053 						TeamLocked, 
1054 						Vehicle.class
1055 					);
1056 					
1057  		/**
1058          * 
1059             If the vehicle is locked just for its current team.
1060          
1061          */
1062         public  boolean isTeamLocked()
1063  	 {
1064 			  			return myTeamLocked.getValue();
1065 			  		}
1066 				
1067  		
1068  	    public String toString() {
1069             return
1070             	super.toString() + "[" +
1071             	
1072 		              			"Id = " + String.valueOf(getId()
1073  	) + " | " + 
1074 		              		
1075 		              			"Rotation = " + String.valueOf(getRotation()
1076  	) + " | " + 
1077 		              		
1078 		              			"Location = " + String.valueOf(getLocation()
1079  	) + " | " + 
1080 		              		
1081 		              			"Velocity = " + String.valueOf(getVelocity()
1082  	) + " | " + 
1083 		              		
1084 		              			"Team = " + String.valueOf(getTeam()
1085  	) + " | " + 
1086 		              		
1087 		              			"Health = " + String.valueOf(getHealth()
1088  	) + " | " + 
1089 		              		
1090 		              			"Armor = " + String.valueOf(getArmor()
1091  	) + " | " + 
1092 		              		
1093 		              			"Driver = " + String.valueOf(getDriver()
1094  	) + " | " + 
1095 		              		
1096 		              			"TeamLocked = " + String.valueOf(isTeamLocked()
1097  	) + " | " + 
1098 		              		
1099 				"]";           		
1100         }
1101  	
1102  		
1103  		public String toHtmlString() {
1104  			return super.toString() + "[<br/>" +
1105             	
1106 		              			"<b>Id</b> = " + String.valueOf(getId()
1107  	) + " <br/> " + 
1108 		              		
1109 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
1110  	) + " <br/> " + 
1111 		              		
1112 		              			"<b>Location</b> = " + String.valueOf(getLocation()
1113  	) + " <br/> " + 
1114 		              		
1115 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
1116  	) + " <br/> " + 
1117 		              		
1118 		              			"<b>Team</b> = " + String.valueOf(getTeam()
1119  	) + " <br/> " + 
1120 		              		
1121 		              			"<b>Health</b> = " + String.valueOf(getHealth()
1122  	) + " <br/> " + 
1123 		              		
1124 		              			"<b>Armor</b> = " + String.valueOf(getArmor()
1125  	) + " <br/> " + 
1126 		              		
1127 		              			"<b>Driver</b> = " + String.valueOf(getDriver()
1128  	) + " <br/> " + 
1129 		              		
1130 		              			"<b>TeamLocked</b> = " + String.valueOf(isTeamLocked()
1131  	) + " <br/> " + 
1132 		              		
1133 				"<br/>]";     
1134 		}
1135  	
1136  		
1137  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1138         	
1139 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1140 		
1141 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=message]) ---
1142 	        
1143 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=message]) ---        	            	
1144  	
1145 		}
1146  	
1147     	
1148     	
1149  	
1150 		@Override
1151 		public IWorldObjectUpdateResult<IWorldObject> update(IWorldObject object) {
1152 			if (object == null)
1153 			{
1154 				return new IWorldObjectUpdateResult.WorldObjectUpdateResult(IWorldObjectUpdateResult.Result.CREATED, this);
1155 			}
1156 			if (!( object instanceof VehicleMessage) ) {
1157 				throw new PogamutException("Can't update different class than VehicleMessage, got class " + object.getClass().getSimpleName() + "!", this);		
1158 			}
1159 			VehicleMessage toUpdate = (VehicleMessage)object;
1160 			
1161 			boolean updated = false;
1162 			
1163 			// UPDATING LOCAL PROPERTIES
1164 			
1165 				if (toUpdate.Visible != isVisible()
1166  	) {
1167 				    toUpdate.Visible=isVisible()
1168  	;
1169 					updated = true;
1170 				}
1171 			
1172          	
1173          	// UPDATING SHARED PROPERTIES
1174          	
1175 				if (!SafeEquals.equals(toUpdate.Rotation, getRotation()
1176  	)) {
1177 					toUpdate.Rotation=getRotation()
1178  	;
1179 					updated = true;
1180 				}
1181 			
1182 	            if (!SafeEquals.equals(toUpdate.Location, getLocation()
1183  	)) {
1184 					toUpdate.Location=getLocation()
1185  	;
1186 					updated = true;
1187 				}
1188 			
1189 				if (!SafeEquals.equals(toUpdate.Velocity, getVelocity()
1190  	)) {
1191 					toUpdate.Velocity=getVelocity()
1192  	;
1193 					updated = true;
1194 				}
1195 			
1196 				if (!SafeEquals.equals(toUpdate.Team, getTeam()
1197  	)) {
1198 					toUpdate.Team=getTeam()
1199  	;
1200 					updated = true;
1201 				}
1202 			
1203 				if (!SafeEquals.equals(toUpdate.Health, getHealth()
1204  	)) {
1205 					toUpdate.Health=getHealth()
1206  	;
1207 					updated = true;
1208 				}
1209 			
1210 				if (!SafeEquals.equals(toUpdate.Armor, getArmor()
1211  	)) {
1212 					toUpdate.Armor=getArmor()
1213  	;
1214 					updated = true;
1215 				}
1216 			
1217 				if (!SafeEquals.equals(toUpdate.Driver, getDriver()
1218  	)) {
1219 					toUpdate.Driver=getDriver()
1220  	;
1221 					updated = true;
1222 				}
1223 			
1224 				if (toUpdate.TeamLocked != isTeamLocked()
1225  	) {
1226 				    toUpdate.TeamLocked=isTeamLocked()
1227  	;
1228 					updated = true;
1229 				}
1230 			
1231          	
1232          	// UPDATE TIME
1233          	toUpdate.SimTime = SimTime;
1234 			
1235 			if (updated) {
1236 				return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, toUpdate);
1237 			} else {
1238 				return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IWorldObject>(IWorldObjectUpdateResult.Result.SAME, toUpdate);
1239 			}
1240 		}
1241 		
1242 		@Override
1243 		public ILocalWorldObjectUpdatedEvent getLocalEvent() {
1244 			return new VehicleLocalImpl.VehicleLocalUpdate
1245     (this.getLocal(), SimTime);
1246 		}
1247 
1248 		@Override
1249 		public ISharedWorldObjectUpdatedEvent getSharedEvent() {
1250 			return new VehicleSharedImpl.VehicleSharedUpdate
1251     (this.getShared(), SimTime, this.getTeamId());
1252 		}
1253 
1254 		@Override
1255 		public IStaticWorldObjectUpdatedEvent getStaticEvent() {
1256 			return new VehicleStaticImpl.VehicleStaticUpdate
1257     (this.getStatic(), SimTime);
1258 		}
1259  	
1260  		
1261  	    public String toString() {
1262             return
1263             	super.toString() + "[" +
1264             	
1265 		              			"Id = " + String.valueOf(getId()
1266  	) + " | " + 
1267 		              		
1268 		              			"Rotation = " + String.valueOf(getRotation()
1269  	) + " | " + 
1270 		              		
1271 		              			"Location = " + String.valueOf(getLocation()
1272  	) + " | " + 
1273 		              		
1274 		              			"Velocity = " + String.valueOf(getVelocity()
1275  	) + " | " + 
1276 		              		
1277 		              			"Visible = " + String.valueOf(isVisible()
1278  	) + " | " + 
1279 		              		
1280 		              			"Team = " + String.valueOf(getTeam()
1281  	) + " | " + 
1282 		              		
1283 		              			"Health = " + String.valueOf(getHealth()
1284  	) + " | " + 
1285 		              		
1286 		              			"Armor = " + String.valueOf(getArmor()
1287  	) + " | " + 
1288 		              		
1289 		              			"Driver = " + String.valueOf(getDriver()
1290  	) + " | " + 
1291 		              		
1292 		              			"TeamLocked = " + String.valueOf(isTeamLocked()
1293  	) + " | " + 
1294 		              		
1295 		              			"Type = " + String.valueOf(getType()
1296  	) + " | " + 
1297 		              		
1298 				"]";           		
1299         }
1300  	
1301  		
1302  		public String toHtmlString() {
1303  			return super.toString() + "[<br/>" +
1304             	
1305 		              			"<b>Id</b> = " + String.valueOf(getId()
1306  	) + " <br/> " + 
1307 		              		
1308 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
1309  	) + " <br/> " + 
1310 		              		
1311 		              			"<b>Location</b> = " + String.valueOf(getLocation()
1312  	) + " <br/> " + 
1313 		              		
1314 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
1315  	) + " <br/> " + 
1316 		              		
1317 		              			"<b>Visible</b> = " + String.valueOf(isVisible()
1318  	) + " <br/> " + 
1319 		              		
1320 		              			"<b>Team</b> = " + String.valueOf(getTeam()
1321  	) + " <br/> " + 
1322 		              		
1323 		              			"<b>Health</b> = " + String.valueOf(getHealth()
1324  	) + " <br/> " + 
1325 		              		
1326 		              			"<b>Armor</b> = " + String.valueOf(getArmor()
1327  	) + " <br/> " + 
1328 		              		
1329 		              			"<b>Driver</b> = " + String.valueOf(getDriver()
1330  	) + " <br/> " + 
1331 		              		
1332 		              			"<b>TeamLocked</b> = " + String.valueOf(isTeamLocked()
1333  	) + " <br/> " + 
1334 		              		
1335 		              			"<b>Type</b> = " + String.valueOf(getType()
1336  	) + " <br/> " + 
1337 		              		
1338 				"<br/>]";     
1339 		}
1340  	
1341  		
1342  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1343         	
1344 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1345 		
1346 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=base+classtype[@name=message]) ---
1347 	        
1348 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=base+classtype[@name=message]) ---        	            	
1349  	
1350 		}
1351