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 INV 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/asynchronous message. An object on the ground that
26  		can be picked up.
27  	
28           */
29   	public class ItemCompositeImpl 
30    				extends Item
31  	    {
32   	
33      	
34      	
35      	/**
36      	 * Parameter-less contructor for the message.
37      	 */
38  		public ItemCompositeImpl()
39  		{
40  		}
41  	
42  		
43  		/**
44  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
45  		 *
46  		 * @param partLocal local-part of the message
47  		 * @param partShared shared-part of the message
48  		 * @param partStatic static-part of the message
49  		 */
50  		public ItemCompositeImpl(
51  			ItemLocalImpl partLocal,
52  			ItemSharedImpl partShared,
53  			ItemStaticImpl partStatic
54  		) {
55  			this.partLocal  = partLocal;
56  			this.partShared = partShared;
57  			this.partStatic = partStatic;
58  		}
59  		
60  		/**
61  		 * Cloning constructor.
62  		 *
63  		 * @param original		 
64  		 */
65  		public ItemCompositeImpl(ItemCompositeImpl original) {
66  			this.partLocal = partLocal;
67  			this.partShared = partShared;
68  			this.partStatic = partStatic;
69  		}
70      
71     				
72     				@Override
73     				public void setSimTime(long SimTime) {
74  					super.setSimTime(SimTime);
75  				}
76     			
77      			
78      			protected 
79      			ItemStaticImpl
80      			partStatic;
81      			
82      			@Override
83  				public ItemStatic getStatic() {
84  					return partStatic;
85  				}
86      			
87      			protected
88      			ItemLocalImpl
89      			partLocal;
90      	
91      			@Override
92  				public ItemLocal getLocal() {
93  					return partLocal;
94  				}
95  			
96      			ItemSharedImpl
97      			partShared;
98      			
99  				@Override
100 				public ItemShared getShared() {
101 					return partShared;
102 				}
103 			
104 				
105   				
106   					@Override
107     				
108  		/**
109          * 
110 			Unique Id of the item. This Id represents just item on the
111 			map, not in our inventory.
112 		 
113          */
114         public  UnrealId getId()
115  	 {
116     					return 
117     						
118     								partStatic.
119     							getId()
120  	;
121     				}
122     			
123   					@Override
124     				
125  		/**
126          * 
127             Id of the navpoint where the item is laying. If null - the item was dropped by the bot or another player.
128          
129          */
130         public  UnrealId getNavPointId()
131  	 {
132     					return 
133     						
134     								partStatic.
135     							getNavPointId()
136  	;
137     				}
138     			
139   					@Override
140     				
141  		/**
142          * 
143             If the Item is not dropped then it's item that is laying at some navpoint and
144             this is that NavPoint instance.
145          
146          */
147         public  NavPoint getNavPoint()
148  	 {
149     					return 
150     						
151     								partStatic.
152     							getNavPoint()
153  	;
154     				}
155     			
156   					@Override
157     				
158  		/**
159          * 
160 			If the item is in the field of view of the bot.
161 		 
162          */
163         public  boolean isVisible()
164  	 {
165     					return 
166     						
167     								partLocal.
168     							isVisible()
169  	;
170     				}
171     			
172   					@Override
173     				
174  		/**
175          * Location of the item. 
176          */
177         public  Location getLocation()
178  	 {
179     					return 
180     						
181     								partShared.
182     							getLocation()
183  	;
184     				}
185     			
186   					@Override
187     				
188  		/**
189          * 
190 			If this item is some ammo or health pack, here we can find
191 			out how much of the attribute this item will add.
192 		 
193          */
194         public  int getAmount()
195  	 {
196     					return 
197     						
198     								partStatic.
199     							getAmount()
200  	;
201     				}
202     			
203   					@Override
204     				
205  		/**
206          * 
207 			Class of the item (e.g. xWeapons.FlakCannonPickup).
208 		 
209          */
210         public  ItemType getType()
211  	 {
212     					return 
213     						
214     								partStatic.
215     							getType()
216  	;
217     				}
218     			
219   					@Override
220     				
221  		/**
222          * 
223 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
224 		 
225          */
226         public  ItemDescriptor getDescriptor()
227  	 {
228     					return 
229     						
230     								partStatic.
231     							getDescriptor()
232  	;
233     				}
234     			
235   					@Override
236     				
237  		/**
238          * 
239             Whether it is regular item or one dropped by some bot (usually during dying). Items that are not dropped
240             usually respawns itself (depends on the game settings) while those that are dropped may be taken only once.
241          
242          */
243         public  boolean isDropped()
244  	 {
245     					return 
246     						
247     								partShared.
248     							isDropped()
249  	;
250     				}
251     			
252  		
253  	    public String toString() {
254             return
255             	super.toString() + "[" +
256             	
257             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
258             		
259 				"]";           		
260         }
261  	
262  		
263  		public String toHtmlString() {
264  			return super.toString() + "[<br/>" +
265             	
266             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
267             		
268 				"<br/>]";     
269 		}
270  	
271  		
272  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
273         	
274 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
275 		
276 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
277 	        
278 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
279  	
280 		}
281