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=static]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=static]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the static part of the GameBots2004 message MOV.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Movers can be doors, elevators, or any
25  		other chunk of architecture that can move. They generally need
26  		to be either run into, or activated by shooting or pressing a
27  		button. We are working on ways to provide bots with more of the
28  		information they need to deal with movers appropriately.
29  	
30           */
31   	public abstract class MoverStatic 
32    						extends InfoMessage
33    						implements IStaticWorldObject
34    						
35  	    {
36   	
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public MoverStatic()
43  		{
44  		}
45  		
46  				// abstract definition of the static-part of the message, no more constructors is needed
47  			
48  	   		
49  			protected long SimTime;
50  				
51  			/**
52  			 * Simulation time in MILLI SECONDS !!!
53  			 */	
54  			@Override
55  			public long getSimTime() {
56  				return SimTime;
57  			}
58  						
59  			/**
60  			 * Used by Yylex to slip correct time of the object or programmatically.
61  			 */
62  			protected void setSimTime(long SimTime) {
63  				this.SimTime = SimTime;
64  			}
65  	   	
66  	    			
67  	    				@Override
68  		    			public abstract 
69  		    			MoverStatic clone();
70  		    			
71  						@Override
72  						public Class getCompositeClass() {
73  							return Mover.class;
74  						}
75  	
76  						
77  		    			
78   		/**
79           * 
80  			A unique Id of this mover assigned by the game.
81  		 
82           */
83          public abstract UnrealId getId()
84   	;
85  		    			
86   		/**
87           * 
88  			True if the mover needs to be shot to be activated.
89  		 
90           */
91          public abstract boolean isDamageTrig()
92   	;
93  		    			
94   		/**
95           * String class of the mover. 
96           */
97          public abstract String getType()
98   	;
99  		    			
100  		/**
101          * Does the mover move right now? 
102          */
103         public abstract boolean isIsMoving()
104  	;
105 		    			
106  		/**
107          * How long the mover moves, when it becomes triggered, before it stops. 
108          */
109         public abstract double getMoveTime()
110  	;
111 		    			
112  		/**
113          * How long the mover stands still when it reaches its destination position. After
114       this time, the mover returns back to its initial position. 
115          */
116         public abstract double getOpenTime()
117  	;
118 		    			
119  		/**
120          * Base position of the mover. 
121          */
122         public abstract Location getBasePos()
123  	;
124 		    			
125  		/**
126          * Base rotation of the mover. 
127          */
128         public abstract Location getBaseRot()
129  	;
130 		    			
131  		/**
132          * Delay before starting to open (or before lift starts to move). 
133          */
134         public abstract double getDelayTime()
135  	;
136 		    			
137  		/**
138          * 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.  
139          */
140         public abstract UnrealId getNavPointMarker()
141  	;
142 		    			
143  		
144  		@Override
145  		public boolean isDifferentFrom(IStaticWorldObject other)
146  		{
147  			if (other == null) //early fail
148  			{
149  				return true;
150  			}
151  			else if (other == this) //early out
152  			{
153  				return false;
154  			}
155  			else
156  			{
157  				MoverStatic obj = (MoverStatic) other;
158 
159  				
160  						if ( !(
161  	 			AdvancedEquals.equalsOrNull(this.getId()
162  	, obj.getId()
163  	)
164  	 		) )
165 						{
166 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class MoverStatic");
167 							return true;
168 						}
169  					
170  						if ( !(this.isDamageTrig()
171  	
172  	 			== obj.isDamageTrig()
173  	) )
174 						{
175 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DamageTrig on object class MoverStatic");
176 							return true;
177 						}
178  					
179  						if ( !(
180  	 			AdvancedEquals.equalsOrNull(this.getType()
181  	, obj.getType()
182  	)
183  	 		) )
184 						{
185 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Type on object class MoverStatic");
186 							return true;
187 						}
188  					
189  						if ( !(this.isIsMoving()
190  	
191  	 			== obj.isIsMoving()
192  	) )
193 						{
194 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property IsMoving on object class MoverStatic");
195 							return true;
196 						}
197  					
198  						if ( !(this.getMoveTime()
199  	
200  	 			== obj.getMoveTime()
201  	) )
202 						{
203 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property MoveTime on object class MoverStatic");
204 							return true;
205 						}
206  					
207  						if ( !(this.getOpenTime()
208  	
209  	 			== obj.getOpenTime()
210  	) )
211 						{
212 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property OpenTime on object class MoverStatic");
213 							return true;
214 						}
215  					
216  						if ( !(
217  	 			AdvancedEquals.equalsOrNull(this.getBasePos()
218  	, obj.getBasePos()
219  	)
220  	 		) )
221 						{
222 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property BasePos on object class MoverStatic");
223 							return true;
224 						}
225  					
226  						if ( !(
227  	 			AdvancedEquals.equalsOrNull(this.getBaseRot()
228  	, obj.getBaseRot()
229  	)
230  	 		) )
231 						{
232 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property BaseRot on object class MoverStatic");
233 							return true;
234 						}
235  					
236  						if ( !(this.getDelayTime()
237  	
238  	 			== obj.getDelayTime()
239  	) )
240 						{
241 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DelayTime on object class MoverStatic");
242 							return true;
243 						}
244  					
245  						if ( !(
246  	 			AdvancedEquals.equalsOrNull(this.getNavPointMarker()
247  	, obj.getNavPointMarker()
248  	)
249  	 		) )
250 						{
251 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NavPointMarker on object class MoverStatic");
252 							return true;
253 						}
254  					
255  			}
256  			return false;
257  		}
258  	 
259  		
260  	    public String toString() {
261             return
262             	super.toString() + "[" +
263             	
264 		              			"Id = " + String.valueOf(getId()
265  	) + " | " + 
266 		              		
267 		              			"DamageTrig = " + String.valueOf(isDamageTrig()
268  	) + " | " + 
269 		              		
270 		              			"Type = " + String.valueOf(getType()
271  	) + " | " + 
272 		              		
273 		              			"IsMoving = " + String.valueOf(isIsMoving()
274  	) + " | " + 
275 		              		
276 		              			"MoveTime = " + String.valueOf(getMoveTime()
277  	) + " | " + 
278 		              		
279 		              			"OpenTime = " + String.valueOf(getOpenTime()
280  	) + " | " + 
281 		              		
282 		              			"BasePos = " + String.valueOf(getBasePos()
283  	) + " | " + 
284 		              		
285 		              			"BaseRot = " + String.valueOf(getBaseRot()
286  	) + " | " + 
287 		              		
288 		              			"DelayTime = " + String.valueOf(getDelayTime()
289  	) + " | " + 
290 		              		
291 		              			"NavPointMarker = " + String.valueOf(getNavPointMarker()
292  	) + " | " + 
293 		              		
294 				"]";           		
295         }
296  	
297  		
298  		public String toHtmlString() {
299  			return super.toString() + "[<br/>" +
300             	
301 		              			"<b>Id</b> = " + String.valueOf(getId()
302  	) + " <br/> " + 
303 		              		
304 		              			"<b>DamageTrig</b> = " + String.valueOf(isDamageTrig()
305  	) + " <br/> " + 
306 		              		
307 		              			"<b>Type</b> = " + String.valueOf(getType()
308  	) + " <br/> " + 
309 		              		
310 		              			"<b>IsMoving</b> = " + String.valueOf(isIsMoving()
311  	) + " <br/> " + 
312 		              		
313 		              			"<b>MoveTime</b> = " + String.valueOf(getMoveTime()
314  	) + " <br/> " + 
315 		              		
316 		              			"<b>OpenTime</b> = " + String.valueOf(getOpenTime()
317  	) + " <br/> " + 
318 		              		
319 		              			"<b>BasePos</b> = " + String.valueOf(getBasePos()
320  	) + " <br/> " + 
321 		              		
322 		              			"<b>BaseRot</b> = " + String.valueOf(getBaseRot()
323  	) + " <br/> " + 
324 		              		
325 		              			"<b>DelayTime</b> = " + String.valueOf(getDelayTime()
326  	) + " <br/> " + 
327 		              		
328 		              			"<b>NavPointMarker</b> = " + String.valueOf(getNavPointMarker()
329  	) + " <br/> " + 
330 		              		
331 				"<br/>]";     
332 		}
333  	
334  		
335  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
336         	
337 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
338 		
339 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---
340 	        
341 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---        	            	
342  	
343 		}
344