1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3
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
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public class NavPointLocalImpl
31 extends
32 NavPointLocal
33 {
34
35
36
37
38
39
40 public NavPointLocalImpl()
41 {
42 }
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 public NavPointLocalImpl(
135 UnrealId Id, boolean Visible
136 ) {
137
138 this.Id = Id;
139
140 this.Visible = Visible;
141
142 }
143
144
145
146
147
148
149 public NavPointLocalImpl(NavPoint original) {
150
151 this.Id = original.getId()
152 ;
153
154 this.Visible = original.isVisible()
155 ;
156
157 this.SimTime = original.getSimTime();
158 }
159
160
161
162
163
164
165 public NavPointLocalImpl(NavPointLocalImpl original) {
166
167 this.Id = original.getId()
168 ;
169
170 this.Visible = original.isVisible()
171 ;
172
173 this.SimTime = original.getSimTime();
174 }
175
176
177
178
179
180
181 public NavPointLocalImpl(NavPointLocal original) {
182
183 this.Id = original.getId()
184 ;
185
186 this.Visible = original.isVisible()
187 ;
188
189 }
190
191
192 @Override
193 public void setSimTime(long SimTime) {
194 super.setSimTime(SimTime);
195 }
196
197 @Override
198 public
199 NavPointLocalImpl clone() {
200 return new
201 NavPointLocalImpl(this);
202 }
203
204
205
206
207
208
209
210
211 protected
212 UnrealId Id =
213 null;
214
215
216
217
218
219
220 public UnrealId getId()
221 {
222 return Id;
223 }
224
225
226
227
228
229
230
231 protected
232 boolean Visible =
233 false;
234
235
236
237
238
239
240 public boolean isVisible()
241 {
242 return Visible;
243 }
244
245
246
247
248
249 public NavPointLocalImpl getLocal() {
250 return this;
251 }
252 public ISharedWorldObject getShared() {
253 throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
254 }
255 public IStaticWorldObject getStatic() {
256 throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
257 }
258
259 public static class NavPointLocalUpdate
260 implements ILocalWorldObjectUpdatedEvent, IGBWorldObjectEvent
261 {
262 protected long time;
263
264 protected NavPointLocal data = null;
265
266 public NavPointLocalUpdate
267 (NavPointLocal moverLocal, long time)
268 {
269 this.data = moverLocal;
270 this.time = time;
271 }
272
273 @Override
274 public IWorldObjectUpdateResult<ILocalWorldObject> update(
275 ILocalWorldObject object)
276 {
277 if ( object == null)
278 {
279 data = new NavPointLocalImpl(data);
280 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
281 }
282 if ( object instanceof NavPointLocalImpl )
283 {
284 NavPointLocalImpl toUpdate = (NavPointLocalImpl)object;
285
286 boolean updated = false;
287
288
289
290 if (toUpdate.Visible != data.isVisible()
291 ) {
292 toUpdate.Visible=data.isVisible()
293 ;
294 updated = true;
295 }
296
297
298 data = toUpdate;
299
300 if ( updated )
301 {
302 toUpdate.SimTime = this.time;
303 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, data);
304 }
305
306 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
307 }
308 throw new PogamutException("Unsupported object type for update. Expected NavPointLocalImpl for object " + object.getId() +", not object of class " + object.getClass().getSimpleName() + ".", this);
309 }
310
311
312
313
314 @Override
315 public long getSimTime() {
316 return this.time;
317 }
318
319 @Override
320 public IWorldObject getObject() {
321 return data;
322 }
323
324 @Override
325 public WorldObjectId getId() {
326 return data.getId();
327 }
328
329 }
330
331
332 public String toString() {
333 return
334 super.toString() + "[" +
335
336 "Id = " + String.valueOf(getId()
337 ) + " | " +
338
339 "Visible = " + String.valueOf(isVisible()
340 ) + " | " +
341
342 "]";
343 }
344
345
346 public String toHtmlString() {
347 return super.toString() + "[<br/>" +
348
349 "<b>Id</b> = " + String.valueOf(getId()
350 ) + " <br/> " +
351
352 "<b>Visible</b> = " + String.valueOf(isVisible()
353 ) + " <br/> " +
354
355 "<br/>]";
356 }
357
358
359
360
361
362
363
364
365
366
367 }
368