
            /**
            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. BombInfo contains all info about the bomb
		in the BotBombingRun game mode. Is not sent in other game types.
	
                          Corresponding GameBots message is 
                          BOM.
                      
             */
            
            public class
            BombInfo
                    extends GBObjectUpdate
                
	            	implements IGBWorldObjectEvent, IWorldObject, ILocated, IGBViewable
                        
            {
            
            
            
    	/** Example how the message looks like - used during parser tests. */
    	public static final String PROTOTYPE = 
    		"BOM {Id unreal_id} {Location 0,0,0} {Holder unreal_id} {HolderTeam 0} {Reachable False} {Visible False} {State text}";
    
            
            /////// Properties BEGIN
            
        /**
        
			An unique Id for this bomb, assigned by the game.
		 */
        protected
         UnrealId Id = 
        	null;
        
        
        /**
        
			An unique Id for this bomb, assigned by the game.
		 */
        public
        UnrealId getId() {
            return
         Id;
        }
        

        
        /**
        
			An absolute location of the bomb (Sent if we can actually
			see the flag).
		 */
        protected
         Location Location = 
        	null;
        
        
        /**
        
			An absolute location of the bomb (Sent if we can actually
			see the flag).
		 */
        public
        Location getLocation() {
            return
         Location;
        }
        

        
        /**
        
			Id of player/bot holding the bomb. (Sent if we can actually
			see the bomb and the bomb is being carried, or if the bomb
			is being carried by us).
		 */
        protected
         UnrealId Holder = 
        	null;
        
        
        /**
        
			Id of player/bot holding the bomb. (Sent if we can actually
			see the bomb and the bomb is being carried, or if the bomb
			is being carried by us).
		 */
        public
        UnrealId getHolder() {
            return
         Holder;
        }
        

        
        /**
        
			The team of the current holder (if any).
		 */
        protected
         int HolderTeam = 
        	0;
        
        
        /**
        
			The team of the current holder (if any).
		 */
        public
        int getHolderTeam() {
            return
         HolderTeam;
        }
        

        
        /**
        
			True if the bot can run here directly, false otherwise.
		 */
        protected
         boolean Reachable = 
        	false;
        
        
        /**
        
			True if the bot can run here directly, false otherwise.
		 */
        public
        boolean isReachable() {
            return
         Reachable;
        }
        

        
        /**
        True if the bot can see the bomb. */
        protected
         boolean Visible = 
        	false;
        
        
        /**
        True if the bot can see the bomb. */
        public
        boolean isVisible() {
            return
         Visible;
        }
        

        
        /**
        
			Represents the state the bomb is in. Can be "Held",
			"Dropped" or "Home".
		 */
        protected
         String State = 
        	null;
        
        
        /**
        
			Represents the state the bomb is in. Can be "Held",
			"Dropped" or "Home".
		 */
        public
        String getState() {
            return
         State;
        }
        

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