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=composite]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=composite]+classtype[@name=impl] END
15      
16   		/**
17           *  
18              		Composite implementation of the PRJ abstract message. It wraps Local/Shared/Static parts in single object
19              		allowing to presenting a nice facade for users.
20              	
21           *
22           *  <p></p><p></p>
23           *  Complete message documentation:               
24           *  
25  		Both asynchronous and synchronous message. Incoming projectile that we can see.
26  	
27           */
28   	public class IncomingProjectileCompositeImpl 
29    				extends IncomingProjectile
30  	    {
31   	
32      	
33      	
34      	/**
35      	 * Parameter-less contructor for the message.
36      	 */
37  		public IncomingProjectileCompositeImpl()
38  		{
39  		}
40  	
41  		
42  		/**
43  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
44  		 *
45  		 * @param partLocal local-part of the message
46  		 * @param partShared shared-part of the message
47  		 * @param partStatic static-part of the message
48  		 */
49  		public IncomingProjectileCompositeImpl(
50  			IncomingProjectileLocalImpl partLocal,
51  			IncomingProjectileSharedImpl partShared,
52  			IncomingProjectileStaticImpl partStatic
53  		) {
54  			this.partLocal  = partLocal;
55  			this.partShared = partShared;
56  			this.partStatic = partStatic;
57  		}
58  		
59  		/**
60  		 * Cloning constructor.
61  		 *
62  		 * @param original		 
63  		 */
64  		public IncomingProjectileCompositeImpl(IncomingProjectileCompositeImpl original) {
65  			this.partLocal = partLocal;
66  			this.partShared = partShared;
67  			this.partStatic = partStatic;
68  		}
69      
70     				
71     				@Override
72     				public void setSimTime(long SimTime) {
73  					super.setSimTime(SimTime);
74  				}
75     			
76      			
77      			protected 
78      			IncomingProjectileStaticImpl
79      			partStatic;
80      			
81      			@Override
82  				public IncomingProjectileStatic getStatic() {
83  					return partStatic;
84  				}
85      			
86      			protected
87      			IncomingProjectileLocalImpl
88      			partLocal;
89      	
90      			@Override
91  				public IncomingProjectileLocal getLocal() {
92  					return partLocal;
93  				}
94  			
95      			IncomingProjectileSharedImpl
96      			partShared;
97      			
98  				@Override
99  				public IncomingProjectileShared getShared() {
100 					return partShared;
101 				}
102 			
103 				
104   				
105   					@Override
106     				
107  		/**
108          * Unique Id of the projectile. 
109          */
110         public  UnrealId getId()
111  	 {
112     					return 
113     						
114     								partStatic.
115     							getId()
116  	;
117     				}
118     			
119   					@Override
120     				
121  		/**
122          * Estimated time till impact. 
123          */
124         public  double getImpactTime()
125  	 {
126     					return 
127     						
128     								partLocal.
129     							getImpactTime()
130  	;
131     				}
132     			
133   					@Override
134     				
135  		/**
136          * 
137 			Which direction projectile is heading to -> orientation
138 			vector.
139 		 
140          */
141         public  Vector3d getDirection()
142  	 {
143     					return 
144     						
145     								partShared.
146     							getDirection()
147  	;
148     				}
149     			
150   					@Override
151     				
152  		/**
153          * 
154 			Current location of the projectile.
155 		 
156          */
157         public  Location getLocation()
158  	 {
159     					return 
160     						
161     								partShared.
162     							getLocation()
163  	;
164     				}
165     			
166   					@Override
167     				
168  		/**
169          * 
170 			Current velocity vector of the projectile.
171 		 
172          */
173         public  Velocity getVelocity()
174  	 {
175     					return 
176     						
177     								partShared.
178     							getVelocity()
179  	;
180     				}
181     			
182   					@Override
183     				
184  		/**
185          * 
186 			Current speed of the projectile.
187 		 
188          */
189         public  double getSpeed()
190  	 {
191     					return 
192     						
193     								partShared.
194     							getSpeed()
195  	;
196     				}
197     			
198   					@Override
199     				
200  		/**
201          * 
202 			Possition of the origin, when combined with direction can
203 			define the line of fire.
204 		 
205          */
206         public  Location getOrigin()
207  	 {
208     					return 
209     						
210     								partShared.
211     							getOrigin()
212  	;
213     				}
214     			
215   					@Override
216     				
217  		/**
218          * 
219 			If the projectile has splash damage, how big it is – in ut
220 			units.
221 		 
222          */
223         public  double getDamageRadius()
224  	 {
225     					return 
226     						
227     								partShared.
228     							getDamageRadius()
229  	;
230     				}
231     			
232   					@Override
233     				
234  		/**
235          * 
236 			The class of the projectile (so you know what is flying
237 			against you).
238 		 
239          */
240         public  String getType()
241  	 {
242     					return 
243     						
244     								partShared.
245     							getType()
246  	;
247     				}
248     			
249   					@Override
250     				
251  		/**
252          * 
253 			The class of the projectile (so you know what is flying
254 			against you).
255 		 
256          */
257         public  boolean isVisible()
258  	 {
259     					return 
260     						
261     								partLocal.
262     							isVisible()
263  	;
264     				}
265     			
266  		
267  	    public String toString() {
268             return
269             	super.toString() + "[" +
270             	
271             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
272             		
273 				"]";           		
274         }
275  	
276  		
277  		public String toHtmlString() {
278  			return super.toString() + "[<br/>" +
279             	
280             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
281             		
282 				"<br/>]";     
283 		}
284  	
285  		
286  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
287         	
288 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
289 		
290 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
291 	        
292 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
293  	
294 		}
295