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