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 IUO.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Sent when the observed player interacts with usable object.
25      
26           */
27   	public class InteractedUsableObject 
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      		"IUO {Name text}  {Location 0,0,0}  {UOEvent 0}  {Action text} ";
36      
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public InteractedUsableObject()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message InteractedUsableObject.
51  		 * 
52  		Asynchronous message. Sent when the observed player interacts with usable object.
53      
54  		 * Corresponding GameBots message
55  		 *   
56  		 *   is
57  		 *   IUO.
58  		 * 
59   	  	 * 
60  		 *   
61  		 *     @param Name 
62  			Name of the usable object.
63  		
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param Location 
68  			Location of the usable object.
69  		
70  		 *   
71  		 * 
72  		 *   
73  		 *     @param UOEvent 
74  			Code of the action performed.
75  		
76  		 *   
77  		 * 
78  		 *   
79  		 *     @param Action 
80  			Name of the action performed.
81  		
82  		 *   
83  		 * 
84  		 */
85  		public InteractedUsableObject(
86  			String Name,  Location Location,  int UOEvent,  String Action
87  		) {
88  			
89  					this.Name = Name;
90  				
91  					this.Location = Location;
92  				
93  					this.UOEvent = UOEvent;
94  				
95  					this.Action = Action;
96  				
97  		}
98      
99      	/**
100 		 * Cloning constructor from the full message.
101 		 *
102 		 * @param original
103 		 */
104 		public InteractedUsableObject(InteractedUsableObject original) {		
105 			
106 					this.Name = original.getName()
107  	;
108 				
109 					this.Location = original.getLocation()
110  	;
111 				
112 					this.UOEvent = original.getUOEvent()
113  	;
114 				
115 					this.Action = original.getAction()
116  	;
117 				
118 			this.SimTime = original.getSimTime();			
119 		}
120 		
121 	   		
122 			protected long SimTime;
123 				
124 			/**
125 			 * Simulation time in MILLI SECONDS !!!
126 			 */	
127 			@Override
128 			public long getSimTime() {
129 				return SimTime;
130 			}
131 						
132 			/**
133 			 * Used by Yylex to slip correct time of the object or programmatically.
134 			 */
135 			protected void setSimTime(long SimTime) {
136 				this.SimTime = SimTime;
137 			}
138 	   	
139     	
140 	    /**
141          * 
142 			Name of the usable object.
143 		 
144          */
145         protected
146          String Name =
147        	null;
148 	
149  		/**
150          * 
151 			Name of the usable object.
152 		 
153          */
154         public  String getName()
155  	 {
156     					return Name;
157     				}
158     			
159     	
160 	    /**
161          * 
162 			Location of the usable object.
163 		 
164          */
165         protected
166          Location Location =
167        	null;
168 	
169  		/**
170          * 
171 			Location of the usable object.
172 		 
173          */
174         public  Location getLocation()
175  	 {
176     					return Location;
177     				}
178     			
179     	
180 	    /**
181          * 
182 			Code of the action performed.
183 		 
184          */
185         protected
186          int UOEvent =
187        	0;
188 	
189  		/**
190          * 
191 			Code of the action performed.
192 		 
193          */
194         public  int getUOEvent()
195  	 {
196     					return UOEvent;
197     				}
198     			
199     	
200 	    /**
201          * 
202 			Name of the action performed.
203 		 
204          */
205         protected
206          String Action =
207        	null;
208 	
209  		/**
210          * 
211 			Name of the action performed.
212 		 
213          */
214         public  String getAction()
215  	 {
216     					return Action;
217     				}
218     			
219  		
220  	    public String toString() {
221             return
222             	super.toString() + "[" +
223             	
224 		              			"Name = " + String.valueOf(getName()
225  	) + " | " + 
226 		              		
227 		              			"Location = " + String.valueOf(getLocation()
228  	) + " | " + 
229 		              		
230 		              			"UOEvent = " + String.valueOf(getUOEvent()
231  	) + " | " + 
232 		              		
233 		              			"Action = " + String.valueOf(getAction()
234  	) + " | " + 
235 		              		
236 				"]";           		
237         }
238  	
239  		
240  		public String toHtmlString() {
241  			return super.toString() + "[<br/>" +
242             	
243 		              			"<b>Name</b> = " + String.valueOf(getName()
244  	) + " <br/> " + 
245 		              		
246 		              			"<b>Location</b> = " + String.valueOf(getLocation()
247  	) + " <br/> " + 
248 		              		
249 		              			"<b>UOEvent</b> = " + String.valueOf(getUOEvent()
250  	) + " <br/> " + 
251 		              		
252 		              			"<b>Action</b> = " + String.valueOf(getAction()
253  	) + " <br/> " + 
254 		              		
255 				"<br/>]";     
256 		}
257  	
258  	    public String toJsonLiteral() {
259             return "interactedusableobject( "
260             		+
261 									(getName()
262  	 == null ? "null" :
263 										"\"" + getName()
264  	 + "\"" 
265 									)
266 								+ ", " + 
267 								    (getLocation()
268  	 == null ? "null" :
269 										"[" + getLocation()
270  	.getX() + ", " + getLocation()
271  	.getY() + ", " + getLocation()
272  	.getZ() + "]" 
273 									)
274 								+ ", " + 
275 								    String.valueOf(getUOEvent()
276  	)									
277 								+ ", " + 
278 									(getAction()
279  	 == null ? "null" :
280 										"\"" + getAction()
281  	 + "\"" 
282 									)
283 								
284                    + ")";
285         }
286  	
287  		
288  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
289         	
290 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
291 		
292 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
293 	        
294 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
295  	
296 		}
297