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 BOM 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. BombInfo contains all info about the bomb
26  		in the BotBombingRun game mode. Is not sent in other game types.
27  	
28           */
29   	public class BombInfoCompositeImpl 
30    				extends BombInfo
31  	    {
32   	
33      	
34      	
35      	/**
36      	 * Parameter-less contructor for the message.
37      	 */
38  		public BombInfoCompositeImpl()
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 BombInfoCompositeImpl(
51  			BombInfoLocalImpl partLocal,
52  			BombInfoSharedImpl partShared,
53  			BombInfoStaticImpl 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 BombInfoCompositeImpl(BombInfoCompositeImpl 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      			BombInfoStaticImpl
80      			partStatic;
81      			
82      			@Override
83  				public BombInfoStatic getStatic() {
84  					return partStatic;
85  				}
86      			
87      			protected
88      			BombInfoLocalImpl
89      			partLocal;
90      	
91      			@Override
92  				public BombInfoLocal getLocal() {
93  					return partLocal;
94  				}
95  			
96      			BombInfoSharedImpl
97      			partShared;
98      			
99  				@Override
100 				public BombInfoShared getShared() {
101 					return partShared;
102 				}
103 			
104 				
105   				
106   					@Override
107     				
108  		/**
109          * 
110 			An unique Id for this bomb, assigned by the game.
111 		 
112          */
113         public  UnrealId getId()
114  	 {
115     					return 
116     						
117     								partStatic.
118     							getId()
119  	;
120     				}
121     			
122   					@Override
123     				
124  		/**
125          * 
126    		Current velocity of the bomb. TODO not sure if this actually does smthing
127    	 
128          */
129         public  Velocity getVelocity()
130  	 {
131     					return 
132     						
133     								partShared.
134     							getVelocity()
135  	;
136     				}
137     			
138   					@Override
139     				
140  		/**
141          * 
142 			An absolute location of the bomb (Sent if we can actually
143 			see the flag).
144 		 
145          */
146         public  Location getLocation()
147  	 {
148     					return 
149     						
150     								partShared.
151     							getLocation()
152  	;
153     				}
154     			
155   					@Override
156     				
157  		/**
158          * 
159 			Id of player/bot holding the bomb. (Sent if we can actually
160 			see the bomb and the bomb is being carried, or if the bomb
161 			is being carried by us).
162 		 
163          */
164         public  UnrealId getHolder()
165  	 {
166     					return 
167     						
168     								partShared.
169     							getHolder()
170  	;
171     				}
172     			
173   					@Override
174     				
175  		/**
176          * 
177 			The team of the current holder (if any).
178 		 
179          */
180         public  Integer getHolderTeam()
181  	 {
182     					return 
183     						
184     								partShared.
185     							getHolderTeam()
186  	;
187     				}
188     			
189   					@Override
190     				
191  		/**
192          * True if the bot can see the bomb. 
193          */
194         public  boolean isVisible()
195  	 {
196     					return 
197     						
198     								partLocal.
199     							isVisible()
200  	;
201     				}
202     			
203   					@Override
204     				
205  		/**
206          * 
207 			Represents the state the bomb is in. Can be "Held",
208 			"Dropped" or "Home".
209 		 
210          */
211         public  String getState()
212  	 {
213     					return 
214     						
215     								partShared.
216     							getState()
217  	;
218     				}
219     			
220  		
221  	    public String toString() {
222             return
223             	super.toString() + "[" +
224             	
225             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
226             		
227 				"]";           		
228         }
229  	
230  		
231  		public String toHtmlString() {
232  			return super.toString() + "[<br/>" +
233             	
234             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
235             		
236 				"<br/>]";     
237 		}
238  	
239  		
240  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
241         	
242 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
243 		
244 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
245 	        
246 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
247  	
248 		}
249