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}  {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 Global 
41  			If True it is sent to everyone. Otherwise (or if not
42  			specified), just your team.
43  		
44  		 *    @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.
45  		 */
46  		public SendMessage(
47  			UnrealId Id,  String Text,  Boolean Global,  Double FadeOut
48  		) {
49  			
50  				this.Id = Id;
51              
52  				this.Text = Text;
53              
54  				this.Global = Global;
55              
56  				this.FadeOut = FadeOut;
57              
58  		}
59  
60  		
61  			/**
62  			 * Creates new instance of command SendMessage.
63  			 * 
64  		Send a message to the world or just your team.
65  	
66  			 * Corresponding GameBots message for this command is
67  			 * MESSAGE.
68  			 * <p></p>
69  			 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
70  		     */
71  		    public SendMessage() {
72  		    }
73  			
74  		
75  		/**
76  		 * Cloning constructor.
77  		 *
78  		 * @param original
79  		 */
80  		public SendMessage(SendMessage original) {
81  		   
82  		        this.Id = original.Id;
83  		   
84  		        this.Text = original.Text;
85  		   
86  		        this.Global = original.Global;
87  		   
88  		        this.FadeOut = original.FadeOut;
89  		   
90  		}
91      
92  	        /**
93  	        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). 
94  	        */
95  	        protected
96  	         UnrealId Id =
97  	       	
98  	        		null
99  	        	;
100 	
101 	        
102 	        
103  		/**
104          * 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). 
105          */
106         public UnrealId getId()
107  	
108 	        {
109 	            return
110 	        	 Id;
111 	        }
112 	        
113 	        
114 	        
115  		
116  		/**
117          * 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). 
118          */
119         public SendMessage 
120         setId(UnrealId Id)
121  	
122 			{
123 				this.Id = Id;
124 				return this;
125 			}
126 		
127 	        /**
128 	        Text to send. 
129 	        */
130 	        protected
131 	         String Text =
132 	       	
133 	        		null
134 	        	;
135 	
136 	        
137 	        
138  		/**
139          * Text to send. 
140          */
141         public String getText()
142  	
143 	        {
144 	            return
145 	        	 Text;
146 	        }
147 	        
148 	        
149 	        
150  		
151  		/**
152          * Text to send. 
153          */
154         public SendMessage 
155         setText(String Text)
156  	
157 			{
158 				this.Text = Text;
159 				return this;
160 			}
161 		
162 	        /**
163 	        
164 			If True it is sent to everyone. Otherwise (or if not
165 			specified), just your team.
166 		 
167 	        */
168 	        protected
169 	         Boolean Global =
170 	       	
171 	        		null
172 	        	;
173 	
174 	        
175 	        
176  		/**
177          * 
178 			If True it is sent to everyone. Otherwise (or if not
179 			specified), just your team.
180 		 
181          */
182         public Boolean isGlobal()
183  	
184 	        {
185 	            return
186 	        	 Global;
187 	        }
188 	        
189 	        
190 	        
191  		
192  		/**
193          * 
194 			If True it is sent to everyone. Otherwise (or if not
195 			specified), just your team.
196 		 
197          */
198         public SendMessage 
199         setGlobal(Boolean Global)
200  	
201 			{
202 				this.Global = Global;
203 				return this;
204 			}
205 		
206 	        /**
207 	        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. 
208 	        */
209 	        protected
210 	         Double FadeOut =
211 	       	
212 	        		null
213 	        	;
214 	
215 	        
216 	        
217  		/**
218          * 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. 
219          */
220         public Double getFadeOut()
221  	
222 	        {
223 	            return
224 	        	 FadeOut;
225 	        }
226 	        
227 	        
228 	        
229  		
230  		/**
231          * 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. 
232          */
233         public SendMessage 
234         setFadeOut(Double FadeOut)
235  	
236 			{
237 				this.FadeOut = FadeOut;
238 				return this;
239 			}
240 		
241  	    public String toString() {
242             return toMessage();
243         }
244  	
245  		public String toHtmlString() {
246 			return super.toString() + "[<br/>" +
247             	
248             	"<b>Id</b> = " +
249             	String.valueOf(getId()
250  	) +
251             	" <br/> " +
252             	
253             	"<b>Text</b> = " +
254             	String.valueOf(getText()
255  	) +
256             	" <br/> " +
257             	
258             	"<b>Global</b> = " +
259             	String.valueOf(isGlobal()
260  	) +
261             	" <br/> " +
262             	
263             	"<b>FadeOut</b> = " +
264             	String.valueOf(getFadeOut()
265  	) +
266             	" <br/> " +
267             	 
268             	"<br/>]"
269             ;
270 		}
271  	
272 		public String toMessage() {
273      		StringBuffer buf = new StringBuffer();
274      		buf.append("MESSAGE");
275      		
276 						if (Id != null) {
277 							buf.append(" {Id " + Id.getStringId() + "}");
278 						}
279 					
280 						if (Text != null) {
281 							buf.append(" {Text " + Text + "}");
282 						}
283 					
284 						if (Global != null) {
285 							buf.append(" {Global " + Global + "}");
286 						}
287 					
288 						if (FadeOut != null) {
289 							buf.append(" {FadeOut " + FadeOut + "}");
290 						}
291 					
292    			return buf.toString();
293    		}
294  	
295  		// --- Extra Java from XML BEGIN (extra/code/java)
296         	
297 		// --- Extra Java from XML END (extra/code/java)
298  	
299 	        }
300