1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3 // --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
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 // --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6
7
8 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9
10 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11
12 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] BEGIN
13
14 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15
16 /**
17 *
18 Definition of the event FTR.
19
20 *
21 * <p></p><p></p>
22 * Complete message documentation:
23 *
24 Asynchronous message. Response of the FASTTRACE command. Note
25 that trace commands are computationally expensive.
26
27 */
28 public class FastTraceResponse
29 extends InfoMessage
30 implements IWorldEvent, IWorldChangeEvent
31
32 {
33
34 /** Example how the message looks like - used during parser tests. */
35 public static final String PROTOTYPE =
36 "FTR {Id text} {From 0,0,0} {To 0,0,0} {Result False} ";
37
38
39
40 /**
41 * Parameter-less contructor for the message.
42 */
43 public FastTraceResponse()
44 {
45 }
46
47
48
49
50 /**
51 * Creates new instance of the message FastTraceResponse.
52 *
53 Asynchronous message. Response of the FASTTRACE command. Note
54 that trace commands are computationally expensive.
55
56 * Corresponding GameBots message
57 *
58 * is
59 * FTR.
60 *
61 *
62 *
63 * @param Id
64 An Id matching the one sent by client. Allows bot to match
65 answer with right query.
66
67 *
68 *
69 *
70 * @param From
71 Location from which the ray is emitted.
72
73 *
74 *
75 *
76 * @param To
77 Location to which the ray is sent.
78
79 *
80 *
81 *
82 * @param Result
83 True if it hit something, false if not.
84
85 *
86 *
87 */
88 public FastTraceResponse(
89 String Id, Location From, Location To, boolean Result
90 ) {
91
92 this.Id = Id;
93
94 this.From = From;
95
96 this.To = To;
97
98 this.Result = Result;
99
100 }
101
102 /**
103 * Cloning constructor from the full message.
104 *
105 * @param original
106 */
107 public FastTraceResponse(FastTraceResponse original) {
108
109 this.Id = original.getId()
110 ;
111
112 this.From = original.getFrom()
113 ;
114
115 this.To = original.getTo()
116 ;
117
118 this.Result = original.isResult()
119 ;
120
121 this.SimTime = original.getSimTime();
122 }
123
124
125 protected long SimTime;
126
127 /**
128 * Simulation time in MILLI SECONDS !!!
129 */
130 @Override
131 public long getSimTime() {
132 return SimTime;
133 }
134
135 /**
136 * Used by Yylex to slip correct time of the object or programmatically.
137 */
138 protected void setSimTime(long SimTime) {
139 this.SimTime = SimTime;
140 }
141
142
143 /**
144 *
145 An Id matching the one sent by client. Allows bot to match
146 answer with right query.
147
148 */
149 protected
150 String Id =
151 null;
152
153 /**
154 *
155 An Id matching the one sent by client. Allows bot to match
156 answer with right query.
157
158 */
159 public String getId()
160 {
161 return Id;
162 }
163
164
165 /**
166 *
167 Location from which the ray is emitted.
168
169 */
170 protected
171 Location From =
172 null;
173
174 /**
175 *
176 Location from which the ray is emitted.
177
178 */
179 public Location getFrom()
180 {
181 return From;
182 }
183
184
185 /**
186 *
187 Location to which the ray is sent.
188
189 */
190 protected
191 Location To =
192 null;
193
194 /**
195 *
196 Location to which the ray is sent.
197
198 */
199 public Location getTo()
200 {
201 return To;
202 }
203
204
205 /**
206 *
207 True if it hit something, false if not.
208
209 */
210 protected
211 boolean Result =
212 false;
213
214 /**
215 *
216 True if it hit something, false if not.
217
218 */
219 public boolean isResult()
220 {
221 return Result;
222 }
223
224
225 public String toString() {
226 return
227 super.toString() + "[" +
228
229 "Id = " + String.valueOf(getId()
230 ) + " | " +
231
232 "From = " + String.valueOf(getFrom()
233 ) + " | " +
234
235 "To = " + String.valueOf(getTo()
236 ) + " | " +
237
238 "Result = " + String.valueOf(isResult()
239 ) + " | " +
240
241 "]";
242 }
243
244
245 public String toHtmlString() {
246 return super.toString() + "[<br/>" +
247
248 "<b>Id</b> = " + String.valueOf(getId()
249 ) + " <br/> " +
250
251 "<b>From</b> = " + String.valueOf(getFrom()
252 ) + " <br/> " +
253
254 "<b>To</b> = " + String.valueOf(getTo()
255 ) + " <br/> " +
256
257 "<b>Result</b> = " + String.valueOf(isResult()
258 ) + " <br/> " +
259
260 "<br/>]";
261 }
262
263 public String toJsonLiteral() {
264 return "FastTraceResponse(null, "
265
266 + ")";
267 }
268
269
270 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
271
272 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
273
274 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
275
276 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
277
278 }
279