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 MOV 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  		Synchronous message. Movers can be doors, elevators, or any
26  		other chunk of architecture that can move. They generally need
27  		to be either run into, or activated by shooting or pressing a
28  		button. We are working on ways to provide bots with more of the
29  		information they need to deal with movers appropriately.
30  	
31           */
32   	public class MoverCompositeImpl 
33    				extends Mover
34  	    {
35   	
36      	
37      	
38      	/**
39      	 * Parameter-less contructor for the message.
40      	 */
41  		public MoverCompositeImpl()
42  		{
43  		}
44  	
45  		
46  		/**
47  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
48  		 *
49  		 * @param partLocal local-part of the message
50  		 * @param partShared shared-part of the message
51  		 * @param partStatic static-part of the message
52  		 */
53  		public MoverCompositeImpl(
54  			MoverLocalImpl partLocal,
55  			MoverSharedImpl partShared,
56  			MoverStaticImpl partStatic
57  		) {
58  			this.partLocal  = partLocal;
59  			this.partShared = partShared;
60  			this.partStatic = partStatic;
61  		}
62  		
63  		/**
64  		 * Cloning constructor.
65  		 *
66  		 * @param original		 
67  		 */
68  		public MoverCompositeImpl(MoverCompositeImpl original) {
69  			this.partLocal = partLocal;
70  			this.partShared = partShared;
71  			this.partStatic = partStatic;
72  		}
73      
74     				
75     				@Override
76     				public void setSimTime(long SimTime) {
77  					super.setSimTime(SimTime);
78  				}
79     			
80      			
81      			protected 
82      			MoverStaticImpl
83      			partStatic;
84      			
85      			@Override
86  				public MoverStatic getStatic() {
87  					return partStatic;
88  				}
89      			
90      			protected
91      			MoverLocalImpl
92      			partLocal;
93      	
94      			@Override
95  				public MoverLocal getLocal() {
96  					return partLocal;
97  				}
98  			
99      			MoverSharedImpl
100     			partShared;
101     			
102 				@Override
103 				public MoverShared getShared() {
104 					return partShared;
105 				}
106 			
107 				
108   				
109   					@Override
110     				
111  		/**
112          * 
113 			A unique Id of this mover assigned by the game.
114 		 
115          */
116         public  UnrealId getId()
117  	 {
118     					return 
119     						
120     								partStatic.
121     							getId()
122  	;
123     				}
124     			
125   					@Override
126     				
127  		/**
128          * Location of the mover. 
129          */
130         public  Location getLocation()
131  	 {
132     					return 
133     						
134     								partShared.
135     							getLocation()
136  	;
137     				}
138     			
139   					@Override
140     				
141  		/**
142          * If the mover is in the field of view of the bot. 
143          */
144         public  boolean isVisible()
145  	 {
146     					return 
147     						
148     								partLocal.
149     							isVisible()
150  	;
151     				}
152     			
153   					@Override
154     				
155  		/**
156          * 
157 			True if the mover needs to be shot to be activated.
158 		 
159          */
160         public  boolean isDamageTrig()
161  	 {
162     					return 
163     						
164     								partStatic.
165     							isDamageTrig()
166  	;
167     				}
168     			
169   					@Override
170     				
171  		/**
172          * String class of the mover. 
173          */
174         public  String getType()
175  	 {
176     					return 
177     						
178     								partStatic.
179     							getType()
180  	;
181     				}
182     			
183   					@Override
184     				
185  		/**
186          * Does the mover move right now? 
187          */
188         public  boolean isIsMoving()
189  	 {
190     					return 
191     						
192     								partStatic.
193     							isIsMoving()
194  	;
195     				}
196     			
197   					@Override
198     				
199  		/**
200          * Velocity vector. 
201          */
202         public  Velocity getVelocity()
203  	 {
204     					return 
205     						
206     								partShared.
207     							getVelocity()
208  	;
209     				}
210     			
211   					@Override
212     				
213  		/**
214          * How long the mover moves, when it becomes triggered, before it stops. 
215          */
216         public  double getMoveTime()
217  	 {
218     					return 
219     						
220     								partStatic.
221     							getMoveTime()
222  	;
223     				}
224     			
225   					@Override
226     				
227  		/**
228          * How long the mover stands still when it reaches its destination position. After
229       this time, the mover returns back to its initial position. 
230          */
231         public  double getOpenTime()
232  	 {
233     					return 
234     						
235     								partStatic.
236     							getOpenTime()
237  	;
238     				}
239     			
240   					@Override
241     				
242  		/**
243          * Base position of the mover. 
244          */
245         public  Location getBasePos()
246  	 {
247     					return 
248     						
249     								partStatic.
250     							getBasePos()
251  	;
252     				}
253     			
254   					@Override
255     				
256  		/**
257          * Base rotation of the mover. 
258          */
259         public  Location getBaseRot()
260  	 {
261     					return 
262     						
263     								partStatic.
264     							getBaseRot()
265  	;
266     				}
267     			
268   					@Override
269     				
270  		/**
271          * Delay before starting to open (or before lift starts to move). 
272          */
273         public  double getDelayTime()
274  	 {
275     					return 
276     						
277     								partStatic.
278     							getDelayTime()
279  	;
280     				}
281     			
282   					@Override
283     				
284  		/**
285          * Name of the state Mover is currently in. Can be used to determine the type of the mover.  
286          */
287         public  String getState()
288  	 {
289     					return 
290     						
291     								partShared.
292     							getState()
293  	;
294     				}
295     			
296   					@Override
297     				
298  		/**
299          * Navigation point marking this mover. We can parse this Id to get information about type of the mover. Marker Id contains "lift" string if it is a lift, "door" string if it is a door, etc.  
300          */
301         public  UnrealId getNavPointMarker()
302  	 {
303     					return 
304     						
305     								partStatic.
306     							getNavPointMarker()
307  	;
308     				}
309     			
310  		
311  	    public String toString() {
312             return
313             	super.toString() + "[" +
314             	
315             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
316             		
317 				"]";           		
318         }
319  	
320  		
321  		public String toHtmlString() {
322  			return super.toString() + "[<br/>" +
323             	
324             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
325             		
326 				"<br/>]";     
327 		}
328  	
329  		
330  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
331         	
332 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
333 		
334 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
335 	        
336 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
337  	
338 		}
339