View Javadoc

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 LOCKED.
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 unsuccessfull because the vehicle is locked for
26  		our bot.
27  	
28           */
29   	public class LockedVehicle 
30    				extends InfoMessage
31      			implements IWorldEvent, IWorldChangeEvent
32      			
33  	    {
34   	
35      	/** Example how the message looks like - used during parser tests. */
36      	public static final String PROTOTYPE =
37      		"LOCKED {Id unreal_id}  {Type text}  {Location 0,0,0} ";
38      
39      	
40      	
41      	/**
42      	 * Parameter-less contructor for the message.
43      	 */
44  		public LockedVehicle()
45  		{
46  		}
47  	
48      	
49      	
50      	
51      	/**
52  		 * Creates new instance of the message LockedVehicle.
53  		 * 
54  		Asynchronous message. Sent as a response to ENTER command. Sent if
55  		the ENTER command was unsuccessfull because the vehicle is locked for
56  		our bot.
57  	
58  		 * Corresponding GameBots message
59  		 *   
60  		 *   is
61  		 *   LOCKED.
62  		 * 
63   	  	 * 
64  		 *   
65  		 *     @param Id Id of the vehicle, which we cannot enter, because it is locked. 
66  		 *   
67  		 * 
68  		 *   
69  		 *     @param Type Type of the vehicle we wanted to enter. What kind of turret or car. 
70  		 *   
71  		 * 
72  		 *   
73  		 *     @param Location Location of the vehicle.
74  		 *   
75  		 * 
76  		 */
77  		public LockedVehicle(
78  			UnrealId Id,  String Type,  Location Location
79  		) {
80  			
81  					this.Id = Id;
82  				
83  					this.Type = Type;
84  				
85  					this.Location = Location;
86  				
87  		}
88      
89      	/**
90  		 * Cloning constructor from the full message.
91  		 *
92  		 * @param original
93  		 */
94  		public LockedVehicle(LockedVehicle original) {		
95  			
96  					this.Id = original.getId()
97   	;
98  				
99  					this.Type = original.getType()
100  	;
101 				
102 					this.Location = original.getLocation()
103  	;
104 				
105 			this.SimTime = original.getSimTime();			
106 		}
107 		
108 	   		
109 			protected long SimTime;
110 				
111 			/**
112 			 * Simulation time in MILLI SECONDS !!!
113 			 */	
114 			@Override
115 			public long getSimTime() {
116 				return SimTime;
117 			}
118 						
119 			/**
120 			 * Used by Yylex to slip correct time of the object or programmatically.
121 			 */
122 			protected void setSimTime(long SimTime) {
123 				this.SimTime = SimTime;
124 			}
125 	   	
126     	
127 	    /**
128          * Id of the vehicle, which we cannot enter, because it is locked.  
129          */
130         protected
131          UnrealId Id =
132        	null;
133 	
134  		/**
135          * Id of the vehicle, which we cannot enter, because it is locked.  
136          */
137         public  UnrealId getId()
138  	 {
139     					return Id;
140     				}
141     			
142     	
143 	    /**
144          * Type of the vehicle we wanted to enter. What kind of turret or car.  
145          */
146         protected
147          String Type =
148        	null;
149 	
150  		/**
151          * Type of the vehicle we wanted to enter. What kind of turret or car.  
152          */
153         public  String getType()
154  	 {
155     					return Type;
156     				}
157     			
158     	
159 	    /**
160          * Location of the vehicle. 
161          */
162         protected
163          Location Location =
164        	null;
165 	
166  		/**
167          * Location of the vehicle. 
168          */
169         public  Location getLocation()
170  	 {
171     					return Location;
172     				}
173     			
174  		
175  	    public String toString() {
176             return
177             	super.toString() + "[" +
178             	
179 		              			"Id = " + String.valueOf(getId()
180  	) + " | " + 
181 		              		
182 		              			"Type = " + String.valueOf(getType()
183  	) + " | " + 
184 		              		
185 		              			"Location = " + String.valueOf(getLocation()
186  	) + " | " + 
187 		              		
188 				"]";           		
189         }
190  	
191  		
192  		public String toHtmlString() {
193  			return super.toString() + "[<br/>" +
194             	
195 		              			"<b>Id</b> = " + String.valueOf(getId()
196  	) + " <br/> " + 
197 		              		
198 		              			"<b>Type</b> = " + String.valueOf(getType()
199  	) + " <br/> " + 
200 		              		
201 		              			"<b>Location</b> = " + String.valueOf(getLocation()
202  	) + " <br/> " + 
203 		              		
204 				"<br/>]";     
205 		}
206  	 
207  	    public String toJsonLiteral() {
208             return "LockedVehicle(null, "
209             		
210                    + ")";
211         }
212  	
213  		
214  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
215         	
216 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
217 		
218 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
219 	        
220 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
221  	
222 		}
223