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 HRP.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message - sent in synchronous batch (events are cached and then exported in the batch due
25  		to performance issues). 
26  		You hear someone pick up an object from	the ground. If the very same sound is exported repeatedly (same sound, same source), 
27  		it won't be exported more than once per second.
28  	
29           */
30   	public class HearPickup 
31    				extends InfoMessage
32      			implements IWorldEvent, IWorldChangeEvent
33      			
34  	    {
35   	
36      	/** Example how the message looks like - used during parser tests. */
37      	public static final String PROTOTYPE =
38      		"HRP {Source unreal_id}  {Type text}  {Rotation 0,0,0}  {Distance 0} ";
39      
40      	
41      	
42      	/**
43      	 * Parameter-less contructor for the message.
44      	 */
45  		public HearPickup()
46  		{
47  		}
48  	
49      	
50      	
51      	
52      	/**
53  		 * Creates new instance of the message HearPickup.
54  		 * 
55  		Synchronous message - sent in synchronous batch (events are cached and then exported in the batch due
56  		to performance issues). 
57  		You hear someone pick up an object from	the ground. If the very same sound is exported repeatedly (same sound, same source), 
58  		it won't be exported more than once per second.
59  	
60  		 * Corresponding GameBots message
61  		 *   
62  		 *   is
63  		 *   HRP.
64  		 * 
65   	  	 * 
66  		 *   
67  		 *     @param Source Unique Id of an object picked up.
68  		 *   
69  		 * 
70  		 *   
71  		 *     @param Type Class of the picked up actor.
72  		 *   
73  		 * 
74  		 *   
75  		 *     @param Rotation 
76  			How should bot rotate if it would like to be in the
77  			direction of the pickuped actor
78  		
79  		 *   
80  		 * 
81  		 *   
82  		 *     @param Distance 
83  			How far the noise source is. 
84  		
85  		 *   
86  		 * 
87  		 */
88  		public HearPickup(
89  			UnrealId Source,  String Type,  Rotation Rotation,  double Distance
90  		) {
91  			
92  					this.Source = Source;
93  				
94  					this.Type = Type;
95  				
96  					this.Rotation = Rotation;
97  				
98  					this.Distance = Distance;
99  				
100 		}
101     
102     	/**
103 		 * Cloning constructor from the full message.
104 		 *
105 		 * @param original
106 		 */
107 		public HearPickup(HearPickup original) {		
108 			
109 					this.Source = original.getSource()
110  	;
111 				
112 					this.Type = original.getType()
113  	;
114 				
115 					this.Rotation = original.getRotation()
116  	;
117 				
118 					this.Distance = original.getDistance()
119  	;
120 				
121 			this.SimTime = original.getSimTime();			
122 		}
123 		
124 	   		
125 			protected long SimTime;
126 				
127 			/**
128 			 * Simulation time in MILLI SECONDS !!!
129 			 */	
130 			@Override
131 			public long getSimTime() {
132 				return SimTime;
133 			}
134 						
135 			/**
136 			 * Used by Yylex to slip correct time of the object or programmatically.
137 			 */
138 			protected void setSimTime(long SimTime) {
139 				this.SimTime = SimTime;
140 			}
141 	   	
142     	
143 	    /**
144          * Unique Id of an object picked up. 
145          */
146         protected
147          UnrealId Source =
148        	null;
149 	
150  		/**
151          * Unique Id of an object picked up. 
152          */
153         public  UnrealId getSource()
154  	 {
155     					return Source;
156     				}
157     			
158     	
159 	    /**
160          * Class of the picked up actor. 
161          */
162         protected
163          String Type =
164        	null;
165 	
166  		/**
167          * Class of the picked up actor. 
168          */
169         public  String getType()
170  	 {
171     					return Type;
172     				}
173     			
174     	
175 	    /**
176          * 
177 			How should bot rotate if it would like to be in the
178 			direction of the pickuped actor
179 		 
180          */
181         protected
182          Rotation Rotation =
183        	null;
184 	
185  		/**
186          * 
187 			How should bot rotate if it would like to be in the
188 			direction of the pickuped actor
189 		 
190          */
191         public  Rotation getRotation()
192  	 {
193     					return Rotation;
194     				}
195     			
196     	
197 	    /**
198          * 
199 			How far the noise source is. 
200 		 
201          */
202         protected
203          double Distance =
204        	0;
205 	
206  		/**
207          * 
208 			How far the noise source is. 
209 		 
210          */
211         public  double getDistance()
212  	 {
213     					return Distance;
214     				}
215     			
216  		
217  	    public String toString() {
218             return
219             	super.toString() + "[" +
220             	
221 		              			"Source = " + String.valueOf(getSource()
222  	) + " | " + 
223 		              		
224 		              			"Type = " + String.valueOf(getType()
225  	) + " | " + 
226 		              		
227 		              			"Rotation = " + String.valueOf(getRotation()
228  	) + " | " + 
229 		              		
230 		              			"Distance = " + String.valueOf(getDistance()
231  	) + " | " + 
232 		              		
233 				"]";           		
234         }
235  	
236  		
237  		public String toHtmlString() {
238  			return super.toString() + "[<br/>" +
239             	
240 		              			"<b>Source</b> = " + String.valueOf(getSource()
241  	) + " <br/> " + 
242 		              		
243 		              			"<b>Type</b> = " + String.valueOf(getType()
244  	) + " <br/> " + 
245 		              		
246 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
247  	) + " <br/> " + 
248 		              		
249 		              			"<b>Distance</b> = " + String.valueOf(getDistance()
250  	) + " <br/> " + 
251 		              		
252 				"<br/>]";     
253 		}
254  	 
255  	    public String toJsonLiteral() {
256             return "HearPickup(null, "
257             		
258                    + ")";
259         }
260  	
261  		
262  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
263         	
264 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
265 		
266 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
267 	        
268 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
269  	
270 		}
271