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