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 public class ConfigChangeLocalImpl
30 extends
31 ConfigChangeLocal
32 {
33
34
35
36
37
38
39 public ConfigChangeLocalImpl()
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161 public ConfigChangeLocalImpl(
162 UnrealId Id, UnrealId BotId, boolean ManualSpawn, boolean AutoTrace, String Name, double SpeedMultiplier, Rotation RotationRate, boolean Invulnerable, double SelfUpdateTime, double VisionTime, boolean ShowDebug, boolean ShowFocalPoint, boolean DrawTraceLines, boolean SynchronousOff, boolean AutoPickupOff, String Action
163 ) {
164
165 this.Id = Id;
166
167 this.BotId = BotId;
168
169 this.ManualSpawn = ManualSpawn;
170
171 this.AutoTrace = AutoTrace;
172
173 this.Name = Name;
174
175 this.SpeedMultiplier = SpeedMultiplier;
176
177 this.RotationRate = RotationRate;
178
179 this.Invulnerable = Invulnerable;
180
181 this.SelfUpdateTime = SelfUpdateTime;
182
183 this.VisionTime = VisionTime;
184
185 this.ShowDebug = ShowDebug;
186
187 this.ShowFocalPoint = ShowFocalPoint;
188
189 this.DrawTraceLines = DrawTraceLines;
190
191 this.SynchronousOff = SynchronousOff;
192
193 this.AutoPickupOff = AutoPickupOff;
194
195 this.Action = Action;
196
197 }
198
199
200
201
202
203
204 public ConfigChangeLocalImpl(ConfigChange original) {
205
206 this.Id = original.getId()
207 ;
208
209 this.BotId = original.getBotId()
210 ;
211
212 this.ManualSpawn = original.isManualSpawn()
213 ;
214
215 this.AutoTrace = original.isAutoTrace()
216 ;
217
218 this.Name = original.getName()
219 ;
220
221 this.SpeedMultiplier = original.getSpeedMultiplier()
222 ;
223
224 this.RotationRate = original.getRotationRate()
225 ;
226
227 this.Invulnerable = original.isInvulnerable()
228 ;
229
230 this.SelfUpdateTime = original.getSelfUpdateTime()
231 ;
232
233 this.VisionTime = original.getVisionTime()
234 ;
235
236 this.ShowDebug = original.isShowDebug()
237 ;
238
239 this.ShowFocalPoint = original.isShowFocalPoint()
240 ;
241
242 this.DrawTraceLines = original.isDrawTraceLines()
243 ;
244
245 this.SynchronousOff = original.isSynchronousOff()
246 ;
247
248 this.AutoPickupOff = original.isAutoPickupOff()
249 ;
250
251 this.Action = original.getAction()
252 ;
253
254 this.SimTime = original.getSimTime();
255 }
256
257
258
259
260
261
262 public ConfigChangeLocalImpl(ConfigChangeLocalImpl original) {
263
264 this.Id = original.getId()
265 ;
266
267 this.BotId = original.getBotId()
268 ;
269
270 this.ManualSpawn = original.isManualSpawn()
271 ;
272
273 this.AutoTrace = original.isAutoTrace()
274 ;
275
276 this.Name = original.getName()
277 ;
278
279 this.SpeedMultiplier = original.getSpeedMultiplier()
280 ;
281
282 this.RotationRate = original.getRotationRate()
283 ;
284
285 this.Invulnerable = original.isInvulnerable()
286 ;
287
288 this.SelfUpdateTime = original.getSelfUpdateTime()
289 ;
290
291 this.VisionTime = original.getVisionTime()
292 ;
293
294 this.ShowDebug = original.isShowDebug()
295 ;
296
297 this.ShowFocalPoint = original.isShowFocalPoint()
298 ;
299
300 this.DrawTraceLines = original.isDrawTraceLines()
301 ;
302
303 this.SynchronousOff = original.isSynchronousOff()
304 ;
305
306 this.AutoPickupOff = original.isAutoPickupOff()
307 ;
308
309 this.Action = original.getAction()
310 ;
311
312 this.SimTime = original.getSimTime();
313 }
314
315
316
317
318
319
320 public ConfigChangeLocalImpl(ConfigChangeLocal original) {
321
322 this.Id = original.getId()
323 ;
324
325 this.BotId = original.getBotId()
326 ;
327
328 this.ManualSpawn = original.isManualSpawn()
329 ;
330
331 this.AutoTrace = original.isAutoTrace()
332 ;
333
334 this.Name = original.getName()
335 ;
336
337 this.SpeedMultiplier = original.getSpeedMultiplier()
338 ;
339
340 this.RotationRate = original.getRotationRate()
341 ;
342
343 this.Invulnerable = original.isInvulnerable()
344 ;
345
346 this.SelfUpdateTime = original.getSelfUpdateTime()
347 ;
348
349 this.VisionTime = original.getVisionTime()
350 ;
351
352 this.ShowDebug = original.isShowDebug()
353 ;
354
355 this.ShowFocalPoint = original.isShowFocalPoint()
356 ;
357
358 this.DrawTraceLines = original.isDrawTraceLines()
359 ;
360
361 this.SynchronousOff = original.isSynchronousOff()
362 ;
363
364 this.AutoPickupOff = original.isAutoPickupOff()
365 ;
366
367 this.Action = original.getAction()
368 ;
369
370 }
371
372
373 @Override
374 public void setSimTime(long SimTime) {
375 super.setSimTime(SimTime);
376 }
377
378 @Override
379 public
380 ConfigChangeLocalImpl clone() {
381 return new
382 ConfigChangeLocalImpl(this);
383 }
384
385
386
387
388
389
390 protected
391 UnrealId Id =
392 null;
393
394
395
396
397 public UnrealId getId()
398 {
399 return Id;
400 }
401
402
403
404
405
406 protected
407 UnrealId BotId =
408 null;
409
410
411
412
413 public UnrealId getBotId()
414 {
415 return BotId;
416 }
417
418
419
420
421
422
423
424 protected
425 boolean ManualSpawn =
426 false;
427
428
429
430
431
432
433 public boolean isManualSpawn()
434 {
435 return ManualSpawn;
436 }
437
438
439
440
441
442
443
444
445
446 protected
447 boolean AutoTrace =
448 false;
449
450
451
452
453
454
455
456
457 public boolean isAutoTrace()
458 {
459 return AutoTrace;
460 }
461
462
463
464
465
466 protected
467 String Name =
468 null;
469
470
471
472
473 public String getName()
474 {
475 return Name;
476 }
477
478
479
480
481
482
483
484 protected
485 double SpeedMultiplier =
486 0;
487
488
489
490
491
492
493 public double getSpeedMultiplier()
494 {
495 return SpeedMultiplier;
496 }
497
498
499
500
501
502
503
504 protected
505 Rotation RotationRate =
506 null;
507
508
509
510
511
512
513 public Rotation getRotationRate()
514 {
515 return RotationRate;
516 }
517
518
519
520
521
522
523
524 protected
525 boolean Invulnerable =
526 false;
527
528
529
530
531
532
533 public boolean isInvulnerable()
534 {
535 return Invulnerable;
536 }
537
538
539
540
541
542
543
544
545
546 protected
547 double SelfUpdateTime =
548 0;
549
550
551
552
553
554
555
556
557 public double getSelfUpdateTime()
558 {
559 return SelfUpdateTime;
560 }
561
562
563
564
565
566
567
568
569
570
571 protected
572 double VisionTime =
573 0;
574
575
576
577
578
579
580
581
582
583 public double getVisionTime()
584 {
585 return VisionTime;
586 }
587
588
589
590
591
592
593
594
595 protected
596 boolean ShowDebug =
597 false;
598
599
600
601
602
603
604
605 public boolean isShowDebug()
606 {
607 return ShowDebug;
608 }
609
610
611
612
613
614
615
616
617 protected
618 boolean ShowFocalPoint =
619 false;
620
621
622
623
624
625
626
627 public boolean isShowFocalPoint()
628 {
629 return ShowFocalPoint;
630 }
631
632
633
634
635
636
637
638
639 protected
640 boolean DrawTraceLines =
641 false;
642
643
644
645
646
647
648
649 public boolean isDrawTraceLines()
650 {
651 return DrawTraceLines;
652 }
653
654
655
656
657
658
659
660
661 protected
662 boolean SynchronousOff =
663 false;
664
665
666
667
668
669
670
671 public boolean isSynchronousOff()
672 {
673 return SynchronousOff;
674 }
675
676
677
678
679
680
681
682 protected
683 boolean AutoPickupOff =
684 false;
685
686
687
688
689
690
691 public boolean isAutoPickupOff()
692 {
693 return AutoPickupOff;
694 }
695
696
697
698
699
700
701
702 protected
703 String Action =
704 null;
705
706
707
708
709
710
711 public String getAction()
712 {
713 return Action;
714 }
715
716
717
718
719
720 public ConfigChangeLocalImpl getLocal() {
721 return this;
722 }
723 public ISharedWorldObject getShared() {
724 throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
725 }
726 public IStaticWorldObject getStatic() {
727 throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
728 }
729
730 public static class ConfigChangeLocalUpdate
731 implements ILocalWorldObjectUpdatedEvent, IGBWorldObjectEvent
732 {
733 protected long time;
734
735 protected ConfigChangeLocal data = null;
736
737 public ConfigChangeLocalUpdate
738 (ConfigChangeLocal moverLocal, long time)
739 {
740 this.data = moverLocal;
741 this.time = time;
742 }
743
744 @Override
745 public IWorldObjectUpdateResult<ILocalWorldObject> update(
746 ILocalWorldObject object)
747 {
748 if ( object == null)
749 {
750 data = new ConfigChangeLocalImpl(data);
751 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
752 }
753 if ( object instanceof ConfigChangeLocalImpl )
754 {
755 ConfigChangeLocalImpl toUpdate = (ConfigChangeLocalImpl)object;
756
757 boolean updated = false;
758
759
760
761 if (!SafeEquals.equals(toUpdate.BotId, data.getBotId()
762 )) {
763 toUpdate.BotId=data.getBotId()
764 ;
765 updated = true;
766 }
767
768 if (toUpdate.ManualSpawn != data.isManualSpawn()
769 ) {
770 toUpdate.ManualSpawn=data.isManualSpawn()
771 ;
772 updated = true;
773 }
774
775 if (toUpdate.AutoTrace != data.isAutoTrace()
776 ) {
777 toUpdate.AutoTrace=data.isAutoTrace()
778 ;
779 updated = true;
780 }
781
782 if (!SafeEquals.equals(toUpdate.Name, data.getName()
783 )) {
784 toUpdate.Name=data.getName()
785 ;
786 updated = true;
787 }
788
789 if (toUpdate.SpeedMultiplier != data.getSpeedMultiplier()
790 ) {
791 toUpdate.SpeedMultiplier=data.getSpeedMultiplier()
792 ;
793 updated = true;
794 }
795
796 if (!SafeEquals.equals(toUpdate.RotationRate, data.getRotationRate()
797 )) {
798 toUpdate.RotationRate=data.getRotationRate()
799 ;
800 updated = true;
801 }
802
803 if (toUpdate.Invulnerable != data.isInvulnerable()
804 ) {
805 toUpdate.Invulnerable=data.isInvulnerable()
806 ;
807 updated = true;
808 }
809
810 if (toUpdate.SelfUpdateTime != data.getSelfUpdateTime()
811 ) {
812 toUpdate.SelfUpdateTime=data.getSelfUpdateTime()
813 ;
814 updated = true;
815 }
816
817 if (toUpdate.VisionTime != data.getVisionTime()
818 ) {
819 toUpdate.VisionTime=data.getVisionTime()
820 ;
821 updated = true;
822 }
823
824 if (toUpdate.ShowDebug != data.isShowDebug()
825 ) {
826 toUpdate.ShowDebug=data.isShowDebug()
827 ;
828 updated = true;
829 }
830
831 if (toUpdate.ShowFocalPoint != data.isShowFocalPoint()
832 ) {
833 toUpdate.ShowFocalPoint=data.isShowFocalPoint()
834 ;
835 updated = true;
836 }
837
838 if (toUpdate.DrawTraceLines != data.isDrawTraceLines()
839 ) {
840 toUpdate.DrawTraceLines=data.isDrawTraceLines()
841 ;
842 updated = true;
843 }
844
845 if (toUpdate.SynchronousOff != data.isSynchronousOff()
846 ) {
847 toUpdate.SynchronousOff=data.isSynchronousOff()
848 ;
849 updated = true;
850 }
851
852 if (toUpdate.AutoPickupOff != data.isAutoPickupOff()
853 ) {
854 toUpdate.AutoPickupOff=data.isAutoPickupOff()
855 ;
856 updated = true;
857 }
858
859 if (!SafeEquals.equals(toUpdate.Action, data.getAction()
860 )) {
861 toUpdate.Action=data.getAction()
862 ;
863 updated = true;
864 }
865
866
867 data = toUpdate;
868
869 if ( updated )
870 {
871 toUpdate.SimTime = this.time;
872 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, data);
873 }
874
875 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
876 }
877 throw new PogamutException("Unsupported object type for update. Expected ConfigChangeLocalImpl for object " + object.getId() +", not object of class " + object.getClass().getSimpleName() + ".", this);
878 }
879
880
881
882
883 @Override
884 public long getSimTime() {
885 return this.time;
886 }
887
888 @Override
889 public IWorldObject getObject() {
890 return data;
891 }
892
893 @Override
894 public WorldObjectId getId() {
895 return data.getId();
896 }
897
898 }
899
900
901 public String toString() {
902 return
903 super.toString() + "[" +
904
905 "Id = " + String.valueOf(getId()
906 ) + " | " +
907
908 "BotId = " + String.valueOf(getBotId()
909 ) + " | " +
910
911 "ManualSpawn = " + String.valueOf(isManualSpawn()
912 ) + " | " +
913
914 "AutoTrace = " + String.valueOf(isAutoTrace()
915 ) + " | " +
916
917 "Name = " + String.valueOf(getName()
918 ) + " | " +
919
920 "SpeedMultiplier = " + String.valueOf(getSpeedMultiplier()
921 ) + " | " +
922
923 "RotationRate = " + String.valueOf(getRotationRate()
924 ) + " | " +
925
926 "Invulnerable = " + String.valueOf(isInvulnerable()
927 ) + " | " +
928
929 "SelfUpdateTime = " + String.valueOf(getSelfUpdateTime()
930 ) + " | " +
931
932 "VisionTime = " + String.valueOf(getVisionTime()
933 ) + " | " +
934
935 "ShowDebug = " + String.valueOf(isShowDebug()
936 ) + " | " +
937
938 "ShowFocalPoint = " + String.valueOf(isShowFocalPoint()
939 ) + " | " +
940
941 "DrawTraceLines = " + String.valueOf(isDrawTraceLines()
942 ) + " | " +
943
944 "SynchronousOff = " + String.valueOf(isSynchronousOff()
945 ) + " | " +
946
947 "AutoPickupOff = " + String.valueOf(isAutoPickupOff()
948 ) + " | " +
949
950 "Action = " + String.valueOf(getAction()
951 ) + " | " +
952
953 "]";
954 }
955
956
957 public String toHtmlString() {
958 return super.toString() + "[<br/>" +
959
960 "<b>Id</b> = " + String.valueOf(getId()
961 ) + " <br/> " +
962
963 "<b>BotId</b> = " + String.valueOf(getBotId()
964 ) + " <br/> " +
965
966 "<b>ManualSpawn</b> = " + String.valueOf(isManualSpawn()
967 ) + " <br/> " +
968
969 "<b>AutoTrace</b> = " + String.valueOf(isAutoTrace()
970 ) + " <br/> " +
971
972 "<b>Name</b> = " + String.valueOf(getName()
973 ) + " <br/> " +
974
975 "<b>SpeedMultiplier</b> = " + String.valueOf(getSpeedMultiplier()
976 ) + " <br/> " +
977
978 "<b>RotationRate</b> = " + String.valueOf(getRotationRate()
979 ) + " <br/> " +
980
981 "<b>Invulnerable</b> = " + String.valueOf(isInvulnerable()
982 ) + " <br/> " +
983
984 "<b>SelfUpdateTime</b> = " + String.valueOf(getSelfUpdateTime()
985 ) + " <br/> " +
986
987 "<b>VisionTime</b> = " + String.valueOf(getVisionTime()
988 ) + " <br/> " +
989
990 "<b>ShowDebug</b> = " + String.valueOf(isShowDebug()
991 ) + " <br/> " +
992
993 "<b>ShowFocalPoint</b> = " + String.valueOf(isShowFocalPoint()
994 ) + " <br/> " +
995
996 "<b>DrawTraceLines</b> = " + String.valueOf(isDrawTraceLines()
997 ) + " <br/> " +
998
999 "<b>SynchronousOff</b> = " + String.valueOf(isSynchronousOff()
1000 ) + " <br/> " +
1001
1002 "<b>AutoPickupOff</b> = " + String.valueOf(isAutoPickupOff()
1003 ) + " <br/> " +
1004
1005 "<b>Action</b> = " + String.valueOf(getAction()
1006 ) + " <br/> " +
1007
1008 "<br/>]";
1009 }
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020 }
1021