View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2    		
3    		// --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
4   			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.*;
5   		// --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6   		
7   		
8   		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9   				
10  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11  		
12  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15      
16   		/**
17           *  
18           			Definition of the event VMT.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Recieved message from team chat channel.
25  	
26           */
27   	public class TeamChat 
28    				extends InfoMessage
29      			implements IWorldEvent, IWorldChangeEvent
30      			
31  	    {
32   	
33      	/** Example how the message looks like - used during parser tests. */
34      	public static final String PROTOTYPE =
35      		"VMT {Id unreal_id}  {Name text}  {ControlServer False}  {Text text} ";
36      
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public TeamChat()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message TeamChat.
51  		 * 
52  		Asynchronous message. Recieved message from team chat channel.
53  	
54  		 * Corresponding GameBots message
55  		 *   
56  		 *   is
57  		 *   VMT.
58  		 * 
59   	  	 * 
60  		 *   
61  		 *     @param Id 
62  			Unique UnrealId of the sender.
63  		
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param Name 
68  			Human readable name of the sender.
69  		
70  		 *   
71  		 * 
72  		 *   
73  		 *     @param ControlServer 
74  			True if this message was sent by control server - in that case the id will be id of control server (that has no physical appearance in the game).
75  		
76  		 *   
77  		 * 
78  		 *   
79  		 *     @param Text 
80  			A human readable message sent by a team mate in the game on
81  			the private team channel.
82  		
83  		 *   
84  		 * 
85  		 */
86  		public TeamChat(
87  			UnrealId Id,  String Name,  Boolean ControlServer,  String Text
88  		) {
89  			
90  					this.Id = Id;
91  				
92  					this.Name = Name;
93  				
94  					this.ControlServer = ControlServer;
95  				
96  					this.Text = Text;
97  				
98  		}
99      
100     	/**
101 		 * Cloning constructor from the full message.
102 		 *
103 		 * @param original
104 		 */
105 		public TeamChat(TeamChat original) {		
106 			
107 					this.Id = original.getId()
108  	;
109 				
110 					this.Name = original.getName()
111  	;
112 				
113 					this.ControlServer = original.isControlServer()
114  	;
115 				
116 					this.Text = original.getText()
117  	;
118 				
119 			this.SimTime = original.getSimTime();			
120 		}
121 		
122 	   		
123 			protected long SimTime;
124 				
125 			/**
126 			 * Simulation time in MILLI SECONDS !!!
127 			 */	
128 			@Override
129 			public long getSimTime() {
130 				return SimTime;
131 			}
132 						
133 			/**
134 			 * Used by Yylex to slip correct time of the object or programmatically.
135 			 */
136 			protected void setSimTime(long SimTime) {
137 				this.SimTime = SimTime;
138 			}
139 	   	
140     	
141 	    /**
142          * 
143 			Unique UnrealId of the sender.
144 		 
145          */
146         protected
147          UnrealId Id =
148        	null;
149 	
150  		/**
151          * 
152 			Unique UnrealId of the sender.
153 		 
154          */
155         public  UnrealId getId()
156  	 {
157     					return Id;
158     				}
159     			
160     	
161 	    /**
162          * 
163 			Human readable name of the sender.
164 		 
165          */
166         protected
167          String Name =
168        	null;
169 	
170  		/**
171          * 
172 			Human readable name of the sender.
173 		 
174          */
175         public  String getName()
176  	 {
177     					return Name;
178     				}
179     			
180     	
181 	    /**
182          * 
183 			True if this message was sent by control server - in that case the id will be id of control server (that has no physical appearance in the game).
184 		 
185          */
186         protected
187          Boolean ControlServer =
188        	null;
189 	
190  		/**
191          * 
192 			True if this message was sent by control server - in that case the id will be id of control server (that has no physical appearance in the game).
193 		 
194          */
195         public  Boolean isControlServer()
196  	 {
197     					return ControlServer;
198     				}
199     			
200     	
201 	    /**
202          * 
203 			A human readable message sent by a team mate in the game on
204 			the private team channel.
205 		 
206          */
207         protected
208          String Text =
209        	null;
210 	
211  		/**
212          * 
213 			A human readable message sent by a team mate in the game on
214 			the private team channel.
215 		 
216          */
217         public  String getText()
218  	 {
219     					return Text;
220     				}
221     			
222  		
223  	    public String toString() {
224             return
225             	super.toString() + "[" +
226             	
227 		              			"Id = " + String.valueOf(getId()
228  	) + " | " + 
229 		              		
230 		              			"Name = " + String.valueOf(getName()
231  	) + " | " + 
232 		              		
233 		              			"ControlServer = " + String.valueOf(isControlServer()
234  	) + " | " + 
235 		              		
236 		              			"Text = " + String.valueOf(getText()
237  	) + " | " + 
238 		              		
239 				"]";           		
240         }
241  	
242  		
243  		public String toHtmlString() {
244  			return super.toString() + "[<br/>" +
245             	
246 		              			"<b>Id</b> = " + String.valueOf(getId()
247  	) + " <br/> " + 
248 		              		
249 		              			"<b>Name</b> = " + String.valueOf(getName()
250  	) + " <br/> " + 
251 		              		
252 		              			"<b>ControlServer</b> = " + String.valueOf(isControlServer()
253  	) + " <br/> " + 
254 		              		
255 		              			"<b>Text</b> = " + String.valueOf(getText()
256  	) + " <br/> " + 
257 		              		
258 				"<br/>]";     
259 		}
260  	
261  	    public String toJsonLiteral() {
262             return "teamchat( "
263             		+
264 									(getId()
265  	 == null ? "null" :
266 										"\"" + getId()
267  	.getStringId() + "\"" 
268 									)
269 								+ ", " + 
270 									(getName()
271  	 == null ? "null" :
272 										"\"" + getName()
273  	 + "\"" 
274 									)
275 								+ ", " + 
276 								    String.valueOf(isControlServer()
277  	)									
278 								+ ", " + 
279 									(getText()
280  	 == null ? "null" :
281 										"\"" + getText()
282  	 + "\"" 
283 									)
284 								
285                    + ")";
286         }
287  	
288  		
289  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
290         	
291 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
292 		
293 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
294 	        
295 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
296  	
297 		}
298