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 public class NavPointLocalImpl
28 extends
29 NavPointLocal
30 {
31
32
33
34
35
36
37 public NavPointLocalImpl()
38 {
39 }
40
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 public NavPointLocalImpl(
129 UnrealId Id, boolean Visible
130 ) {
131
132 this.Id = Id;
133
134 this.Visible = Visible;
135
136 }
137
138
139
140
141
142
143 public NavPointLocalImpl(NavPoint original) {
144
145 this.Id = original.getId()
146 ;
147
148 this.Visible = original.isVisible()
149 ;
150
151 this.SimTime = original.getSimTime();
152 }
153
154
155
156
157
158
159 public NavPointLocalImpl(NavPointLocalImpl original) {
160
161 this.Id = original.getId()
162 ;
163
164 this.Visible = original.isVisible()
165 ;
166
167 this.SimTime = original.getSimTime();
168 }
169
170
171
172
173
174
175 public NavPointLocalImpl(NavPointLocal original) {
176
177 this.Id = original.getId()
178 ;
179
180 this.Visible = original.isVisible()
181 ;
182
183 }
184
185
186 @Override
187 public void setSimTime(long SimTime) {
188 super.setSimTime(SimTime);
189 }
190
191 @Override
192 public
193 NavPointLocalImpl clone() {
194 return new
195 NavPointLocalImpl(this);
196 }
197
198
199
200
201
202
203
204
205 protected
206 UnrealId Id =
207 null;
208
209
210
211
212
213
214 public UnrealId getId()
215 {
216 return Id;
217 }
218
219
220
221
222
223
224
225 protected
226 boolean Visible =
227 false;
228
229
230
231
232
233
234 public boolean isVisible()
235 {
236 return Visible;
237 }
238
239
240
241
242
243 public NavPointLocalImpl getLocal() {
244 return this;
245 }
246 public ISharedWorldObject getShared() {
247 throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
248 }
249 public IStaticWorldObject getStatic() {
250 throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
251 }
252
253 public static class NavPointLocalUpdate
254 implements ILocalWorldObjectUpdatedEvent, IGBWorldObjectEvent
255 {
256 protected long time;
257
258 protected NavPointLocal data = null;
259
260 public NavPointLocalUpdate
261 (NavPointLocal moverLocal, long time)
262 {
263 this.data = moverLocal;
264 this.time = time;
265 }
266
267 @Override
268 public IWorldObjectUpdateResult<ILocalWorldObject> update(
269 ILocalWorldObject object)
270 {
271 if ( object == null)
272 {
273 data = new NavPointLocalImpl(data);
274 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
275 }
276 if ( object instanceof NavPointLocalImpl )
277 {
278 NavPointLocalImpl toUpdate = (NavPointLocalImpl)object;
279
280 boolean updated = false;
281
282
283
284 if (toUpdate.Visible != data.isVisible()
285 ) {
286 toUpdate.Visible=data.isVisible()
287 ;
288 updated = true;
289 }
290
291
292 data = toUpdate;
293
294 if ( updated )
295 {
296 toUpdate.SimTime = this.time;
297 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, data);
298 }
299
300 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
301 }
302 throw new PogamutException("Unsupported object type for update. Expected NavPointLocalImpl for object " + object.getId() +", not object of class " + object.getClass().getSimpleName() + ".", this);
303 }
304
305
306
307
308 @Override
309 public long getSimTime() {
310 return this.time;
311 }
312
313 @Override
314 public IWorldObject getObject() {
315 return data;
316 }
317
318 @Override
319 public WorldObjectId getId() {
320 return data.getId();
321 }
322
323 }
324
325
326 public String toString() {
327 return
328 super.toString() + "[" +
329
330 "Id = " + String.valueOf(getId()
331 ) + " | " +
332
333 "Visible = " + String.valueOf(isVisible()
334 ) + " | " +
335
336 "]";
337 }
338
339
340 public String toHtmlString() {
341 return super.toString() + "[<br/>" +
342
343 "<b>Id</b> = " + String.valueOf(getId()
344 ) + " <br/> " +
345
346 "<b>Visible</b> = " + String.valueOf(isVisible()
347 ) + " <br/> " +
348
349 "<br/>]";
350 }
351
352
353
354
355
356
357
358
359
360
361 }
362