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