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}  {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 Text 
74  			A human readable message sent by a team mate in the game on
75  			the private team channel.
76  		
77  		 *   
78  		 * 
79  		 */
80  		public TeamChat(
81  			UnrealId Id,  String Name,  String Text
82  		) {
83  			
84  					this.Id = Id;
85  				
86  					this.Name = Name;
87  				
88  					this.Text = Text;
89  				
90  		}
91      
92      	/**
93  		 * Cloning constructor from the full message.
94  		 *
95  		 * @param original
96  		 */
97  		public TeamChat(TeamChat original) {		
98  			
99  					this.Id = original.getId()
100  	;
101 				
102 					this.Name = original.getName()
103  	;
104 				
105 					this.Text = original.getText()
106  	;
107 				
108 			this.SimTime = original.getSimTime();			
109 		}
110 		
111 	   		
112 			protected long SimTime;
113 				
114 			/**
115 			 * Simulation time in MILLI SECONDS !!!
116 			 */	
117 			@Override
118 			public long getSimTime() {
119 				return SimTime;
120 			}
121 						
122 			/**
123 			 * Used by Yylex to slip correct time of the object or programmatically.
124 			 */
125 			protected void setSimTime(long SimTime) {
126 				this.SimTime = SimTime;
127 			}
128 	   	
129     	
130 	    /**
131          * 
132 			Unique UnrealId of the sender.
133 		 
134          */
135         protected
136          UnrealId Id =
137        	null;
138 	
139  		/**
140          * 
141 			Unique UnrealId of the sender.
142 		 
143          */
144         public  UnrealId getId()
145  	 {
146     					return Id;
147     				}
148     			
149     	
150 	    /**
151          * 
152 			Human readable name of the sender.
153 		 
154          */
155         protected
156          String Name =
157        	null;
158 	
159  		/**
160          * 
161 			Human readable name of the sender.
162 		 
163          */
164         public  String getName()
165  	 {
166     					return Name;
167     				}
168     			
169     	
170 	    /**
171          * 
172 			A human readable message sent by a team mate in the game on
173 			the private team channel.
174 		 
175          */
176         protected
177          String Text =
178        	null;
179 	
180  		/**
181          * 
182 			A human readable message sent by a team mate in the game on
183 			the private team channel.
184 		 
185          */
186         public  String getText()
187  	 {
188     					return Text;
189     				}
190     			
191  		
192  	    public String toString() {
193             return
194             	super.toString() + "[" +
195             	
196 		              			"Id = " + String.valueOf(getId()
197  	) + " | " + 
198 		              		
199 		              			"Name = " + String.valueOf(getName()
200  	) + " | " + 
201 		              		
202 		              			"Text = " + String.valueOf(getText()
203  	) + " | " + 
204 		              		
205 				"]";           		
206         }
207  	
208  		
209  		public String toHtmlString() {
210  			return super.toString() + "[<br/>" +
211             	
212 		              			"<b>Id</b> = " + String.valueOf(getId()
213  	) + " <br/> " + 
214 		              		
215 		              			"<b>Name</b> = " + String.valueOf(getName()
216  	) + " <br/> " + 
217 		              		
218 		              			"<b>Text</b> = " + String.valueOf(getText()
219  	) + " <br/> " + 
220 		              		
221 				"<br/>]";     
222 		}
223  	 
224  	    public String toJsonLiteral() {
225             return "TeamChat(null, "
226             		
227                    + ")";
228         }
229  	
230  		
231  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
232         	
233 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
234 		
235 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
236 	        
237 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
238  	
239 		}
240