View Javadoc

1   
2       		/**
3            	IMPORTANT !!!
4   
5            	DO NOT EDIT THIS FILE. IT IS GENERATED FROM 
6            	THE JavaClassesGenerator.xslt. MODIFY THAT FILE INSTEAD OF THIS ONE.
7            
8            	Use Ant task process-gb-messages after that to generate this file again.
9            
10           	IMPORTANT END !!!
11          	*/
12   			   	
13      		package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
14  
15              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.*;
16  
17              public class UT2004SharedObjectCreator {
18  	
19  				public static interface ISharedObjectCreator<T extends ICompositeWorldObject>
20  				{
21  					public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c);
22  				}
23  				
24  				
25  					public static class SelfSharedCreator implements ISharedObjectCreator<Self>
26  					{
27  						@Override
28  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
29  							return new SelfSharedImpl(id, c);
30  						}
31  					}
32  				
33  					public static class BombInfoSharedCreator implements ISharedObjectCreator<BombInfo>
34  					{
35  						@Override
36  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
37  							return new BombInfoSharedImpl(id, c);
38  						}
39  					}
40  				
41  					public static class FlagInfoSharedCreator implements ISharedObjectCreator<FlagInfo>
42  					{
43  						@Override
44  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
45  							return new FlagInfoSharedImpl(id, c);
46  						}
47  					}
48  				
49  					public static class InitedMessageSharedCreator implements ISharedObjectCreator<InitedMessage>
50  					{
51  						@Override
52  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
53  							return new InitedMessageSharedImpl(id, c);
54  						}
55  					}
56  				
57  					public static class TeamScoreSharedCreator implements ISharedObjectCreator<TeamScore>
58  					{
59  						@Override
60  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
61  							return new TeamScoreSharedImpl(id, c);
62  						}
63  					}
64  				
65  					public static class AutoTraceRaySharedCreator implements ISharedObjectCreator<AutoTraceRay>
66  					{
67  						@Override
68  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
69  							return new AutoTraceRaySharedImpl(id, c);
70  						}
71  					}
72  				
73  					public static class MoverSharedCreator implements ISharedObjectCreator<Mover>
74  					{
75  						@Override
76  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
77  							return new MoverSharedImpl(id, c);
78  						}
79  					}
80  				
81  					public static class ConfigChangeSharedCreator implements ISharedObjectCreator<ConfigChange>
82  					{
83  						@Override
84  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
85  							return new ConfigChangeSharedImpl(id, c);
86  						}
87  					}
88  				
89  					public static class VehicleSharedCreator implements ISharedObjectCreator<Vehicle>
90  					{
91  						@Override
92  						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
93  							return new VehicleSharedImpl(id, c);
94  						}
95  					}
96  				
97  					public static class AliveMessageSharedCreator implements ISharedObjectCreator<AliveMessage>
98  					{
99  						@Override
100 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
101 							return new AliveMessageSharedImpl(id, c);
102 						}
103 					}
104 				
105 					public static class MyInventorySharedCreator implements ISharedObjectCreator<MyInventory>
106 					{
107 						@Override
108 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
109 							return new MyInventorySharedImpl(id, c);
110 						}
111 					}
112 				
113 					public static class PlayerSharedCreator implements ISharedObjectCreator<Player>
114 					{
115 						@Override
116 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
117 							return new PlayerSharedImpl(id, c);
118 						}
119 					}
120 				
121 					public static class ItemSharedCreator implements ISharedObjectCreator<Item>
122 					{
123 						@Override
124 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
125 							return new ItemSharedImpl(id, c);
126 						}
127 					}
128 				
129 					public static class GameInfoSharedCreator implements ISharedObjectCreator<GameInfo>
130 					{
131 						@Override
132 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
133 							return new GameInfoSharedImpl(id, c);
134 						}
135 					}
136 				
137 					public static class IncomingProjectileSharedCreator implements ISharedObjectCreator<IncomingProjectile>
138 					{
139 						@Override
140 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
141 							return new IncomingProjectileSharedImpl(id, c);
142 						}
143 					}
144 				
145 					public static class EntitySharedCreator implements ISharedObjectCreator<Entity>
146 					{
147 						@Override
148 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
149 							return new EntitySharedImpl(id, c);
150 						}
151 					}
152 				
153 					public static class NavPointSharedCreator implements ISharedObjectCreator<NavPoint>
154 					{
155 						@Override
156 						public ISharedWorldObject create(WorldObjectId id, Collection<ISharedProperty> c) {
157 							return new NavPointSharedImpl(id, c);
158 						}
159 					}
160 				
161 				
162 				private static HashMap<Class, ISharedObjectCreator> map = new HashMap<Class, ISharedObjectCreator>();
163 	
164 				static {
165 					
166 						map.put(
167 							Self
168 							.class, 
169 							new SelfSharedCreator()
170 						);
171 					
172 						map.put(
173 							BombInfo
174 							.class, 
175 							new BombInfoSharedCreator()
176 						);
177 					
178 						map.put(
179 							FlagInfo
180 							.class, 
181 							new FlagInfoSharedCreator()
182 						);
183 					
184 						map.put(
185 							InitedMessage
186 							.class, 
187 							new InitedMessageSharedCreator()
188 						);
189 					
190 						map.put(
191 							TeamScore
192 							.class, 
193 							new TeamScoreSharedCreator()
194 						);
195 					
196 						map.put(
197 							AutoTraceRay
198 							.class, 
199 							new AutoTraceRaySharedCreator()
200 						);
201 					
202 						map.put(
203 							Mover
204 							.class, 
205 							new MoverSharedCreator()
206 						);
207 					
208 						map.put(
209 							ConfigChange
210 							.class, 
211 							new ConfigChangeSharedCreator()
212 						);
213 					
214 						map.put(
215 							Vehicle
216 							.class, 
217 							new VehicleSharedCreator()
218 						);
219 					
220 						map.put(
221 							AliveMessage
222 							.class, 
223 							new AliveMessageSharedCreator()
224 						);
225 					
226 						map.put(
227 							MyInventory
228 							.class, 
229 							new MyInventorySharedCreator()
230 						);
231 					
232 						map.put(
233 							Player
234 							.class, 
235 							new PlayerSharedCreator()
236 						);
237 					
238 						map.put(
239 							Item
240 							.class, 
241 							new ItemSharedCreator()
242 						);
243 					
244 						map.put(
245 							GameInfo
246 							.class, 
247 							new GameInfoSharedCreator()
248 						);
249 					
250 						map.put(
251 							IncomingProjectile
252 							.class, 
253 							new IncomingProjectileSharedCreator()
254 						);
255 					
256 						map.put(
257 							Entity
258 							.class, 
259 							new EntitySharedCreator()
260 						);
261 					
262 						map.put(
263 							NavPoint
264 							.class, 
265 							new NavPointSharedCreator()
266 						);
267 										
268 				}				
269 				
270 				public static ISharedWorldObject create(Class msgClass, WorldObjectId objectId, Collection<ISharedProperty> properties )
271 				{
272 					NullCheck.check(msgClass, "msgClass");
273 					NullCheck.check(objectId, "objectId");
274 					NullCheck.check(properties, "properties");
275 					
276 					ISharedObjectCreator creator = map.get(msgClass);
277 					if (creator == null) {
278 					    throw new PogamutException("There is no shared obejct creator for class " + msgClass + ".", UT2004SharedObjectCreator.class);
279 					}
280 					return creator.create(objectId, properties);
281 				}
282 			}
283