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 RCH.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. A boolean result of a checkreach call.
25  	
26           */
27   	public class Reachable 
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      		"RCH {Id text}  {Reachable False}  {From 0,0,0} ";
36      
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public Reachable()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message Reachable.
51  		 * 
52  		Asynchronous message. A boolean result of a checkreach call.
53  	
54  		 * Corresponding GameBots message
55  		 *   
56  		 *   is
57  		 *   RCH.
58  		 * 
59   	  	 * 
60  		 *   
61  		 *     @param Id 
62  			An Id matching the one sent by client. Allows bot to match
63  			answer with right querry.
64  		
65  		 *   
66  		 * 
67  		 *   
68  		 *     @param Reachable 
69  			True if the bot can run here directly, false otherwise.
70  		
71  		 *   
72  		 * 
73  		 *   
74  		 *     @param From 
75  			Exact location of bot at time of check.
76  		
77  		 *   
78  		 * 
79  		 */
80  		public Reachable(
81  			String Id,  boolean Reachable,  Location From
82  		) {
83  			
84  					this.Id = Id;
85  				
86  					this.Reachable = Reachable;
87  				
88  					this.From = From;
89  				
90  		}
91      
92      	/**
93  		 * Cloning constructor from the full message.
94  		 *
95  		 * @param original
96  		 */
97  		public Reachable(Reachable original) {		
98  			
99  					this.Id = original.getId()
100  	;
101 				
102 					this.Reachable = original.isReachable()
103  	;
104 				
105 					this.From = original.getFrom()
106  	;
107 				
108 			this.SimTime = original.getSimTime();			
109 		}
110 		
111 	   		
112 			protected long SimTime;
113 				
114 			/**
115 			 * Simulation time in MILLI SECONDS !!!
116 			 */	
117 			@Override
118 			public long getSimTime() {
119 				return SimTime;
120 			}
121 						
122 			/**
123 			 * Used by Yylex to slip correct time of the object or programmatically.
124 			 */
125 			protected void setSimTime(long SimTime) {
126 				this.SimTime = SimTime;
127 			}
128 	   	
129     	
130 	    /**
131          * 
132 			An Id matching the one sent by client. Allows bot to match
133 			answer with right querry.
134 		 
135          */
136         protected
137          String Id =
138        	null;
139 	
140  		/**
141          * 
142 			An Id matching the one sent by client. Allows bot to match
143 			answer with right querry.
144 		 
145          */
146         public  String getId()
147  	 {
148     					return Id;
149     				}
150     			
151     	
152 	    /**
153          * 
154 			True if the bot can run here directly, false otherwise.
155 		 
156          */
157         protected
158          boolean Reachable =
159        	false;
160 	
161  		/**
162          * 
163 			True if the bot can run here directly, false otherwise.
164 		 
165          */
166         public  boolean isReachable()
167  	 {
168     					return Reachable;
169     				}
170     			
171     	
172 	    /**
173          * 
174 			Exact location of bot at time of check.
175 		 
176          */
177         protected
178          Location From =
179        	null;
180 	
181  		/**
182          * 
183 			Exact location of bot at time of check.
184 		 
185          */
186         public  Location getFrom()
187  	 {
188     					return From;
189     				}
190     			
191  		
192  	    public String toString() {
193             return
194             	super.toString() + "[" +
195             	
196 		              			"Id = " + String.valueOf(getId()
197  	) + " | " + 
198 		              		
199 		              			"Reachable = " + String.valueOf(isReachable()
200  	) + " | " + 
201 		              		
202 		              			"From = " + String.valueOf(getFrom()
203  	) + " | " + 
204 		              		
205 				"]";           		
206         }
207  	
208  		
209  		public String toHtmlString() {
210  			return super.toString() + "[<br/>" +
211             	
212 		              			"<b>Id</b> = " + String.valueOf(getId()
213  	) + " <br/> " + 
214 		              		
215 		              			"<b>Reachable</b> = " + String.valueOf(isReachable()
216  	) + " <br/> " + 
217 		              		
218 		              			"<b>From</b> = " + String.valueOf(getFrom()
219  	) + " <br/> " + 
220 		              		
221 				"<br/>]";     
222 		}
223  	 
224  	    public String toJsonLiteral() {
225             return "Reachable(null, "
226             		
227                    + ")";
228         }
229  	
230  		
231  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
232         	
233 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
234 		
235 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
236 	        
237 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
238  	
239 		}
240