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 PUO.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Sent when the observed player picks up usable object.
25      
26           */
27   	public class PickedUsableObject 
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      		"PUO {Name text}  {Location 0,0,0} ";
36      
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public PickedUsableObject()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message PickedUsableObject.
51  		 * 
52  		Asynchronous message. Sent when the observed player picks up usable object.
53      
54  		 * Corresponding GameBots message
55  		 *   
56  		 *   is
57  		 *   PUO.
58  		 * 
59   	  	 * 
60  		 *   
61  		 *     @param Name 
62  			Name of the picked usable object.
63  		
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param Location 
68  			Location of the usable object.
69  		
70  		 *   
71  		 * 
72  		 */
73  		public PickedUsableObject(
74  			String Name,  Location Location
75  		) {
76  			
77  					this.Name = Name;
78  				
79  					this.Location = Location;
80  				
81  		}
82      
83      	/**
84  		 * Cloning constructor from the full message.
85  		 *
86  		 * @param original
87  		 */
88  		public PickedUsableObject(PickedUsableObject original) {		
89  			
90  					this.Name = original.getName()
91   	;
92  				
93  					this.Location = original.getLocation()
94   	;
95  				
96  			this.SimTime = original.getSimTime();			
97  		}
98  		
99  	   		
100 			protected long SimTime;
101 				
102 			/**
103 			 * Simulation time in MILLI SECONDS !!!
104 			 */	
105 			@Override
106 			public long getSimTime() {
107 				return SimTime;
108 			}
109 						
110 			/**
111 			 * Used by Yylex to slip correct time of the object or programmatically.
112 			 */
113 			protected void setSimTime(long SimTime) {
114 				this.SimTime = SimTime;
115 			}
116 	   	
117     	
118 	    /**
119          * 
120 			Name of the picked usable object.
121 		 
122          */
123         protected
124          String Name =
125        	null;
126 	
127  		/**
128          * 
129 			Name of the picked usable object.
130 		 
131          */
132         public  String getName()
133  	 {
134     					return Name;
135     				}
136     			
137     	
138 	    /**
139          * 
140 			Location of the usable object.
141 		 
142          */
143         protected
144          Location Location =
145        	null;
146 	
147  		/**
148          * 
149 			Location of the usable object.
150 		 
151          */
152         public  Location getLocation()
153  	 {
154     					return Location;
155     				}
156     			
157  		
158  	    public String toString() {
159             return
160             	super.toString() + "[" +
161             	
162 		              			"Name = " + String.valueOf(getName()
163  	) + " | " + 
164 		              		
165 		              			"Location = " + String.valueOf(getLocation()
166  	) + " | " + 
167 		              		
168 				"]";           		
169         }
170  	
171  		
172  		public String toHtmlString() {
173  			return super.toString() + "[<br/>" +
174             	
175 		              			"<b>Name</b> = " + String.valueOf(getName()
176  	) + " <br/> " + 
177 		              		
178 		              			"<b>Location</b> = " + String.valueOf(getLocation()
179  	) + " <br/> " + 
180 		              		
181 				"<br/>]";     
182 		}
183  	
184  	    public String toJsonLiteral() {
185             return "pickedusableobject( "
186             		+
187 									(getName()
188  	 == null ? "null" :
189 										"\"" + getName()
190  	 + "\"" 
191 									)
192 								+ ", " + 
193 								    (getLocation()
194  	 == null ? "null" :
195 										"[" + getLocation()
196  	.getX() + ", " + getLocation()
197  	.getY() + ", " + getLocation()
198  	.getZ() + "]" 
199 									)
200 								
201                    + ")";
202         }
203  	
204  		
205  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
206         	
207 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
208 		
209 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
210 	        
211 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
212  	
213 		}
214