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 MESSAGE.
15   		 *
16   		 * 
17  		Send a message to the world or just your team.
18  	
19           */
20   	public class SendMessage 
21  		extends CommandMessage
22  	        {
23  	        	
24  		        
25      	/** Example how the message looks like - used during parser tests. */
26      	public static final String PROTOTYPE =
27      		" {Id unreal_id}  {Text text}  {TeamIndex 0}  {Global False}  {FadeOut 0} ";
28      
29  		/**
30  		 * Creates new instance of command SendMessage.
31  		 * 
32  		Send a message to the world or just your team.
33  	
34  		 * Corresponding GameBots message for this command is
35  		 * MESSAGE.
36  		 *
37  		 * 
38  		 *    @param Id Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head).
39  		 *    @param Text Text to send.
40  		 *    @param TeamIndex 
41  			Specifying target team - can be 0 or 1. Works only in team games. If global is set to true then the message will be sent to all nevertheless.
42  		
43  		 *    @param Global 
44  			If True it is sent to everyone. Otherwise (or if not
45  			specified), just your team.
46  		
47  		 *    @param FadeOut Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown.
48  		 */
49  		public SendMessage(
50  			UnrealId Id,  String Text,  Integer TeamIndex,  Boolean Global,  Double FadeOut
51  		) {
52  			
53  				this.Id = Id;
54              
55  				this.Text = Text;
56              
57  				this.TeamIndex = TeamIndex;
58              
59  				this.Global = Global;
60              
61  				this.FadeOut = FadeOut;
62              
63  		}
64  
65  		
66  			/**
67  			 * Creates new instance of command SendMessage.
68  			 * 
69  		Send a message to the world or just your team.
70  	
71  			 * Corresponding GameBots message for this command is
72  			 * MESSAGE.
73  			 * <p></p>
74  			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
75  		     */
76  		    public SendMessage() {
77  		    }
78  			
79  		
80  		/**
81  		 * Cloning constructor.
82  		 *
83  		 * @param original
84  		 */
85  		public SendMessage(SendMessage original) {
86  		   
87  		        this.Id = original.Id;
88  		   
89  		        this.Text = original.Text;
90  		   
91  		        this.TeamIndex = original.TeamIndex;
92  		   
93  		        this.Global = original.Global;
94  		   
95  		        this.FadeOut = original.FadeOut;
96  		   
97  		}
98      
99  	        /**
100 	        Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head). 
101 	        */
102 	        protected
103 	         UnrealId Id =
104 	       	
105 	        		null
106 	        	;
107 	
108 	        
109 	        
110  		/**
111          * Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head). 
112          */
113         public UnrealId getId()
114  	
115 	        {
116 	            return
117 	        	 Id;
118 	        }
119 	        
120 	        
121 	        
122  		
123  		/**
124          * Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head). 
125          */
126         public SendMessage 
127         setId(UnrealId Id)
128  	
129 			{
130 				this.Id = Id;
131 				return this;
132 			}
133 		
134 	        /**
135 	        Text to send. 
136 	        */
137 	        protected
138 	         String Text =
139 	       	
140 	        		null
141 	        	;
142 	
143 	        
144 	        
145  		/**
146          * Text to send. 
147          */
148         public String getText()
149  	
150 	        {
151 	            return
152 	        	 Text;
153 	        }
154 	        
155 	        
156 	        
157  		
158  		/**
159          * Text to send. 
160          */
161         public SendMessage 
162         setText(String Text)
163  	
164 			{
165 				this.Text = Text;
166 				return this;
167 			}
168 		
169 	        /**
170 	        
171 			Specifying target team - can be 0 or 1. Works only in team games. If global is set to true then the message will be sent to all nevertheless.
172 		 
173 	        */
174 	        protected
175 	         Integer TeamIndex =
176 	       	
177 	        		null
178 	        	;
179 	
180 	        
181 	        
182  		/**
183          * 
184 			Specifying target team - can be 0 or 1. Works only in team games. If global is set to true then the message will be sent to all nevertheless.
185 		 
186          */
187         public Integer getTeamIndex()
188  	
189 	        {
190 	            return
191 	        	 TeamIndex;
192 	        }
193 	        
194 	        
195 	        
196  		
197  		/**
198          * 
199 			Specifying target team - can be 0 or 1. Works only in team games. If global is set to true then the message will be sent to all nevertheless.
200 		 
201          */
202         public SendMessage 
203         setTeamIndex(Integer TeamIndex)
204  	
205 			{
206 				this.TeamIndex = TeamIndex;
207 				return this;
208 			}
209 		
210 	        /**
211 	        
212 			If True it is sent to everyone. Otherwise (or if not
213 			specified), just your team.
214 		 
215 	        */
216 	        protected
217 	         Boolean Global =
218 	       	
219 	        		null
220 	        	;
221 	
222 	        
223 	        
224  		/**
225          * 
226 			If True it is sent to everyone. Otherwise (or if not
227 			specified), just your team.
228 		 
229          */
230         public Boolean isGlobal()
231  	
232 	        {
233 	            return
234 	        	 Global;
235 	        }
236 	        
237 	        
238 	        
239  		
240  		/**
241          * 
242 			If True it is sent to everyone. Otherwise (or if not
243 			specified), just your team.
244 		 
245          */
246         public SendMessage 
247         setGlobal(Boolean Global)
248  	
249 			{
250 				this.Global = Global;
251 				return this;
252 			}
253 		
254 	        /**
255 	        Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown. 
256 	        */
257 	        protected
258 	         Double FadeOut =
259 	       	
260 	        		null
261 	        	;
262 	
263 	        
264 	        
265  		/**
266          * Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown. 
267          */
268         public Double getFadeOut()
269  	
270 	        {
271 	            return
272 	        	 FadeOut;
273 	        }
274 	        
275 	        
276 	        
277  		
278  		/**
279          * Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown. 
280          */
281         public SendMessage 
282         setFadeOut(Double FadeOut)
283  	
284 			{
285 				this.FadeOut = FadeOut;
286 				return this;
287 			}
288 		
289  	    public String toString() {
290             return toMessage();
291         }
292  	
293  		public String toHtmlString() {
294 			return super.toString() + "[<br/>" +
295             	
296             	"<b>Id</b> = " +
297             	String.valueOf(getId()
298  	) +
299             	" <br/> " +
300             	
301             	"<b>Text</b> = " +
302             	String.valueOf(getText()
303  	) +
304             	" <br/> " +
305             	
306             	"<b>TeamIndex</b> = " +
307             	String.valueOf(getTeamIndex()
308  	) +
309             	" <br/> " +
310             	
311             	"<b>Global</b> = " +
312             	String.valueOf(isGlobal()
313  	) +
314             	" <br/> " +
315             	
316             	"<b>FadeOut</b> = " +
317             	String.valueOf(getFadeOut()
318  	) +
319             	" <br/> " +
320             	 
321             	"<br/>]"
322             ;
323 		}
324  	
325 		public String toMessage() {
326      		StringBuffer buf = new StringBuffer();
327      		buf.append("MESSAGE");
328      		
329 						if (Id != null) {
330 							buf.append(" {Id " + Id.getStringId() + "}");
331 						}
332 					
333 						if (Text != null) {
334 							buf.append(" {Text " + Text + "}");
335 						}
336 					
337 						if (TeamIndex != null) {
338 							buf.append(" {TeamIndex " + TeamIndex + "}");
339 						}
340 					
341 						if (Global != null) {
342 							buf.append(" {Global " + Global + "}");
343 						}
344 					
345 						if (FadeOut != null) {
346 							buf.append(" {FadeOut " + FadeOut + "}");
347 						}
348 					
349    			return buf.toString();
350    		}
351  	
352  		// --- Extra Java from XML BEGIN (extra/code/java)
353         	
354 		// --- Extra Java from XML END (extra/code/java)
355  	
356 	        }
357