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 ENTERED.
19
20 *
21 * <p></p><p></p>
22 * Complete message documentation:
23 *
24 Asynchronous message. Sent as a response to ENTER command. Sent if
25 the ENTER command was successfull. Means we are now driving the vehicle.
26 Beware! When in vehicle just command RUNTO with Target specified works for move commands. Any other move commands will cause vehicle to got straight ahead.
27 Also it is not possible to control speed or steering at this moment. Everything is done automaticaly by RUNTO with Target specified.
28
29 */
30 public class EnteredVehicle
31 extends InfoMessage
32 implements IWorldEvent, IWorldChangeEvent
33
34 {
35
36 /** Example how the message looks like - used during parser tests. */
37 public static final String PROTOTYPE =
38 "ENTERED {Id unreal_id} {Type text} {Location 0,0,0} ";
39
40
41
42 /**
43 * Parameter-less contructor for the message.
44 */
45 public EnteredVehicle()
46 {
47 }
48
49
50
51
52 /**
53 * Creates new instance of the message EnteredVehicle.
54 *
55 Asynchronous message. Sent as a response to ENTER command. Sent if
56 the ENTER command was successfull. Means we are now driving the vehicle.
57 Beware! When in vehicle just command RUNTO with Target specified works for move commands. Any other move commands will cause vehicle to got straight ahead.
58 Also it is not possible to control speed or steering at this moment. Everything is done automaticaly by RUNTO with Target specified.
59
60 * Corresponding GameBots message
61 *
62 * is
63 * ENTERED.
64 *
65 *
66 *
67 * @param Id Id of the vehicle entered.
68 *
69 *
70 *
71 * @param Type Type of the vehicle entered. What kind of turret or car.
72 *
73 *
74 *
75 * @param Location Location of the vehicle.
76 *
77 *
78 */
79 public EnteredVehicle(
80 UnrealId Id, String Type, Location Location
81 ) {
82
83 this.Id = Id;
84
85 this.Type = Type;
86
87 this.Location = Location;
88
89 }
90
91 /**
92 * Cloning constructor from the full message.
93 *
94 * @param original
95 */
96 public EnteredVehicle(EnteredVehicle original) {
97
98 this.Id = original.getId()
99 ;
100
101 this.Type = original.getType()
102 ;
103
104 this.Location = original.getLocation()
105 ;
106
107 this.SimTime = original.getSimTime();
108 }
109
110
111 protected long SimTime;
112
113 /**
114 * Simulation time in MILLI SECONDS !!!
115 */
116 @Override
117 public long getSimTime() {
118 return SimTime;
119 }
120
121 /**
122 * Used by Yylex to slip correct time of the object or programmatically.
123 */
124 protected void setSimTime(long SimTime) {
125 this.SimTime = SimTime;
126 }
127
128
129 /**
130 * Id of the vehicle entered.
131 */
132 protected
133 UnrealId Id =
134 null;
135
136 /**
137 * Id of the vehicle entered.
138 */
139 public UnrealId getId()
140 {
141 return Id;
142 }
143
144
145 /**
146 * Type of the vehicle entered. What kind of turret or car.
147 */
148 protected
149 String Type =
150 null;
151
152 /**
153 * Type of the vehicle entered. What kind of turret or car.
154 */
155 public String getType()
156 {
157 return Type;
158 }
159
160
161 /**
162 * Location of the vehicle.
163 */
164 protected
165 Location Location =
166 null;
167
168 /**
169 * Location of the vehicle.
170 */
171 public Location getLocation()
172 {
173 return Location;
174 }
175
176
177 public String toString() {
178 return
179 super.toString() + "[" +
180
181 "Id = " + String.valueOf(getId()
182 ) + " | " +
183
184 "Type = " + String.valueOf(getType()
185 ) + " | " +
186
187 "Location = " + String.valueOf(getLocation()
188 ) + " | " +
189
190 "]";
191 }
192
193
194 public String toHtmlString() {
195 return super.toString() + "[<br/>" +
196
197 "<b>Id</b> = " + String.valueOf(getId()
198 ) + " <br/> " +
199
200 "<b>Type</b> = " + String.valueOf(getType()
201 ) + " <br/> " +
202
203 "<b>Location</b> = " + String.valueOf(getLocation()
204 ) + " <br/> " +
205
206 "<br/>]";
207 }
208
209 public String toJsonLiteral() {
210 return "enteredvehicle( "
211 +
212 (getId()
213 == null ? "null" :
214 "\"" + getId()
215 .getStringId() + "\""
216 )
217 + ", " +
218 (getType()
219 == null ? "null" :
220 "\"" + getType()
221 + "\""
222 )
223 + ", " +
224 (getLocation()
225 == null ? "null" :
226 "[" + getLocation()
227 .getX() + ", " + getLocation()
228 .getY() + ", " + getLocation()
229 .getZ() + "]"
230 )
231
232 + ")";
233 }
234
235
236 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
237
238 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
239
240 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
241
242 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
243
244 }
245