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=shared]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=shared]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the shared part of the GameBots2004 message PRJ.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Both asynchronous and synchronous message. Incoming projectile that we can see.
25  	
26           */
27   	public abstract class IncomingProjectileShared 
28    						extends InfoMessage
29    						implements ISharedWorldObject
30    						
31  	    		,ILocated
32  	    {
33   	
34      	
35      	
36      	/**
37      	 * Parameter-less contructor for the message.
38      	 */
39  		public IncomingProjectileShared()
40  		{
41  		}
42  		
43  				// abstract definition of the shared-part of the message, no more constructors is needed
44  			
45  	   		
46  			protected long SimTime;
47  				
48  			/**
49  			 * Simulation time in MILLI SECONDS !!!
50  			 */	
51  			@Override
52  			public long getSimTime() {
53  				return SimTime;
54  			}
55  						
56  			/**
57  			 * Used by Yylex to slip correct time of the object or programmatically.
58  			 */
59  			protected void setSimTime(long SimTime) {
60  				this.SimTime = SimTime;
61  			}
62  	   	
63  	    						public static final Token DirectionPropertyToken = Tokens.get("Direction");
64  	    					
65  	    						public static final Token LocationPropertyToken = Tokens.get("Location");
66  	    					
67  	    						public static final Token VelocityPropertyToken = Tokens.get("Velocity");
68  	    					
69  	    						public static final Token SpeedPropertyToken = Tokens.get("Speed");
70  	    					
71  	    						public static final Token OriginPropertyToken = Tokens.get("Origin");
72  	    					
73  	    						public static final Token DamageRadiusPropertyToken = Tokens.get("DamageRadius");
74  	    					
75  	    						public static final Token TypePropertyToken = Tokens.get("Type");
76  	    						
77  							
78  							public static final Set<Token> SharedPropertyTokens;
79  	
80  							static {
81  								Set<Token> tokens = new HashSet<Token>();
82  								
83  									tokens.add(DirectionPropertyToken);
84  								
85  									tokens.add(LocationPropertyToken);
86  								
87  									tokens.add(VelocityPropertyToken);
88  								
89  									tokens.add(SpeedPropertyToken);
90  								
91  									tokens.add(OriginPropertyToken);
92  								
93  									tokens.add(DamageRadiusPropertyToken);
94  								
95  									tokens.add(TypePropertyToken);
96  								
97  								SharedPropertyTokens = Collections.unmodifiableSet(tokens);
98  							}
99  	    				
100 	    			
101 	    				@Override
102 		    			public abstract 
103 		    			IncomingProjectileShared clone();
104 		    			
105 						@Override
106 						public Class getCompositeClass() {
107 							return IncomingProjectile.class;
108 						}
109 	
110 						
111 		    			
112  		/**
113          * Unique Id of the projectile. 
114          */
115         public abstract UnrealId getId()
116  	;
117 		    			
118  		/**
119          * 
120 			Which direction projectile is heading to -> orientation
121 			vector.
122 		 
123          */
124         public abstract Vector3d getDirection()
125  	;
126 		    			
127  		/**
128          * 
129 			Current location of the projectile.
130 		 
131          */
132         public abstract Location getLocation()
133  	;
134 		    			
135  		/**
136          * 
137 			Current velocity vector of the projectile.
138 		 
139          */
140         public abstract Velocity getVelocity()
141  	;
142 		    			
143  		/**
144          * 
145 			Current speed of the projectile.
146 		 
147          */
148         public abstract double getSpeed()
149  	;
150 		    			
151  		/**
152          * 
153 			Possition of the origin, when combined with direction can
154 			define the line of fire.
155 		 
156          */
157         public abstract Location getOrigin()
158  	;
159 		    			
160  		/**
161          * 
162 			If the projectile has splash damage, how big it is – in ut
163 			units.
164 		 
165          */
166         public abstract double getDamageRadius()
167  	;
168 		    			
169  		/**
170          * 
171 			The class of the projectile (so you know what is flying
172 			against you).
173 		 
174          */
175         public abstract String getType()
176  	;
177 		    			
178  		
179  	    public String toString() {
180             return
181             	super.toString() + "[" +
182             	
183 		              			"Id = " + String.valueOf(getId()
184  	) + " | " + 
185 		              		
186 		              			"Direction = " + String.valueOf(getDirection()
187  	) + " | " + 
188 		              		
189 		              			"Location = " + String.valueOf(getLocation()
190  	) + " | " + 
191 		              		
192 		              			"Velocity = " + String.valueOf(getVelocity()
193  	) + " | " + 
194 		              		
195 		              			"Speed = " + String.valueOf(getSpeed()
196  	) + " | " + 
197 		              		
198 		              			"Origin = " + String.valueOf(getOrigin()
199  	) + " | " + 
200 		              		
201 		              			"DamageRadius = " + String.valueOf(getDamageRadius()
202  	) + " | " + 
203 		              		
204 		              			"Type = " + String.valueOf(getType()
205  	) + " | " + 
206 		              		
207 				"]";           		
208         }
209  	
210  		
211  		public String toHtmlString() {
212  			return super.toString() + "[<br/>" +
213             	
214 		              			"<b>Id</b> = " + String.valueOf(getId()
215  	) + " <br/> " + 
216 		              		
217 		              			"<b>Direction</b> = " + String.valueOf(getDirection()
218  	) + " <br/> " + 
219 		              		
220 		              			"<b>Location</b> = " + String.valueOf(getLocation()
221  	) + " <br/> " + 
222 		              		
223 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
224  	) + " <br/> " + 
225 		              		
226 		              			"<b>Speed</b> = " + String.valueOf(getSpeed()
227  	) + " <br/> " + 
228 		              		
229 		              			"<b>Origin</b> = " + String.valueOf(getOrigin()
230  	) + " <br/> " + 
231 		              		
232 		              			"<b>DamageRadius</b> = " + String.valueOf(getDamageRadius()
233  	) + " <br/> " + 
234 		              		
235 		              			"<b>Type</b> = " + String.valueOf(getType()
236  	) + " <br/> " + 
237 		              		
238 				"<br/>]";     
239 		}
240  	
241  		
242  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
243         	
244 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
245 		
246 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---
247 	        
248 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---        	            	
249  	
250 		}
251