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 DLGCMD.
19
20 *
21 * <p></p><p></p>
22 * Complete message documentation:
23 *
24 Asynchronous message. Message with data from dialog.
25
26 */
27 public class DialogCommand
28 extends InfoMessage
29 implements IWorldEvent, IWorldChangeEvent
30
31 {
32
33 /** Example how the message looks like - used during parser tests. */
34 public static final String PROTOTYPE =
35 "DLGCMD {Id text} {SourceId text} {Command text} {Data text} ";
36
37
38
39 /**
40 * Parameter-less contructor for the message.
41 */
42 public DialogCommand()
43 {
44 }
45
46
47
48
49 /**
50 * Creates new instance of the message DialogCommand.
51 *
52 Asynchronous message. Message with data from dialog.
53
54 * Corresponding GameBots message
55 *
56 * is
57 * DLGCMD.
58 *
59 *
60 *
61 * @param Id Id of the dialog for with which is this command related to.
62 *
63 *
64 *
65 * @param SourceId Id of the component from where the command originates.
66 *
67 *
68 *
69 * @param Command Type of the command. SUBMIT and CANCEL carry the data.
70 *
71 *
72 *
73 * @param Data Data carried in the message, usually in form "param1=value1¶m2=value2&...¶mN=valueN", equals, ampersands and backslashes are escaped by backslash.
74 *
75 *
76 */
77 public DialogCommand(
78 String Id, String SourceId, String Command, String Data
79 ) {
80
81 this.Id = Id;
82
83 this.SourceId = SourceId;
84
85 this.Command = Command;
86
87 this.Data = Data;
88
89 }
90
91 /**
92 * Cloning constructor from the full message.
93 *
94 * @param original
95 */
96 public DialogCommand(DialogCommand original) {
97
98 this.Id = original.getId()
99 ;
100
101 this.SourceId = original.getSourceId()
102 ;
103
104 this.Command = original.getCommand()
105 ;
106
107 this.Data = original.getData()
108 ;
109
110 this.SimTime = original.getSimTime();
111 }
112
113
114 protected long SimTime;
115
116 /**
117 * Simulation time in MILLI SECONDS !!!
118 */
119 @Override
120 public long getSimTime() {
121 return SimTime;
122 }
123
124 /**
125 * Used by Yylex to slip correct time of the object or programmatically.
126 */
127 protected void setSimTime(long SimTime) {
128 this.SimTime = SimTime;
129 }
130
131
132 /**
133 * Id of the dialog for with which is this command related to.
134 */
135 protected
136 String Id =
137 null;
138
139 /**
140 * Id of the dialog for with which is this command related to.
141 */
142 public String getId()
143 {
144 return Id;
145 }
146
147
148 /**
149 * Id of the component from where the command originates.
150 */
151 protected
152 String SourceId =
153 null;
154
155 /**
156 * Id of the component from where the command originates.
157 */
158 public String getSourceId()
159 {
160 return SourceId;
161 }
162
163
164 /**
165 * Type of the command. SUBMIT and CANCEL carry the data.
166 */
167 protected
168 String Command =
169 null;
170
171 /**
172 * Type of the command. SUBMIT and CANCEL carry the data.
173 */
174 public String getCommand()
175 {
176 return Command;
177 }
178
179
180 /**
181 * Data carried in the message, usually in form "param1=value1¶m2=value2&...¶mN=valueN", equals, ampersands and backslashes are escaped by backslash.
182 */
183 protected
184 String Data =
185 null;
186
187 /**
188 * Data carried in the message, usually in form "param1=value1¶m2=value2&...¶mN=valueN", equals, ampersands and backslashes are escaped by backslash.
189 */
190 public String getData()
191 {
192 return Data;
193 }
194
195
196 public String toString() {
197 return
198 super.toString() + "[" +
199
200 "Id = " + String.valueOf(getId()
201 ) + " | " +
202
203 "SourceId = " + String.valueOf(getSourceId()
204 ) + " | " +
205
206 "Command = " + String.valueOf(getCommand()
207 ) + " | " +
208
209 "Data = " + String.valueOf(getData()
210 ) + " | " +
211
212 "]";
213 }
214
215
216 public String toHtmlString() {
217 return super.toString() + "[<br/>" +
218
219 "<b>Id</b> = " + String.valueOf(getId()
220 ) + " <br/> " +
221
222 "<b>SourceId</b> = " + String.valueOf(getSourceId()
223 ) + " <br/> " +
224
225 "<b>Command</b> = " + String.valueOf(getCommand()
226 ) + " <br/> " +
227
228 "<b>Data</b> = " + String.valueOf(getData()
229 ) + " <br/> " +
230
231 "<br/>]";
232 }
233
234 public String toJsonLiteral() {
235 return "dialogcommand( "
236 +
237 (getId()
238 == null ? "null" :
239 "\"" + getId()
240 + "\""
241 )
242 + ", " +
243 (getSourceId()
244 == null ? "null" :
245 "\"" + getSourceId()
246 + "\""
247 )
248 + ", " +
249 (getCommand()
250 == null ? "null" :
251 "\"" + getCommand()
252 + "\""
253 )
254 + ", " +
255 (getData()
256 == null ? "null" :
257 "\"" + getData()
258 + "\""
259 )
260
261 + ")";
262 }
263
264
265 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
266
267 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
268
269 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
270
271 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
272
273 }
274