1 package cz.cuni.amis.pogamut.usar2004.communication.messages.usarcommands;
2
3 import cz.cuni.amis.pogamut.base.communication.messages.*;
4 import cz.cuni.amis.pogamut.base3d.worldview.object.*;
5 import cz.cuni.amis.pogamut.usar2004.communication.messages.datatypes.CustomTypes.*;
6
7
8
9
10
11
12
13
14
15
16 public class Initialize extends CommandMessage
17 {
18 public Initialize(String ClassName, String Name, Location Location, Rotation Rotation, String Skin, String Team)
19 {
20 this.ClassName = ClassName;
21 this.Name = Name;
22 this.Location = Location;
23 this.Rotation = Rotation;
24 this.Skin = Skin;
25 this.Team = Team;
26 }
27
28 public Initialize(String ClassName, String Name, Location Location, Rotation Rotation)
29 {
30 this.ClassName = ClassName;
31 this.Name = Name;
32 this.Location = Location;
33 this.Rotation = Rotation;
34 }
35
36 public Initialize(String ClassName, String Name, String StringLocation, String Skin, String Team)
37 {
38 this.ClassName = ClassName;
39 this.Name = Name;
40 this.StartPosition = StringLocation;
41 this.Skin = Skin;
42 this.Team = Team;
43 }
44
45 public Initialize(String ClassName, String Name, String StringLocation)
46 {
47 this.ClassName = ClassName;
48 this.Name = Name;
49 this.StartPosition = StringLocation;
50 }
51
52
53
54
55
56 public Initialize()
57 {
58 }
59
60
61
62
63
64
65 protected String ClassName = null;
66
67 public String getClassName()
68 {
69 return ClassName;
70 }
71
72 public Initialize setClassName(String ClassName)
73 {
74 this.ClassName = ClassName;
75 return this;
76 }
77
78
79
80 protected String Name = null;
81
82 public String getName()
83 {
84 return Name;
85 }
86
87 public Initialize setName(String Name)
88 {
89 this.Name = Name;
90 return this;
91 }
92
93
94
95
96
97
98
99
100 protected Location Location = null;
101
102 public Location getLocation()
103 {
104 return Location;
105 }
106
107 public Initialize setLocation(Location Location)
108 {
109 this.Location = Location;
110 return this;
111 }
112
113 protected String StartPosition = null;
114
115 public String getStartPosition()
116 {
117 return StartPosition;
118 }
119 protected Rotation Rotation = null;
120
121 public Rotation getRotation()
122 {
123 return Rotation;
124 }
125
126 public Initialize setRotation(Rotation Rotation)
127 {
128 this.Rotation = Rotation;
129 return this;
130 }
131
132
133 protected String Skin = null;
134
135 public String getSkin()
136 {
137 return Skin;
138 }
139 protected String Team = null;
140
141 public String getTeam()
142 {
143 return Team;
144 }
145
146
147
148
149
150
151
152
153
154
155
156 public Initialize(Initialize original)
157 {
158 this.Name = original.Name;
159 this.Location = original.Location;
160 this.ClassName = original.ClassName;
161 this.StartPosition = original.StartPosition;
162 this.Skin = original.Skin;
163 this.Team = original.Team;
164 this.Rotation = original.Rotation;
165 }
166
167 @Override
168 public String toString()
169 {
170 return toMessage();
171
172 }
173
174 public String toHtmlString()
175 {
176 return super.toString()
177 + "<b>ClassName</b> : "
178 + String.valueOf(ClassName)
179 + " <br/> "
180 + "<b>Name</b> : "
181 + String.valueOf(Name)
182 + " <br/> "
183 + "<b>Location</b> : "
184 + String.valueOf(Location)
185 + " <br/> "
186 + "<b>Start</b> : "
187 + String.valueOf(StartPosition)
188 + " <br/> "
189 + "<b>Skin</b> : "
190 + String.valueOf(Skin)
191 + " <br/> "
192 + "<b>Team</b> : "
193 + String.valueOf(Team)
194 + " <br/> "
195 + "<b>Rotation</b> : "
196 + String.valueOf(Rotation)
197 + " <br/> "
198 + "";
199 }
200
201 public String toMessage()
202 {
203
204 StringBuilder buf = new StringBuilder();
205 buf.append("INIT");
206 if(ClassName != null)
207 {
208 buf.append(" {ClassName ").append(ClassName).append("}");
209 }
210
211 if(Name != null)
212 {
213 buf.append(" {Name ").append(Name).append("}");
214 }
215
216 if(Location != null)
217 {
218 buf.append(" {Location ").append(Location.getX()).append(",").append(Location.getY()).append(",").append(Location.getZ()).append("}");
219 }
220
221 if(StartPosition != null)
222 {
223 buf.append(" {Start ").append(StartPosition).append("}");
224 }
225
226 if(Rotation != null)
227 {
228 buf.append(" {Rotation ").append(Rotation.getRoll()).append(",").append(Rotation.getPitch()).append(",").append(Rotation.getYaw()).append("}");
229 }
230
231 if(Skin != null)
232 {
233 buf.append(" {Skin ").append(Skin).append("}");
234 }
235
236 if(Team != null)
237 {
238 buf.append(" {Team ").append(Team).append("}");
239 }
240 return buf.toString();
241 }
242 }