View Javadoc

1   
2   	 	/**
3            IMPORTANT !!!
4   
5            DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbcommands BY
6            THE JavaClassesGenerator.xslt. MODIFY THAT FILE INSTEAD OF THIS ONE.
7            
8            Use Ant task process-gb-messages after that to generate .java files again.
9            
10           IMPORTANT END !!!
11          */
12   	package cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands;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.*;
13   		/**
14   		 * Representation of the GameBots2004 command GIVE.
15   		 *
16   		 * 
17  		Bot gives an item to other bot (regardless of the automatic pickup settings). Note that other bot
18  		must be within reach - less than 200 ut units away (approx. 2 meters). Bot receives message GIVERES
19  		with the result of this command - if it was successfull or not.
20  	
21           */
22   	public class GiveItem 
23  		extends CommandMessage
24  	        {
25  	        	
26  		        
27      	/** Example how the message looks like - used during parser tests. */
28      	public static final String PROTOTYPE =
29      		" {Id unreal_id}  {Type text} ";
30      
31  		/**
32  		 * Creates new instance of command GiveItem.
33  		 * 
34  		Bot gives an item to other bot (regardless of the automatic pickup settings). Note that other bot
35  		must be within reach - less than 200 ut units away (approx. 2 meters). Bot receives message GIVERES
36  		with the result of this command - if it was successfull or not.
37  	
38  		 * Corresponding GameBots message for this command is
39  		 * GIVE.
40  		 *
41  		 * 
42  		 *    @param Id 
43  			Id of the bot we want to give item to.
44  		
45  		 *    @param Type 
46  			Class of the item, e.g. "GBEmohawk.ItemBall" (without quotes) we want to give to the bot.
47  		
48  		 */
49  		public GiveItem(
50  			UnrealId Id,  String Type
51  		) {
52  			
53  				this.Id = Id;
54              
55  				this.Type = Type;
56              
57  		}
58  
59  		
60  			/**
61  			 * Creates new instance of command GiveItem.
62  			 * 
63  		Bot gives an item to other bot (regardless of the automatic pickup settings). Note that other bot
64  		must be within reach - less than 200 ut units away (approx. 2 meters). Bot receives message GIVERES
65  		with the result of this command - if it was successfull or not.
66  	
67  			 * Corresponding GameBots message for this command is
68  			 * GIVE.
69  			 * <p></p>
70  			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
71  		     */
72  		    public GiveItem() {
73  		    }
74  			
75  		
76  		/**
77  		 * Cloning constructor.
78  		 *
79  		 * @param original
80  		 */
81  		public GiveItem(GiveItem original) {
82  		   
83  		        this.Id = original.Id;
84  		   
85  		        this.Type = original.Type;
86  		   
87  		}
88      
89  	        /**
90  	        
91  			Id of the bot we want to give item to.
92  		 
93  	        */
94  	        protected
95  	         UnrealId Id =
96  	       	
97  	        		null
98  	        	;
99  	
100 	        
101 	        
102  		/**
103          * 
104 			Id of the bot we want to give item to.
105 		 
106          */
107         public UnrealId getId()
108  	
109 	        {
110 	            return
111 	        	 Id;
112 	        }
113 	        
114 	        
115 	        
116  		
117  		/**
118          * 
119 			Id of the bot we want to give item to.
120 		 
121          */
122         public GiveItem 
123         setId(UnrealId Id)
124  	
125 			{
126 				this.Id = Id;
127 				return this;
128 			}
129 		
130 	        /**
131 	        
132 			Class of the item, e.g. "GBEmohawk.ItemBall" (without quotes) we want to give to the bot.
133 		 
134 	        */
135 	        protected
136 	         String Type =
137 	       	
138 	        		null
139 	        	;
140 	
141 	        
142 	        
143  		/**
144          * 
145 			Class of the item, e.g. "GBEmohawk.ItemBall" (without quotes) we want to give to the bot.
146 		 
147          */
148         public String getType()
149  	
150 	        {
151 	            return
152 	        	 Type;
153 	        }
154 	        
155 	        
156 	        
157  		
158  		/**
159          * 
160 			Class of the item, e.g. "GBEmohawk.ItemBall" (without quotes) we want to give to the bot.
161 		 
162          */
163         public GiveItem 
164         setType(String Type)
165  	
166 			{
167 				this.Type = Type;
168 				return this;
169 			}
170 		
171  	    public String toString() {
172             return toMessage();
173         }
174  	
175  		public String toHtmlString() {
176 			return super.toString() + "[<br/>" +
177             	
178             	"<b>Id</b> = " +
179             	String.valueOf(getId()
180  	) +
181             	" <br/> " +
182             	
183             	"<b>Type</b> = " +
184             	String.valueOf(getType()
185  	) +
186             	" <br/> " +
187             	 
188             	"<br/>]"
189             ;
190 		}
191  	
192 		public String toMessage() {
193      		StringBuffer buf = new StringBuffer();
194      		buf.append("GIVE");
195      		
196 						if (Id != null) {
197 							buf.append(" {Id " + Id.getStringId() + "}");
198 						}
199 					
200 						if (Type != null) {
201 							buf.append(" {Type " + Type + "}");
202 						}
203 					
204    			return buf.toString();
205    		}
206  	
207  		// --- Extra Java from XML BEGIN (extra/code/java)
208         	
209 		// --- Extra Java from XML END (extra/code/java)
210  	
211 	        }
212