
            /**
            IMPORTANT !!!
       
            DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbinfomessages BY
            THE JavaClassesGenerator.xslt. MODIFY THESE FILES INSTEAD OF THIS ONE.
       
            IMPORTANT END !!!
            */
            package
            cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
	    		import java.util.*;    
    import javax.vecmath.*;    
    import cz.cuni.amis.pogamut.base.communication.messages.*;    
    import cz.cuni.amis.pogamut.base.agent.worldview.*;    
    import cz.cuni.amis.pogamut.base.agent.worldview.objects.*;    
    import cz.cuni.amis.pogamut.base.communication.translator.*;    
    import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;    
    import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;    
    import cz.cuni.amis.pogamut.base.exceptions.*;    
    import cz.cuni.amis.pogamut.base3d.worldview.objects.*;    
    import cz.cuni.amis.pogamut.ut2004.communication.messages.*;    
    import cz.cuni.amis.pogamut.ut2004.agent.worldview.objects.*;    
                
            
            /**
              
		Synchronous message. Holds vehicles we see. Id for vehicles doesn't work, so 
		this message is without Id. We can join vehicles by ENTER command if we are 
		close enough - ussually 100 ut units or less. Note: Vehicle support is 
		in aplha testing right now.
	
                          Corresponding GameBots message is 
                          VEH.
                      
             */
            
            public class
            Vehicle
                    extends GBObjectUpdate
                
	            	implements IGBWorldObjectEvent, IWorldObject, ILocated, ILocomotive, IRotable, IGBViewable
                        
            {
            
            
            
    	/** Example how the message looks like - used during parser tests. */
    	public static final String PROTOTYPE = 
    		"VEH {Id unreal_id} {Rotation 0,0,0} {Location 0,0,0} {Velocity 0,0,0} {Visible False} {Team 0} {Health 0} {Armor 0} {Driver unreal_id} {TeamLocked False} {Type text}";
    
            
            /////// Properties BEGIN
            
        /**
        Unique Id of the vehicle or vehicle part. */
        protected
         UnrealId Id = 
        	null;
        
        
        /**
        Unique Id of the vehicle or vehicle part. */
        public
        UnrealId getId() {
            return
         Id;
        }
        

        
        /**
        
			Which direction the vehicle is facing in absolute terms.
		 */
        protected
         Rotation Rotation = 
        	null;
        
        
        /**
        
			Which direction the vehicle is facing in absolute terms.
		 */
        public
        Rotation getRotation() {
            return
         Rotation;
        }
        

        
        /**
        
			An absolute location of the vehicle within the map.
		 */
        protected
         Location Location = 
        	null;
        
        
        /**
        
			An absolute location of the vehicle within the map.
		 */
        public
        Location getLocation() {
            return
         Location;
        }
        

        
        /**
        
			Absolute velocity of the vehicle as a vector of movement per one
			game second.
		 */
        protected
         Velocity Velocity = 
        	null;
        
        
        /**
        
			Absolute velocity of the vehicle as a vector of movement per one
			game second.
		 */
        public
        Velocity getVelocity() {
            return
         Velocity;
        }
        

        
        /**
        
            If the vehicle is in the field of view of the bot.
         */
        protected
         boolean Visible = 
        	false;
        
        
        /**
        
            If the vehicle is in the field of view of the bot.
         */
        public
        boolean isVisible() {
            return
         Visible;
        }
        

        
        /**
        
			What team the vehicle is on. 255 is no team. 0-3 are red,
			blue, green, gold in that order.
		 */
        protected
         int Team = 
        	0;
        
        
        /**
        
			What team the vehicle is on. 255 is no team. 0-3 are red,
			blue, green, gold in that order.
		 */
        public
        int getTeam() {
            return
         Team;
        }
        

        
        /**
        
			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
		 */
        protected
         int Health = 
        	0;
        
        
        /**
        
			How much health the vehicle has left. Ranges from 0 to x, depending on the vehicle type.
		 */
        public
        int getHealth() {
            return
         Health;
        }
        

        
        /**
        
			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
		 */
        protected
         int Armor = 
        	0;
        
        
        /**
        
			How much the vehicle has left. Note: This may be 0 all the time. Maybe the vehicles are not supporting armor.
		 */
        public
        int getArmor() {
            return
         Armor;
        }
        

        
        /**
        Unique Id of the driver - if any. */
        protected
         UnrealId Driver = 
        	null;
        
        
        /**
        Unique Id of the driver - if any. */
        public
        UnrealId getDriver() {
            return
         Driver;
        }
        

        
        /**
        
            If the vehicle is locked just for its current team.
         */
        protected
         boolean TeamLocked = 
        	false;
        
        
        /**
        
            If the vehicle is locked just for its current team.
         */
        public
        boolean isTeamLocked() {
            return
         TeamLocked;
        }
        

        
        /**
        
			Class of the vehicle. If it is a car, turret etc.
		 */
        protected
         String Type = 
        	null;
        
        
        /**
        
			Class of the vehicle. If it is a car, turret etc.
		 */
        public
        String getType() {
            return
         Type;
        }
        

        
            /////// Properties END
            
            /////// Extra Java code BEGIN
                        	
            	/////// Additional code from xslt BEGIN            	 
            		
       							protected double Time = 0;
       							
       							protected double getTime() {
       								return Time;
       							}
       							
       							protected void setTime(double time) {
       								this.Time = time;
       							}
       						
       							public double getLastSeenTime() {
       								return Time;
       							}
       						
       					
       					public boolean equals(Object obj) {
	                      if (!(obj instanceof Vehicle)) return false;
	                      Vehicle cast = (Vehicle)obj;
	                      if (this.getId() != null) return this.getId().equals(cast.getId());
	                      else return cast.getId() == null;
	                    }
	                    
	                    public int hashCode() {
	                      if (getId() != null) return getId().hashCode();
	                      return 0;
	                    }
            			
            			
            		
            		
            	/////// Additional code from xslt END            
				                    
	            /////// Extra Java from XML BEGIN
            		
            	/////// Extra Java from XML END
            	    
            /////// Extra Java code END
            
            
            
            /**
              * Cloning constructor.
              */
             public Vehicle(Vehicle original) {
                
                     this.Id=original.Id;
                
                     this.Rotation=original.Rotation;
                
                     this.Location=original.Location;
                
                     this.Velocity=original.Velocity;
                
                     this.Visible=original.Visible;
                
                     this.Team=original.Team;
                
                     this.Health=original.Health;
                
                     this.Armor=original.Armor;
                
                     this.Driver=original.Driver;
                
                     this.TeamLocked=original.TeamLocked;
                
                     this.Type=original.Type;
                
             }   
             
             
                 /**
                  * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
                  */
	             public Vehicle() {
	             }
             
	    		
	    		     /**
	    		      * Used to drop Visible flag from the object.
	    		      */
	    		     public static class ObjectDisappeared implements IGBWorldObjectDisappeared {
	    		     
	    		         private IWorldObject orig;
	    		         
	    		         public ObjectDisappeared(IWorldObject orig) {
	    		             this.orig = orig;
	    		         }
	    		         
	    		         public IWorldObjectId getId() {
	    		             return orig.getId();
	    		         }
    
                         public IWorldObject update(IWorldObject obj) {
                            if (obj == null) {
                                throw new PogamutRuntimeException("not meant to create new object, probably wanted to update non-existing object of id: " + getId(), this);
                            }
                            if (!(obj instanceof Vehicle)) {
                                throw new PogamutRuntimeException("can't update object of class " + obj.getClass() + ", meant to update Vehicle", this);
                            } 
                            orig = obj;
                            Vehicle toUpdate = (Vehicle)obj;
                            toUpdate.Visible = false;
                            return toUpdate;
                         }
    
                         public IWorldObject getObject() {
                            return orig;
                         }
                         
                         public String toString() {
                            return "ObjectDisappeared[" + orig.getClass().getName().substring(getClass().getName().lastIndexOf(".")+1) + " " + orig.getId() + "]"; 
                         }
	    		         
	    		     }
	    		
	    		     /**
	    		      * Used to create event that drops the Visible flag of the item.
	    		      */
	    		     public Vehicle(Vehicle Original, boolean Visible) {
	    		         this(Original);
	    		         this.Visible = Visible;
	    		     }
	    		     
	    		     public IGBWorldObjectDisappeared createDisappearEvent() {
	    		         return new ObjectDisappeared(this);
	    		     }
	    		
	    		
	    		/**
	    		 * Here we save the original object for which this object is an update.
	    		 */ 
	    		private IWorldObject orig = null;
	    		
	            public IWorldObject update(IWorldObject obj) {
		            if(obj == null) {
		               orig = this;
		               return this;
		            }
		            orig = obj;
		            // typecast
		            Vehicle  o = (Vehicle)obj;
		            
		            
		                o.Rotation=Rotation;
		            
		                o.Location=Location;
		            
		                o.Velocity=Velocity;
		            
		                o.Visible=Visible;
		            
		                o.Team=Team;
		            
		                o.Health=Health;
		            
		                o.Armor=Armor;
		            
		                o.Driver=Driver;
		            
								o.Time = Time;
							
		            
		            return o;
		        }
	        
	            /**
	             * Returns original object (if method update() has already been called, for bot-programmer that is always true
	             * as the original object is updated and then the event is propagated).
	             */ 
		        public IWorldObject getObject() {
		            if (orig == null) return this;
		            return orig;
		        }
	        
                
                 
            public String toString() {
                return
                
                		super.toString() + " | " +
                		
				               "Id = " + 
				               String.valueOf(Id) + " | " +
				            
				               "Rotation = " + 
				               String.valueOf(Rotation) + " | " +
				            
				               "Location = " + 
				               String.valueOf(Location) + " | " +
				            
				               "Velocity = " + 
				               String.valueOf(Velocity) + " | " +
				            
				               "Visible = " + 
				               String.valueOf(Visible) + " | " +
				            
				               "Team = " + 
				               String.valueOf(Team) + " | " +
				            
				               "Health = " + 
				               String.valueOf(Health) + " | " +
				            
				               "Armor = " + 
				               String.valueOf(Armor) + " | " +
				            
				               "Driver = " + 
				               String.valueOf(Driver) + " | " +
				            
				               "TeamLocked = " + 
				               String.valueOf(TeamLocked) + " | " +
				            
				               "Type = " + 
				               String.valueOf(Type) + " | " +
				             "";
                	 
             }
             
             public String toHtmlString() {
                return super.toString() +
             
            "<b>Id</b> : " + 
            String.valueOf(Id) + 
            " <br/> " +
             
            "<b>Rotation</b> : " + 
            String.valueOf(Rotation) + 
            " <br/> " +
             
            "<b>Location</b> : " + 
            String.valueOf(Location) + 
            " <br/> " +
             
            "<b>Velocity</b> : " + 
            String.valueOf(Velocity) + 
            " <br/> " +
             
            "<b>Visible</b> : " + 
            String.valueOf(Visible) + 
            " <br/> " +
             
            "<b>Team</b> : " + 
            String.valueOf(Team) + 
            " <br/> " +
             
            "<b>Health</b> : " + 
            String.valueOf(Health) + 
            " <br/> " +
             
            "<b>Armor</b> : " + 
            String.valueOf(Armor) + 
            " <br/> " +
             
            "<b>Driver</b> : " + 
            String.valueOf(Driver) + 
            " <br/> " +
             
            "<b>TeamLocked</b> : " + 
            String.valueOf(TeamLocked) + 
            " <br/> " +
             
            "<b>Type</b> : " + 
            String.valueOf(Type) + 
            " <br/> " +
             "";
             }            
             
             
             
             }
                         
        