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 public class PlayerStaticImpl
31 extends
32 PlayerStatic
33 {
34
35
36
37
38
39
40 public PlayerStaticImpl()
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 public PlayerStaticImpl(
99 UnrealId Id
100 ) {
101
102 this.Id = Id;
103
104 }
105
106
107
108
109
110
111 public PlayerStaticImpl(Player original) {
112
113 this.Id = original.getId()
114 ;
115
116 this.SimTime = original.getSimTime();
117 }
118
119
120
121
122
123
124 public PlayerStaticImpl(PlayerStaticImpl original) {
125
126 this.Id = original.getId()
127 ;
128
129 this.SimTime = original.getSimTime();
130 }
131
132
133
134
135
136
137 public PlayerStaticImpl(PlayerStatic original) {
138
139 this.Id = original.getId()
140 ;
141
142 }
143
144
145 @Override
146 public void setSimTime(long SimTime) {
147 super.setSimTime(SimTime);
148 }
149
150 @Override
151 public
152 PlayerStaticImpl clone() {
153 return new
154 PlayerStaticImpl(this);
155 }
156
157
158
159
160
161
162 protected
163 UnrealId Id =
164 null;
165
166
167
168
169 public UnrealId getId()
170 {
171 return Id;
172 }
173
174
175
176 public static class PlayerStaticUpdate
177 implements IStaticWorldObjectUpdatedEvent
178 {
179
180 private PlayerStatic data;
181 private long time;
182
183 public PlayerStaticUpdate
184 (PlayerStatic source, long time)
185 {
186 this.data = source;
187 this.time = time;
188 }
189
190
191
192
193 @Override
194 public long getSimTime() {
195 return time;
196 }
197
198 @Override
199 public WorldObjectId getId() {
200 return data.getId();
201 }
202
203 @Override
204 public IWorldObjectUpdateResult<IStaticWorldObject> update(
205 IStaticWorldObject object) {
206 if ( object == null)
207 {
208 data = new PlayerStaticImpl(data);
209 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IStaticWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
210 }
211
212 if ( object instanceof PlayerStaticImpl)
213 {
214 PlayerStaticImpl orig = (PlayerStaticImpl)object;
215
216 if ( data.isDifferentFrom(orig) )
217 {
218
219
220 System.out.println("!!!!!ERROR!!!!!! in static object modification. Object class : PlayerStaticImpl to see which property was different see !!!!PROPERTY UPDATE ERROR!!!!");
221 }
222 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IStaticWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
223 }
224 throw new PogamutException("Unexpected object type for update, PlayerStaticImpl expected not class " + object.getClass().getSimpleName() + ".", this);
225 }
226 }
227
228
229
230 @Override
231 public boolean isDifferentFrom(IStaticWorldObject other)
232 {
233 if (other == null)
234 {
235 return true;
236 }
237 else if (other == this)
238 {
239 return false;
240 }
241 else
242 {
243 PlayerStatic obj = (PlayerStatic) other;
244
245
246 if ( !(
247 AdvancedEquals.equalsOrNull(this.getId()
248 , obj.getId()
249 )
250 ) )
251 {
252 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class PlayerStatic");
253 return true;
254 }
255
256 }
257 return false;
258 }
259
260
261 public String toString() {
262 return
263 super.toString() + "[" +
264
265 "Id = " + String.valueOf(getId()
266 ) + " | " +
267
268 "]";
269 }
270
271
272 public String toHtmlString() {
273 return super.toString() + "[<br/>" +
274
275 "<b>Id</b> = " + String.valueOf(getId()
276 ) + " <br/> " +
277
278 "<br/>]";
279 }
280
281
282
283
284
285
286
287
288
289
290 }
291