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 INV.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous/asynchronous message. An object on the ground that
25  		can be picked up.
26  	
27           */
28   	public abstract class ItemStatic 
29    						extends InfoMessage
30    						implements IStaticWorldObject
31    						
32  	    {
33   	
34      	
35      	
36      	/**
37      	 * Parameter-less contructor for the message.
38      	 */
39  		public ItemStatic()
40  		{
41  		}
42  		
43  				// abstract definition of the static-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  	    			
64  	    				@Override
65  		    			public abstract 
66  		    			ItemStatic clone();
67  		    			
68  						@Override
69  						public Class getCompositeClass() {
70  							return Item.class;
71  						}
72  	
73  						
74  		    			
75   		/**
76           * 
77  			Unique Id of the item. This Id represents just item on the
78  			map, not in our inventory.
79  		 
80           */
81          public abstract UnrealId getId()
82   	;
83  		    			
84   		/**
85           * 
86              Id of the navpoint where the item is laying. If null - the item was dropped by the bot or another player.
87           
88           */
89          public abstract UnrealId getNavPointId()
90   	;
91  		    			
92   		/**
93           * 
94              If the Item is not dropped then it's item that is laying at some navpoint and
95              this is that NavPoint instance.
96           
97           */
98          public abstract NavPoint getNavPoint()
99   	;
100 		    			
101  		/**
102          * 
103 			If this item is some ammo or health pack, here we can find
104 			out how much of the attribute this item will add.
105 		 
106          */
107         public abstract int getAmount()
108  	;
109 		    			
110  		/**
111          * 
112 			Class of the item (e.g. xWeapons.FlakCannonPickup).
113 		 
114          */
115         public abstract ItemType getType()
116  	;
117 		    			
118  		/**
119          * 
120 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
121 		 
122          */
123         public abstract ItemDescriptor getDescriptor()
124  	;
125 		    			
126  		
127  		@Override
128  		public boolean isDifferentFrom(IStaticWorldObject other)
129  		{
130  			if (other == null) //early fail
131  			{
132  				return true;
133  			}
134  			else if (other == this) //early out
135  			{
136  				return false;
137  			}
138  			else
139  			{
140  				ItemStatic obj = (ItemStatic) other;
141 
142  				
143  						if ( !(
144  	 			AdvancedEquals.equalsOrNull(this.getId()
145  	, obj.getId()
146  	)
147  	 		) )
148 						{
149 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class ItemStatic");
150 							return true;
151 						}
152  					
153  						if ( !(
154  	 			AdvancedEquals.equalsOrNull(this.getNavPointId()
155  	, obj.getNavPointId()
156  	)
157  	 		) )
158 						{
159 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NavPointId on object class ItemStatic");
160 							return true;
161 						}
162  					
163  						if ( !(
164  	 			AdvancedEquals.equalsOrNull(this.getNavPoint()
165  	, obj.getNavPoint()
166  	)
167  	 		) )
168 						{
169 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NavPoint on object class ItemStatic");
170 							return true;
171 						}
172  					
173  						if ( !(this.getAmount()
174  	
175  	 			== obj.getAmount()
176  	) )
177 						{
178 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Amount on object class ItemStatic");
179 							return true;
180 						}
181  					
182  						if ( !(
183  	 			AdvancedEquals.equalsOrNull(this.getType()
184  	, obj.getType()
185  	)
186  	 		) )
187 						{
188 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Type on object class ItemStatic");
189 							return true;
190 						}
191  					
192  						if ( !(
193  	 			AdvancedEquals.equalsOrNull(this.getDescriptor()
194  	, obj.getDescriptor()
195  	)
196  	 		) )
197 						{
198 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Descriptor on object class ItemStatic");
199 							return true;
200 						}
201  					
202  			}
203  			return false;
204  		}
205  	 
206  		
207  	    public String toString() {
208             return
209             	super.toString() + "[" +
210             	
211 		              			"Id = " + String.valueOf(getId()
212  	) + " | " + 
213 		              		
214 		              			"NavPointId = " + String.valueOf(getNavPointId()
215  	) + " | " + 
216 		              		
217 		              			"Amount = " + String.valueOf(getAmount()
218  	) + " | " + 
219 		              		
220 		              			"Type = " + String.valueOf(getType()
221  	) + " | " + 
222 		              		
223 				"]";           		
224         }
225  	
226  		
227  		public String toHtmlString() {
228  			return super.toString() + "[<br/>" +
229             	
230 		              			"<b>Id</b> = " + String.valueOf(getId()
231  	) + " <br/> " + 
232 		              		
233 		              			"<b>NavPointId</b> = " + String.valueOf(getNavPointId()
234  	) + " <br/> " + 
235 		              		
236 		              			"<b>Amount</b> = " + String.valueOf(getAmount()
237  	) + " <br/> " + 
238 		              		
239 		              			"<b>Type</b> = " + String.valueOf(getType()
240  	) + " <br/> " + 
241 		              		
242 				"<br/>]";     
243 		}
244  	
245  		
246  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
247         	
248 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
249 		
250 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---
251 	        
252 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---        	            	
253  	
254 		}
255