
            /**
            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. Contains information about other players in
		the game, like their current velocity, position, weapon and
		reachability. Only reports those players that are visible.
		(within field of view and not occluded).
	
                          Corresponding GameBots message is 
                          PLR.
                      
             */
            
            public class
            Player
                    extends GBObjectUpdate
                
	            	implements IGBWorldObjectEvent, IWorldObject, ILocated, ILocomotive, IRotable, IGBViewable
                        
            {
            
            
            
    	/** Example how the message looks like - used during parser tests. */
    	public static final String PROTOTYPE = 
    		"PLR {Id unreal_id} {Jmx text} {Name text} {Visible False} {Rotation 0,0,0} {Location 0,0,0} {Velocity 0,0,0} {Team 0} {Weapon text} {Reachable False} {Firing 0}";
    
            
            /////// Properties BEGIN
            
        /**
        Unique Id of the player. */
        protected
         UnrealId Id = 
        	null;
        
        
        /**
        Unique Id of the player. */
        public
        UnrealId getId() {
            return
         Id;
        }
        

        
        /**
        
			Exported just for control server. Holds jmx address we need to connect to
            when we want to debug our bot.
		 */
        protected
         String Jmx = 
        	null;
        
        
        /**
        
			Exported just for control server. Holds jmx address we need to connect to
            when we want to debug our bot.
		 */
        public
        String getJmx() {
            return
         Jmx;
        }
        

        
        /**
        
			Human readable name of the player.
		 */
        protected
         String Name = 
        	null;
        
        
        /**
        
			Human readable name of the player.
		 */
        public
        String getName() {
            return
         Name;
        }
        

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

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

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

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

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

        
        /**
        
			Class of the weapon the player is holding. Weapon strings to
			look for include: "AssaultRifle", "ShieldGun", "FlakCannon",
			"BioRifle", "ShockRifle", "LinkGun", "SniperRifle",
			"RocketLauncher", "Minigun", "LightingGun", "Translocator".
			TODO: Look if this is all.
		 */
        protected
         String Weapon = 
        	null;
        
        
        /**
        
			Class of the weapon the player is holding. Weapon strings to
			look for include: "AssaultRifle", "ShieldGun", "FlakCannon",
			"BioRifle", "ShockRifle", "LinkGun", "SniperRifle",
			"RocketLauncher", "Minigun", "LightingGun", "Translocator".
			TODO: Look if this is all.
		 */
        public
        String getWeapon() {
            return
         Weapon;
        }
        

        
        /**
        
			True if the bot can run to this other player directly, false
			otherwise. Possible reasons for false: pit or obstacle
			between the two characters.
		 */
        protected
         boolean Reachable = 
        	false;
        
        
        /**
        
			True if the bot can run to this other player directly, false
			otherwise. Possible reasons for false: pit or obstacle
			between the two characters.
		 */
        public
        boolean isReachable() {
            return
         Reachable;
        }
        

        
        /**
        
			0 means is not firing, 1 - firing in primary mode, 2 -
			firing in secondary mode (alt firing).
		 */
        protected
         int Firing = 
        	0;
        
        
        /**
        
			0 means is not firing, 1 - firing in primary mode, 2 -
			firing in secondary mode (alt firing).
		 */
        public
        int getFiring() {
            return
         Firing;
        }
        

        
            /////// 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 Player)) return false;
	                      Player cast = (Player)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 Player(Player original) {
                
                     this.Id=original.Id;
                
                     this.Jmx=original.Jmx;
                
                     this.Name=original.Name;
                
                     this.Visible=original.Visible;
                
                     this.Rotation=original.Rotation;
                
                     this.Location=original.Location;
                
                     this.Velocity=original.Velocity;
                
                     this.Team=original.Team;
                
                     this.Weapon=original.Weapon;
                
                     this.Reachable=original.Reachable;
                
                     this.Firing=original.Firing;
                
             }   
             
             
                 /**
                  * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
                  */
	             public Player() {
	             }
             
	    		
	    		     /**
	    		      * 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 Player)) {
                                throw new PogamutRuntimeException("can't update object of class " + obj.getClass() + ", meant to update Player", this);
                            } 
                            orig = obj;
                            Player toUpdate = (Player)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 Player(Player 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
		            Player  o = (Player)obj;
		            
		            
		                o.Name=Name;
		            
		                o.Visible=Visible;
		            
		                o.Rotation=Rotation;
		            
		                o.Location=Location;
		            
		                o.Velocity=Velocity;
		            
		                o.Team=Team;
		            
		                o.Weapon=Weapon;
		            
		                o.Reachable=Reachable;
		            
		                o.Firing=Firing;
		            
								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) + " | " +
				            
				               "Jmx = " + 
				               String.valueOf(Jmx) + " | " +
				            
				               "Name = " + 
				               String.valueOf(Name) + " | " +
				            
				               "Visible = " + 
				               String.valueOf(Visible) + " | " +
				            
				               "Rotation = " + 
				               String.valueOf(Rotation) + " | " +
				            
				               "Location = " + 
				               String.valueOf(Location) + " | " +
				            
				               "Velocity = " + 
				               String.valueOf(Velocity) + " | " +
				            
				               "Team = " + 
				               String.valueOf(Team) + " | " +
				            
				               "Weapon = " + 
				               String.valueOf(Weapon) + " | " +
				            
				               "Reachable = " + 
				               String.valueOf(Reachable) + " | " +
				            
				               "Firing = " + 
				               String.valueOf(Firing) + " | " +
				             "";
                	 
             }
             
             public String toHtmlString() {
                return super.toString() +
             
            "<b>Id</b> : " + 
            String.valueOf(Id) + 
            " <br/> " +
             
            "<b>Jmx</b> : " + 
            String.valueOf(Jmx) + 
            " <br/> " +
             
            "<b>Name</b> : " + 
            String.valueOf(Name) + 
            " <br/> " +
             
            "<b>Visible</b> : " + 
            String.valueOf(Visible) + 
            " <br/> " +
             
            "<b>Rotation</b> : " + 
            String.valueOf(Rotation) + 
            " <br/> " +
             
            "<b>Location</b> : " + 
            String.valueOf(Location) + 
            " <br/> " +
             
            "<b>Velocity</b> : " + 
            String.valueOf(Velocity) + 
            " <br/> " +
             
            "<b>Team</b> : " + 
            String.valueOf(Team) + 
            " <br/> " +
             
            "<b>Weapon</b> : " + 
            String.valueOf(Weapon) + 
            " <br/> " +
             
            "<b>Reachable</b> : " + 
            String.valueOf(Reachable) + 
            " <br/> " +
             
            "<b>Firing</b> : " + 
            String.valueOf(Firing) + 
            " <br/> " +
             "";
             }            
             
             
             
             }
                         
        