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
31 public class MoverStaticImpl
32 extends
33 MoverStatic
34 {
35
36
37
38
39
40
41 public MoverStaticImpl()
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 public MoverStaticImpl(
118 UnrealId Id, boolean DamageTrig, String Type, boolean IsMoving, double MoveTime, double OpenTime, Location BasePos, Location BaseRot, double DelayTime, UnrealId NavPointMarker
119 ) {
120
121 this.Id = Id;
122
123 this.DamageTrig = DamageTrig;
124
125 this.Type = Type;
126
127 this.IsMoving = IsMoving;
128
129 this.MoveTime = MoveTime;
130
131 this.OpenTime = OpenTime;
132
133 this.BasePos = BasePos;
134
135 this.BaseRot = BaseRot;
136
137 this.DelayTime = DelayTime;
138
139 this.NavPointMarker = NavPointMarker;
140
141 }
142
143
144
145
146
147
148 public MoverStaticImpl(Mover original) {
149
150 this.Id = original.getId()
151 ;
152
153 this.DamageTrig = original.isDamageTrig()
154 ;
155
156 this.Type = original.getType()
157 ;
158
159 this.IsMoving = original.isIsMoving()
160 ;
161
162 this.MoveTime = original.getMoveTime()
163 ;
164
165 this.OpenTime = original.getOpenTime()
166 ;
167
168 this.BasePos = original.getBasePos()
169 ;
170
171 this.BaseRot = original.getBaseRot()
172 ;
173
174 this.DelayTime = original.getDelayTime()
175 ;
176
177 this.NavPointMarker = original.getNavPointMarker()
178 ;
179
180 this.SimTime = original.getSimTime();
181 }
182
183
184
185
186
187
188 public MoverStaticImpl(MoverStaticImpl original) {
189
190 this.Id = original.getId()
191 ;
192
193 this.DamageTrig = original.isDamageTrig()
194 ;
195
196 this.Type = original.getType()
197 ;
198
199 this.IsMoving = original.isIsMoving()
200 ;
201
202 this.MoveTime = original.getMoveTime()
203 ;
204
205 this.OpenTime = original.getOpenTime()
206 ;
207
208 this.BasePos = original.getBasePos()
209 ;
210
211 this.BaseRot = original.getBaseRot()
212 ;
213
214 this.DelayTime = original.getDelayTime()
215 ;
216
217 this.NavPointMarker = original.getNavPointMarker()
218 ;
219
220 this.SimTime = original.getSimTime();
221 }
222
223
224
225
226
227
228 public MoverStaticImpl(MoverStatic original) {
229
230 this.Id = original.getId()
231 ;
232
233 this.DamageTrig = original.isDamageTrig()
234 ;
235
236 this.Type = original.getType()
237 ;
238
239 this.IsMoving = original.isIsMoving()
240 ;
241
242 this.MoveTime = original.getMoveTime()
243 ;
244
245 this.OpenTime = original.getOpenTime()
246 ;
247
248 this.BasePos = original.getBasePos()
249 ;
250
251 this.BaseRot = original.getBaseRot()
252 ;
253
254 this.DelayTime = original.getDelayTime()
255 ;
256
257 this.NavPointMarker = original.getNavPointMarker()
258 ;
259
260 }
261
262
263 @Override
264 public void setSimTime(long SimTime) {
265 super.setSimTime(SimTime);
266 }
267
268 @Override
269 public
270 MoverStaticImpl clone() {
271 return new
272 MoverStaticImpl(this);
273 }
274
275
276
277
278
279
280
281
282 protected
283 UnrealId Id =
284 null;
285
286
287
288
289
290
291 public UnrealId getId()
292 {
293 return Id;
294 }
295
296
297
298
299
300
301
302 protected
303 boolean DamageTrig =
304 false;
305
306
307
308
309
310
311 public boolean isDamageTrig()
312 {
313 return DamageTrig;
314 }
315
316
317
318
319
320 protected
321 String Type =
322 null;
323
324
325
326
327 public String getType()
328 {
329 return Type;
330 }
331
332
333
334
335
336 protected
337 boolean IsMoving =
338 false;
339
340
341
342
343 public boolean isIsMoving()
344 {
345 return IsMoving;
346 }
347
348
349
350
351
352 protected
353 double MoveTime =
354 0;
355
356
357
358
359 public double getMoveTime()
360 {
361 return MoveTime;
362 }
363
364
365
366
367
368
369 protected
370 double OpenTime =
371 0;
372
373
374
375
376
377 public double getOpenTime()
378 {
379 return OpenTime;
380 }
381
382
383
384
385
386 protected
387 Location BasePos =
388 null;
389
390
391
392
393 public Location getBasePos()
394 {
395 return BasePos;
396 }
397
398
399
400
401
402 protected
403 Location BaseRot =
404 null;
405
406
407
408
409 public Location getBaseRot()
410 {
411 return BaseRot;
412 }
413
414
415
416
417
418 protected
419 double DelayTime =
420 0;
421
422
423
424
425 public double getDelayTime()
426 {
427 return DelayTime;
428 }
429
430
431
432
433
434 protected
435 UnrealId NavPointMarker =
436 null;
437
438
439
440
441 public UnrealId getNavPointMarker()
442 {
443 return NavPointMarker;
444 }
445
446
447
448 public static class MoverStaticUpdate
449 implements IStaticWorldObjectUpdatedEvent
450 {
451
452 private MoverStatic data;
453 private long time;
454
455 public MoverStaticUpdate
456 (MoverStatic source, long time)
457 {
458 this.data = source;
459 this.time = time;
460 }
461
462
463
464
465 @Override
466 public long getSimTime() {
467 return time;
468 }
469
470 @Override
471 public WorldObjectId getId() {
472 return data.getId();
473 }
474
475 @Override
476 public IWorldObjectUpdateResult<IStaticWorldObject> update(
477 IStaticWorldObject object) {
478 if ( object == null)
479 {
480 data = new MoverStaticImpl(data);
481 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IStaticWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
482 }
483
484 if ( object instanceof MoverStaticImpl)
485 {
486 MoverStaticImpl orig = (MoverStaticImpl)object;
487
488 if ( data.isDifferentFrom(orig) )
489 {
490
491
492 System.out.println("!!!!!ERROR!!!!!! in static object modification. Object class : MoverStaticImpl to see which property was different see !!!!PROPERTY UPDATE ERROR!!!!");
493 }
494 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IStaticWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
495 }
496 throw new PogamutException("Unexpected object type for update, MoverStaticImpl expected not class " + object.getClass().getSimpleName() + ".", this);
497 }
498 }
499
500
501
502 @Override
503 public boolean isDifferentFrom(IStaticWorldObject other)
504 {
505 if (other == null)
506 {
507 return true;
508 }
509 else if (other == this)
510 {
511 return false;
512 }
513 else
514 {
515 MoverStatic obj = (MoverStatic) other;
516
517
518 if ( !(
519 AdvancedEquals.equalsOrNull(this.getId()
520 , obj.getId()
521 )
522 ) )
523 {
524 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class MoverStatic");
525 return true;
526 }
527
528 if ( !(this.isDamageTrig()
529
530 == obj.isDamageTrig()
531 ) )
532 {
533 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DamageTrig on object class MoverStatic");
534 return true;
535 }
536
537 if ( !(
538 AdvancedEquals.equalsOrNull(this.getType()
539 , obj.getType()
540 )
541 ) )
542 {
543 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Type on object class MoverStatic");
544 return true;
545 }
546
547 if ( !(this.isIsMoving()
548
549 == obj.isIsMoving()
550 ) )
551 {
552 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property IsMoving on object class MoverStatic");
553 return true;
554 }
555
556 if ( !(this.getMoveTime()
557
558 == obj.getMoveTime()
559 ) )
560 {
561 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property MoveTime on object class MoverStatic");
562 return true;
563 }
564
565 if ( !(this.getOpenTime()
566
567 == obj.getOpenTime()
568 ) )
569 {
570 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property OpenTime on object class MoverStatic");
571 return true;
572 }
573
574 if ( !(
575 AdvancedEquals.equalsOrNull(this.getBasePos()
576 , obj.getBasePos()
577 )
578 ) )
579 {
580 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property BasePos on object class MoverStatic");
581 return true;
582 }
583
584 if ( !(
585 AdvancedEquals.equalsOrNull(this.getBaseRot()
586 , obj.getBaseRot()
587 )
588 ) )
589 {
590 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property BaseRot on object class MoverStatic");
591 return true;
592 }
593
594 if ( !(this.getDelayTime()
595
596 == obj.getDelayTime()
597 ) )
598 {
599 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DelayTime on object class MoverStatic");
600 return true;
601 }
602
603 if ( !(
604 AdvancedEquals.equalsOrNull(this.getNavPointMarker()
605 , obj.getNavPointMarker()
606 )
607 ) )
608 {
609 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NavPointMarker on object class MoverStatic");
610 return true;
611 }
612
613 }
614 return false;
615 }
616
617
618 public String toString() {
619 return
620 super.toString() + "[" +
621
622 "Id = " + String.valueOf(getId()
623 ) + " | " +
624
625 "DamageTrig = " + String.valueOf(isDamageTrig()
626 ) + " | " +
627
628 "Type = " + String.valueOf(getType()
629 ) + " | " +
630
631 "IsMoving = " + String.valueOf(isIsMoving()
632 ) + " | " +
633
634 "MoveTime = " + String.valueOf(getMoveTime()
635 ) + " | " +
636
637 "OpenTime = " + String.valueOf(getOpenTime()
638 ) + " | " +
639
640 "BasePos = " + String.valueOf(getBasePos()
641 ) + " | " +
642
643 "BaseRot = " + String.valueOf(getBaseRot()
644 ) + " | " +
645
646 "DelayTime = " + String.valueOf(getDelayTime()
647 ) + " | " +
648
649 "NavPointMarker = " + String.valueOf(getNavPointMarker()
650 ) + " | " +
651
652 "]";
653 }
654
655
656 public String toHtmlString() {
657 return super.toString() + "[<br/>" +
658
659 "<b>Id</b> = " + String.valueOf(getId()
660 ) + " <br/> " +
661
662 "<b>DamageTrig</b> = " + String.valueOf(isDamageTrig()
663 ) + " <br/> " +
664
665 "<b>Type</b> = " + String.valueOf(getType()
666 ) + " <br/> " +
667
668 "<b>IsMoving</b> = " + String.valueOf(isIsMoving()
669 ) + " <br/> " +
670
671 "<b>MoveTime</b> = " + String.valueOf(getMoveTime()
672 ) + " <br/> " +
673
674 "<b>OpenTime</b> = " + String.valueOf(getOpenTime()
675 ) + " <br/> " +
676
677 "<b>BasePos</b> = " + String.valueOf(getBasePos()
678 ) + " <br/> " +
679
680 "<b>BaseRot</b> = " + String.valueOf(getBaseRot()
681 ) + " <br/> " +
682
683 "<b>DelayTime</b> = " + String.valueOf(getDelayTime()
684 ) + " <br/> " +
685
686 "<b>NavPointMarker</b> = " + String.valueOf(getNavPointMarker()
687 ) + " <br/> " +
688
689 "<br/>]";
690 }
691
692
693
694
695
696
697
698
699
700
701 }
702