
            /**
            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/asynchronous message. An object on the ground that
		can be picked up.
	
                          Corresponding GameBots message is 
                          INV.
                      
             */
            
            public class
            Item
                    extends GBObjectUpdate
                
	            	implements IGBWorldObjectEvent, IWorldObject, ILocated, IGBViewable, ItemTyped
                        
            {
            
            
            
    	/** Example how the message looks like - used during parser tests. */
    	public static final String PROTOTYPE = 
    		"INV {Id unreal_id} {Visible False} {Location 0,0,0} {Reachable False} {Amount 0} {Type xWeapons.FlakCannonPickup} {Dropped False}";
    
            
            /////// Properties BEGIN
            
        /**
        
			Unique Id of the item. This Id represents just item on the
			map, not in our inventory.
		 */
        protected
         UnrealId Id = 
        	null;
        
        
        /**
        
			Unique Id of the item. This Id represents just item on the
			map, not in our inventory.
		 */
        public
        UnrealId getId() {
            return
         Id;
        }
        

        
        /**
        
            If the Item is not dropped then it's item that is laying at some navpoint and
            this is that NavPoint instance.
         */
        protected
         NavPoint NavPoint = 
        	null;
        
        
        /**
        
            If the Item is not dropped then it's item that is laying at some navpoint and
            this is that NavPoint instance.
         */
        public
        NavPoint getNavPoint() {
            return
         NavPoint;
        }
        

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

        
        /**
        Location of the item. */
        protected
         Location Location = 
        	null;
        
        
        /**
        Location of the item. */
        public
        Location getLocation() {
            return
         Location;
        }
        

        
        /**
        True if agent can reach the item. */
        protected
         boolean Reachable = 
        	false;
        
        
        /**
        True if agent can reach the item. */
        public
        boolean isReachable() {
            return
         Reachable;
        }
        

        
        /**
        
			If this item is some ammo or health pack, here we can find
			out how much of the attribute this item will add.
		 */
        protected
         int Amount = 
        	0;
        
        
        /**
        
			If this item is some ammo or health pack, here we can find
			out how much of the attribute this item will add.
		 */
        public
        int getAmount() {
            return
         Amount;
        }
        

        
        /**
        
			Class of the item (e.g. xWeapons.FlakCannonPickup).
		 */
        protected
         ItemType Type = 
        	null;
        
        
        /**
        
			Class of the item (e.g. xWeapons.FlakCannonPickup).
		 */
        public
        ItemType getType() {
            return
         Type;
        }
        

        
        /**
        
			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
		 */
        protected
         ItemDescriptor Descriptor = 
        	null;
        
        
        /**
        
			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
		 */
        public
        ItemDescriptor getDescriptor() {
            return
         Descriptor;
        }
        

        
        /**
        
            Whether it is regular item or one dropped by some bot (usually during dying). Items that are not dropped
            usually respawns itself (depends on the game settings) while those that are dropped may be taken only once.
         */
        protected
         boolean Dropped = 
        	false;
        
        
        /**
        
            Whether it is regular item or one dropped by some bot (usually during dying). Items that are not dropped
            usually respawns itself (depends on the game settings) while those that are dropped may be taken only once.
         */
        public
        boolean isDropped() {
            return
         Dropped;
        }
        

        
            /////// 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 Item)) return false;
	                      Item cast = (Item)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
            					
			    /**
			     * DO NOT USE THIS METHOD! Reserved for PogamutCore library! It's used
			     * to set correct navpoint instance into the item.
			     */  	
			    public void setNavPoint(NavPoint navPoint) {
			        this.NavPoint = navPoint;
			    } 
			
            	/////// Extra Java from XML END
            	    
            /////// Extra Java code END
            
            
            
            /**
              * Cloning constructor.
              */
             public Item(Item original) {
                
                     this.Id=original.Id;
                
                     this.NavPoint=original.NavPoint;
                
                     this.Visible=original.Visible;
                
                     this.Location=original.Location;
                
                     this.Reachable=original.Reachable;
                
                     this.Amount=original.Amount;
                
                     this.Type=original.Type;
                
                     this.Descriptor=original.Descriptor;
                
                     this.Dropped=original.Dropped;
                
             }   
             
             
                 /**
                  * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
                  */
	             public Item() {
	             }
             
	    		
	    		     /**
	    		      * 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 Item)) {
                                throw new PogamutRuntimeException("can't update object of class " + obj.getClass() + ", meant to update Item", this);
                            } 
                            orig = obj;
                            Item toUpdate = (Item)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 Item(Item 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
		            Item  o = (Item)obj;
		            
		            
		                o.Visible=Visible;
		            
		                o.Reachable=Reachable;
		            
								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) + " | " +
				            
				               "Visible = " + 
				               String.valueOf(Visible) + " | " +
				            
				               "Location = " + 
				               String.valueOf(Location) + " | " +
				            
				               "Reachable = " + 
				               String.valueOf(Reachable) + " | " +
				            
				               "Amount = " + 
				               String.valueOf(Amount) + " | " +
				            
				               "Type = " + 
				               String.valueOf(Type) + " | " +
				            
				               "Dropped = " + 
				               String.valueOf(Dropped) + " | " +
				             "";
                	 
             }
             
             public String toHtmlString() {
                return super.toString() +
             
            "<b>Id</b> : " + 
            String.valueOf(Id) + 
            " <br/> " +
             
            "<b>NavPoint</b> : " + 
            String.valueOf(NavPoint) + 
            " <br/> " +
             
            "<b>Visible</b> : " + 
            String.valueOf(Visible) + 
            " <br/> " +
             
            "<b>Location</b> : " + 
            String.valueOf(Location) + 
            " <br/> " +
             
            "<b>Reachable</b> : " + 
            String.valueOf(Reachable) + 
            " <br/> " +
             
            "<b>Amount</b> : " + 
            String.valueOf(Amount) + 
            " <br/> " +
             
            "<b>Type</b> : " + 
            String.valueOf(Type) + 
            " <br/> " +
             
            "<b>Descriptor</b> : " + 
            String.valueOf(Descriptor) + 
            " <br/> " +
             
            "<b>Dropped</b> : " + 
            String.valueOf(Dropped) + 
            " <br/> " +
             "";
             }            
             
             
             
             }
                         
        