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 MYINV 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  		An object in the observed player's inventory.
26      
27           */
28   	public class MyInventoryCompositeImpl 
29    				extends MyInventory
30  	    {
31   	
32      	
33      	
34      	/**
35      	 * Parameter-less contructor for the message.
36      	 */
37  		public MyInventoryCompositeImpl()
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 MyInventoryCompositeImpl(
50  			MyInventoryLocalImpl partLocal,
51  			MyInventorySharedImpl partShared,
52  			MyInventoryStaticImpl 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 MyInventoryCompositeImpl(MyInventoryCompositeImpl 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      			MyInventoryStaticImpl
79      			partStatic;
80      			
81      			@Override
82  				public MyInventoryStatic getStatic() {
83  					return partStatic;
84  				}
85      			
86      			protected
87      			MyInventoryLocalImpl
88      			partLocal;
89      	
90      			@Override
91  				public MyInventoryLocal getLocal() {
92  					return partLocal;
93  				}
94  			
95      			MyInventorySharedImpl
96      			partShared;
97      			
98  				@Override
99  				public MyInventoryShared getShared() {
100 					return partShared;
101 				}
102 			
103 				
104   				
105   					@Override
106     				
107  		/**
108          * 
109 			Unique Id of the item. This Id represents the item in the inventory.
110 		 
111          */
112         public  UnrealId getId()
113  	 {
114     					return 
115     						
116     								partStatic.
117     							getId()
118  	;
119     				}
120     			
121   					@Override
122     				
123  		/**
124          * 
125 			If this item is a weapon, this holds the amount of primary ammo.
126 		 
127          */
128         public  int getCurrentAmmo()
129  	 {
130     					return 
131     						
132     								partLocal.
133     							getCurrentAmmo()
134  	;
135     				}
136     			
137   					@Override
138     				
139  		/**
140          * 
141 			If this item is a weapon, this holds the amount of secondary ammo.
142 		 
143          */
144         public  int getCurrentAltAmmo()
145  	 {
146     					return 
147     						
148     								partLocal.
149     							getCurrentAltAmmo()
150  	;
151     				}
152     			
153   					@Override
154     				
155  		/**
156          * 
157 			If this item is ammo or armor, this holds the amount of the item the player has.
158 		 
159          */
160         public  int getAmount()
161  	 {
162     					return 
163     						
164     								partLocal.
165     							getAmount()
166  	;
167     				}
168     			
169   					@Override
170     				
171  		/**
172          * 
173 			Class of the item (e.g. xWeapons.FlakCannonPickup).
174 		 
175          */
176         public  ItemType getType()
177  	 {
178     					return 
179     						
180     								partStatic.
181     							getType()
182  	;
183     				}
184     			
185   					@Override
186     				
187  		/**
188          * 
189 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor.
190 		 
191          */
192         public  ItemDescriptor getDescriptor()
193  	 {
194     					return 
195     						
196     								partStatic.
197     							getDescriptor()
198  	;
199     				}
200     			
201  		
202  	    public String toString() {
203             return
204             	super.toString() + "[" +
205             	
206             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
207             		
208 				"]";           		
209         }
210  	
211  		
212  		public String toHtmlString() {
213  			return super.toString() + "[<br/>" +
214             	
215             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
216             		
217 				"<br/>]";     
218 		}
219  	
220  		
221  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
222         	
223 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
224 		
225 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
226 	        
227 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
228  	
229 		}
230