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 WAL.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. We have collided with a wall. Note it is
25  		common to get a bunch of these when you try to run through a
26  		wall or are pushed into one by gunfire or something.
27  	
28           */
29   	public class WallCollision 
30    				extends InfoMessage
31      			implements IWorldEvent, IWorldChangeEvent
32      			
33  	    {
34   	
35      	/** Example how the message looks like - used during parser tests. */
36      	public static final String PROTOTYPE =
37      		"WAL {Id text}  {Normal 0,0,0}  {Location 0,0,0} ";
38      
39      	
40      	
41      	/**
42      	 * Parameter-less contructor for the message.
43      	 */
44  		public WallCollision()
45  		{
46  		}
47  	
48      	
49      	
50      	
51      	/**
52  		 * Creates new instance of the message WallCollision.
53  		 * 
54  		Asynchronous message. We have collided with a wall. Note it is
55  		common to get a bunch of these when you try to run through a
56  		wall or are pushed into one by gunfire or something.
57  	
58  		 * Corresponding GameBots message
59  		 *   
60  		 *   is
61  		 *   WAL.
62  		 * 
63   	  	 * 
64  		 *   
65  		 *     @param Id 
66  			Id of the wall we have hit (level geometry).
67  		
68  		 *   
69  		 * 
70  		 *   
71  		 *     @param Normal 
72  			Normal of the wall bot collided with.
73  		
74  		 *   
75  		 * 
76  		 *   
77  		 *     @param Location 
78  			Absolute location of bot at the time of impact.
79  		
80  		 *   
81  		 * 
82  		 */
83  		public WallCollision(
84  			String Id,  Vector3d Normal,  Location Location
85  		) {
86  			
87  					this.Id = Id;
88  				
89  					this.Normal = Normal;
90  				
91  					this.Location = Location;
92  				
93  		}
94      
95      	/**
96  		 * Cloning constructor from the full message.
97  		 *
98  		 * @param original
99  		 */
100 		public WallCollision(WallCollision original) {		
101 			
102 					this.Id = original.getId()
103  	;
104 				
105 					this.Normal = original.getNormal()
106  	;
107 				
108 					this.Location = original.getLocation()
109  	;
110 				
111 			this.SimTime = original.getSimTime();			
112 		}
113 		
114 	   		
115 			protected long SimTime;
116 				
117 			/**
118 			 * Simulation time in MILLI SECONDS !!!
119 			 */	
120 			@Override
121 			public long getSimTime() {
122 				return SimTime;
123 			}
124 						
125 			/**
126 			 * Used by Yylex to slip correct time of the object or programmatically.
127 			 */
128 			protected void setSimTime(long SimTime) {
129 				this.SimTime = SimTime;
130 			}
131 	   	
132     	
133 	    /**
134          * 
135 			Id of the wall we have hit (level geometry).
136 		 
137          */
138         protected
139          String Id =
140        	null;
141 	
142  		/**
143          * 
144 			Id of the wall we have hit (level geometry).
145 		 
146          */
147         public  String getId()
148  	 {
149     					return Id;
150     				}
151     			
152     	
153 	    /**
154          * 
155 			Normal of the wall bot collided with.
156 		 
157          */
158         protected
159          Vector3d Normal =
160        	null;
161 	
162  		/**
163          * 
164 			Normal of the wall bot collided with.
165 		 
166          */
167         public  Vector3d getNormal()
168  	 {
169     					return Normal;
170     				}
171     			
172     	
173 	    /**
174          * 
175 			Absolute location of bot at the time of impact.
176 		 
177          */
178         protected
179          Location Location =
180        	null;
181 	
182  		/**
183          * 
184 			Absolute location of bot at the time of impact.
185 		 
186          */
187         public  Location getLocation()
188  	 {
189     					return Location;
190     				}
191     			
192  		
193  	    public String toString() {
194             return
195             	super.toString() + "[" +
196             	
197 		              			"Id = " + String.valueOf(getId()
198  	) + " | " + 
199 		              		
200 		              			"Normal = " + String.valueOf(getNormal()
201  	) + " | " + 
202 		              		
203 		              			"Location = " + String.valueOf(getLocation()
204  	) + " | " + 
205 		              		
206 				"]";           		
207         }
208  	
209  		
210  		public String toHtmlString() {
211  			return super.toString() + "[<br/>" +
212             	
213 		              			"<b>Id</b> = " + String.valueOf(getId()
214  	) + " <br/> " + 
215 		              		
216 		              			"<b>Normal</b> = " + String.valueOf(getNormal()
217  	) + " <br/> " + 
218 		              		
219 		              			"<b>Location</b> = " + String.valueOf(getLocation()
220  	) + " <br/> " + 
221 		              		
222 				"<br/>]";     
223 		}
224  	
225  	    public String toJsonLiteral() {
226             return "wallcollision( "
227             		+
228 									(getId()
229  	 == null ? "null" :
230 										"\"" + getId()
231  	 + "\"" 
232 									)
233 								+ ", " + 
234 									(getNormal()
235  	 == null ? "null" :
236 										"[" + getNormal()
237  	.getX() + ", " + getNormal()
238  	.getY() + ", " + getNormal()
239  	.getZ() + "]" 
240 									)
241 								+ ", " + 
242 								    (getLocation()
243  	 == null ? "null" :
244 										"[" + getLocation()
245  	.getX() + ", " + getLocation()
246  	.getY() + ", " + getLocation()
247  	.getZ() + "]" 
248 									)
249 								
250                    + ")";
251         }
252  	
253  		
254  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
255         	
256 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
257 		
258 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
259 	        
260 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
261  	
262 		}
263