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 GameInfoStaticImpl
30 extends
31 GameInfoStatic
32 {
33
34
35
36
37
38
39 public GameInfoStaticImpl()
40 {
41 }
42
43
44
45
46
47
48 public GameInfoStaticImpl(GameInfo original) {
49
50 this.Gametype = original.getGametype()
51 ;
52
53 this.Level = original.getLevel()
54 ;
55
56 this.MaxTeams = original.getMaxTeams()
57 ;
58
59 this.RedBaseLocation = original.getRedBaseLocation()
60 ;
61
62 this.BlueBaseLocation = original.getBlueBaseLocation()
63 ;
64
65 this.FirstDomPointLocation = original.getFirstDomPointLocation()
66 ;
67
68 this.SecondDomPointLocation = original.getSecondDomPointLocation()
69 ;
70
71 this.FactoryLocation = original.getFactoryLocation()
72 ;
73
74 this.FactoryRadius = original.getFactoryRadius()
75 ;
76
77 this.DisperserLocation = original.getDisperserLocation()
78 ;
79
80 this.DisperserRadius = original.getDisperserRadius()
81 ;
82
83 this.FactoryAdrenalineCount = original.getFactoryAdrenalineCount()
84 ;
85
86 this.FactorySpawnType = original.getFactorySpawnType()
87 ;
88
89 this.SimTime = original.getSimTime();
90 }
91
92
93
94
95
96
97 public GameInfoStaticImpl(GameInfoStaticImpl original) {
98
99 this.Gametype = original.getGametype()
100 ;
101
102 this.Level = original.getLevel()
103 ;
104
105 this.MaxTeams = original.getMaxTeams()
106 ;
107
108 this.RedBaseLocation = original.getRedBaseLocation()
109 ;
110
111 this.BlueBaseLocation = original.getBlueBaseLocation()
112 ;
113
114 this.FirstDomPointLocation = original.getFirstDomPointLocation()
115 ;
116
117 this.SecondDomPointLocation = original.getSecondDomPointLocation()
118 ;
119
120 this.FactoryLocation = original.getFactoryLocation()
121 ;
122
123 this.FactoryRadius = original.getFactoryRadius()
124 ;
125
126 this.DisperserLocation = original.getDisperserLocation()
127 ;
128
129 this.DisperserRadius = original.getDisperserRadius()
130 ;
131
132 this.FactoryAdrenalineCount = original.getFactoryAdrenalineCount()
133 ;
134
135 this.FactorySpawnType = original.getFactorySpawnType()
136 ;
137
138 this.SimTime = original.getSimTime();
139 }
140
141
142
143
144
145
146 public GameInfoStaticImpl(GameInfoStatic original) {
147
148 this.Gametype = original.getGametype()
149 ;
150
151 this.Level = original.getLevel()
152 ;
153
154 this.MaxTeams = original.getMaxTeams()
155 ;
156
157 this.RedBaseLocation = original.getRedBaseLocation()
158 ;
159
160 this.BlueBaseLocation = original.getBlueBaseLocation()
161 ;
162
163 this.FirstDomPointLocation = original.getFirstDomPointLocation()
164 ;
165
166 this.SecondDomPointLocation = original.getSecondDomPointLocation()
167 ;
168
169 this.FactoryLocation = original.getFactoryLocation()
170 ;
171
172 this.FactoryRadius = original.getFactoryRadius()
173 ;
174
175 this.DisperserLocation = original.getDisperserLocation()
176 ;
177
178 this.DisperserRadius = original.getDisperserRadius()
179 ;
180
181 this.FactoryAdrenalineCount = original.getFactoryAdrenalineCount()
182 ;
183
184 this.FactorySpawnType = original.getFactorySpawnType()
185 ;
186
187 }
188
189
190 public UnrealId getId() {
191 return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo.GameInfoId;
192 }
193
194
195 @Override
196 public void setSimTime(long SimTime) {
197 super.setSimTime(SimTime);
198 }
199
200 @Override
201 public
202 GameInfoStaticImpl clone() {
203 return new
204 GameInfoStaticImpl(this);
205 }
206
207
208
209
210
211
212
213
214
215 protected
216 String Gametype =
217 null;
218
219
220
221
222
223
224
225 public String getGametype()
226 {
227 return Gametype;
228 }
229
230
231
232
233
234 protected
235 String Level =
236 null;
237
238
239
240
241 public String getLevel()
242 {
243 return Level;
244 }
245
246
247
248
249
250
251
252
253
254 protected
255 int MaxTeams =
256 0;
257
258
259
260
261
262
263
264
265 public int getMaxTeams()
266 {
267 return MaxTeams;
268 }
269
270
271
272
273
274
275
276 protected
277 Location RedBaseLocation =
278 null;
279
280
281
282
283
284
285 public Location getRedBaseLocation()
286 {
287 return RedBaseLocation;
288 }
289
290
291
292
293
294
295
296 protected
297 Location BlueBaseLocation =
298 null;
299
300
301
302
303
304
305 public Location getBlueBaseLocation()
306 {
307 return BlueBaseLocation;
308 }
309
310
311
312
313
314
315
316 protected
317 Location FirstDomPointLocation =
318 null;
319
320
321
322
323
324
325 public Location getFirstDomPointLocation()
326 {
327 return FirstDomPointLocation;
328 }
329
330
331
332
333
334
335
336 protected
337 Location SecondDomPointLocation =
338 null;
339
340
341
342
343
344
345 public Location getSecondDomPointLocation()
346 {
347 return SecondDomPointLocation;
348 }
349
350
351
352
353
354
355
356 protected
357 Location FactoryLocation =
358 null;
359
360
361
362
363
364
365 public Location getFactoryLocation()
366 {
367 return FactoryLocation;
368 }
369
370
371
372
373
374
375
376 protected
377 double FactoryRadius =
378 0;
379
380
381
382
383
384
385 public double getFactoryRadius()
386 {
387 return FactoryRadius;
388 }
389
390
391
392
393
394
395
396 protected
397 Location DisperserLocation =
398 null;
399
400
401
402
403
404
405 public Location getDisperserLocation()
406 {
407 return DisperserLocation;
408 }
409
410
411
412
413
414
415
416 protected
417 double DisperserRadius =
418 0;
419
420
421
422
423
424
425 public double getDisperserRadius()
426 {
427 return DisperserRadius;
428 }
429
430
431
432
433
434
435
436 protected
437 double FactoryAdrenalineCount =
438 0;
439
440
441
442
443
444
445 public double getFactoryAdrenalineCount()
446 {
447 return FactoryAdrenalineCount;
448 }
449
450
451
452
453
454
455
456 protected
457 String FactorySpawnType =
458 null;
459
460
461
462
463
464
465 public String getFactorySpawnType()
466 {
467 return FactorySpawnType;
468 }
469
470
471
472 public static class GameInfoStaticUpdate
473 implements IStaticWorldObjectUpdatedEvent
474 {
475
476 private GameInfoStatic data;
477 private long time;
478
479 public GameInfoStaticUpdate
480 (GameInfoStatic source, long time)
481 {
482 this.data = source;
483 this.time = time;
484 }
485
486
487
488
489 @Override
490 public long getSimTime() {
491 return time;
492 }
493
494 @Override
495 public WorldObjectId getId() {
496 return data.getId();
497 }
498
499 @Override
500 public IWorldObjectUpdateResult<IStaticWorldObject> update(
501 IStaticWorldObject object) {
502 if ( object == null)
503 {
504 data = new GameInfoStaticImpl(data);
505 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IStaticWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
506 }
507
508 if ( object instanceof GameInfoStaticImpl)
509 {
510 GameInfoStaticImpl orig = (GameInfoStaticImpl)object;
511
512 if ( data.isDifferentFrom(orig) )
513 {
514
515
516 System.out.println("!!!!!ERROR!!!!!! in static object modification. Object class : GameInfoStaticImpl to see which property was different see !!!!PROPERTY UPDATE ERROR!!!!");
517 }
518 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IStaticWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
519 }
520 throw new PogamutException("Unexpected object type for update, GameInfoStaticImpl expected not class " + object.getClass().getSimpleName() + ".", this);
521 }
522 }
523
524
525
526 @Override
527 public boolean isDifferentFrom(IStaticWorldObject other)
528 {
529 if (other == null)
530 {
531 return true;
532 }
533 else if (other == this)
534 {
535 return false;
536 }
537 else
538 {
539 GameInfoStatic obj = (GameInfoStatic) other;
540
541
542 if ( !(
543 AdvancedEquals.equalsOrNull(this.getGametype()
544 , obj.getGametype()
545 )
546 ) )
547 {
548 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Gametype on object class GameInfoStatic");
549 return true;
550 }
551
552 if ( !(
553 AdvancedEquals.equalsOrNull(this.getLevel()
554 , obj.getLevel()
555 )
556 ) )
557 {
558 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Level on object class GameInfoStatic");
559 return true;
560 }
561
562 if ( !(this.getMaxTeams()
563
564 == obj.getMaxTeams()
565 ) )
566 {
567 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property MaxTeams on object class GameInfoStatic");
568 return true;
569 }
570
571 if ( !(
572 AdvancedEquals.equalsOrNull(this.getRedBaseLocation()
573 , obj.getRedBaseLocation()
574 )
575 ) )
576 {
577 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property RedBaseLocation on object class GameInfoStatic");
578 return true;
579 }
580
581 if ( !(
582 AdvancedEquals.equalsOrNull(this.getBlueBaseLocation()
583 , obj.getBlueBaseLocation()
584 )
585 ) )
586 {
587 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property BlueBaseLocation on object class GameInfoStatic");
588 return true;
589 }
590
591 if ( !(
592 AdvancedEquals.equalsOrNull(this.getFirstDomPointLocation()
593 , obj.getFirstDomPointLocation()
594 )
595 ) )
596 {
597 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FirstDomPointLocation on object class GameInfoStatic");
598 return true;
599 }
600
601 if ( !(
602 AdvancedEquals.equalsOrNull(this.getSecondDomPointLocation()
603 , obj.getSecondDomPointLocation()
604 )
605 ) )
606 {
607 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property SecondDomPointLocation on object class GameInfoStatic");
608 return true;
609 }
610
611 if ( !(
612 AdvancedEquals.equalsOrNull(this.getFactoryLocation()
613 , obj.getFactoryLocation()
614 )
615 ) )
616 {
617 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactoryLocation on object class GameInfoStatic");
618 return true;
619 }
620
621 if ( !(this.getFactoryRadius()
622
623 == obj.getFactoryRadius()
624 ) )
625 {
626 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactoryRadius on object class GameInfoStatic");
627 return true;
628 }
629
630 if ( !(
631 AdvancedEquals.equalsOrNull(this.getDisperserLocation()
632 , obj.getDisperserLocation()
633 )
634 ) )
635 {
636 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DisperserLocation on object class GameInfoStatic");
637 return true;
638 }
639
640 if ( !(this.getDisperserRadius()
641
642 == obj.getDisperserRadius()
643 ) )
644 {
645 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DisperserRadius on object class GameInfoStatic");
646 return true;
647 }
648
649 if ( !(this.getFactoryAdrenalineCount()
650
651 == obj.getFactoryAdrenalineCount()
652 ) )
653 {
654 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactoryAdrenalineCount on object class GameInfoStatic");
655 return true;
656 }
657
658 if ( !(
659 AdvancedEquals.equalsOrNull(this.getFactorySpawnType()
660 , obj.getFactorySpawnType()
661 )
662 ) )
663 {
664 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactorySpawnType on object class GameInfoStatic");
665 return true;
666 }
667
668 }
669 return false;
670 }
671
672
673 public String toString() {
674 return
675 super.toString() + "[" +
676
677 "Gametype = " + String.valueOf(getGametype()
678 ) + " | " +
679
680 "Level = " + String.valueOf(getLevel()
681 ) + " | " +
682
683 "MaxTeams = " + String.valueOf(getMaxTeams()
684 ) + " | " +
685
686 "RedBaseLocation = " + String.valueOf(getRedBaseLocation()
687 ) + " | " +
688
689 "BlueBaseLocation = " + String.valueOf(getBlueBaseLocation()
690 ) + " | " +
691
692 "FirstDomPointLocation = " + String.valueOf(getFirstDomPointLocation()
693 ) + " | " +
694
695 "SecondDomPointLocation = " + String.valueOf(getSecondDomPointLocation()
696 ) + " | " +
697
698 "FactoryLocation = " + String.valueOf(getFactoryLocation()
699 ) + " | " +
700
701 "FactoryRadius = " + String.valueOf(getFactoryRadius()
702 ) + " | " +
703
704 "DisperserLocation = " + String.valueOf(getDisperserLocation()
705 ) + " | " +
706
707 "DisperserRadius = " + String.valueOf(getDisperserRadius()
708 ) + " | " +
709
710 "FactoryAdrenalineCount = " + String.valueOf(getFactoryAdrenalineCount()
711 ) + " | " +
712
713 "FactorySpawnType = " + String.valueOf(getFactorySpawnType()
714 ) + " | " +
715
716 "]";
717 }
718
719
720 public String toHtmlString() {
721 return super.toString() + "[<br/>" +
722
723 "<b>Gametype</b> = " + String.valueOf(getGametype()
724 ) + " <br/> " +
725
726 "<b>Level</b> = " + String.valueOf(getLevel()
727 ) + " <br/> " +
728
729 "<b>MaxTeams</b> = " + String.valueOf(getMaxTeams()
730 ) + " <br/> " +
731
732 "<b>RedBaseLocation</b> = " + String.valueOf(getRedBaseLocation()
733 ) + " <br/> " +
734
735 "<b>BlueBaseLocation</b> = " + String.valueOf(getBlueBaseLocation()
736 ) + " <br/> " +
737
738 "<b>FirstDomPointLocation</b> = " + String.valueOf(getFirstDomPointLocation()
739 ) + " <br/> " +
740
741 "<b>SecondDomPointLocation</b> = " + String.valueOf(getSecondDomPointLocation()
742 ) + " <br/> " +
743
744 "<b>FactoryLocation</b> = " + String.valueOf(getFactoryLocation()
745 ) + " <br/> " +
746
747 "<b>FactoryRadius</b> = " + String.valueOf(getFactoryRadius()
748 ) + " <br/> " +
749
750 "<b>DisperserLocation</b> = " + String.valueOf(getDisperserLocation()
751 ) + " <br/> " +
752
753 "<b>DisperserRadius</b> = " + String.valueOf(getDisperserRadius()
754 ) + " <br/> " +
755
756 "<b>FactoryAdrenalineCount</b> = " + String.valueOf(getFactoryAdrenalineCount()
757 ) + " <br/> " +
758
759 "<b>FactorySpawnType</b> = " + String.valueOf(getFactorySpawnType()
760 ) + " <br/> " +
761
762 "<br/>]";
763 }
764
765
766
767
768
769
770
771
772
773
774 }
775