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 FLG 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. FlagInfo contains all info about the flag
26  		in the CTF game mode. Is not sent in other game types.
27  	
28           */
29   	public class FlagInfoCompositeImpl 
30    				extends FlagInfo
31  	    {
32   	
33      	
34      	
35      	/**
36      	 * Parameter-less contructor for the message.
37      	 */
38  		public FlagInfoCompositeImpl()
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 FlagInfoCompositeImpl(
51  			FlagInfoLocalImpl partLocal,
52  			FlagInfoSharedImpl partShared,
53  			FlagInfoStaticImpl 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 FlagInfoCompositeImpl(FlagInfoCompositeImpl 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      			FlagInfoStaticImpl
80      			partStatic;
81      			
82      			@Override
83  				public FlagInfoStatic getStatic() {
84  					return partStatic;
85  				}
86      			
87      			protected
88      			FlagInfoLocalImpl
89      			partLocal;
90      	
91      			@Override
92  				public FlagInfoLocal getLocal() {
93  					return partLocal;
94  				}
95  			
96      			FlagInfoSharedImpl
97      			partShared;
98      			
99  				@Override
100 				public FlagInfoShared getShared() {
101 					return partShared;
102 				}
103 			
104 				
105   				
106   					@Override
107     				
108  		/**
109          * 
110 			An unique Id for this flag, 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 			An absolute location of the flag (Sent if we can actually
127 			see the flag).
128 		 
129          */
130         public  Location getLocation()
131  	 {
132     					return 
133     						
134     								partShared.
135     							getLocation()
136  	;
137     				}
138     			
139   					@Override
140     				
141  		/**
142          * 
143 			Id of player/bot holding the flag. (Sent if we can actually
144 			see the flag and the flag is being carried, or if the flag
145 			is being carried by us).
146 		 
147          */
148         public  UnrealId getHolder()
149  	 {
150     					return 
151     						
152     								partShared.
153     							getHolder()
154  	;
155     				}
156     			
157   					@Override
158     				
159  		/**
160          * The owner team of this flag. 
161          */
162         public  Integer getTeam()
163  	 {
164     					return 
165     						
166     								partShared.
167     							getTeam()
168  	;
169     				}
170     			
171   					@Override
172     				
173  		/**
174          * True if the bot can see the flag. 
175          */
176         public  boolean isVisible()
177  	 {
178     					return 
179     						
180     								partLocal.
181     							isVisible()
182  	;
183     				}
184     			
185   					@Override
186     				
187  		/**
188          * 
189 			Represents the state the flag is in. Can be "Held",
190 			"Dropped" or "Home" (note that the first letter does not have to be in upper case!).
191 		 
192          */
193         public  String getState()
194  	 {
195     					return 
196     						
197     								partShared.
198     							getState()
199  	;
200     				}
201     			
202  		
203  	    public String toString() {
204             return
205             	super.toString() + "[" +
206             	
207             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
208             		
209 				"]";           		
210         }
211  	
212  		
213  		public String toHtmlString() {
214  			return super.toString() + "[<br/>" +
215             	
216             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
217             		
218 				"<br/>]";     
219 		}
220  	
221  		
222  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
223         	
224 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
225 		
226 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
227 	        
228 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
229  	
230 		}
231