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 USED.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Response to USE (FactoryUse) command.
25  	
26           */
27   	public class FactoryUsed 
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      		"USED {Success False}  {Reason text} ";
36      
37      	
38      	
39      	/**
40      	 * Parameter-less contructor for the message.
41      	 */
42  		public FactoryUsed()
43  		{
44  		}
45  	
46      	
47      	
48      	
49      	/**
50  		 * Creates new instance of the message FactoryUsed.
51  		 * 
52  		Asynchronous message. Response to USE (FactoryUse) command.
53  	
54  		 * Corresponding GameBots message
55  		 *   
56  		 *   is
57  		 *   USED.
58  		 * 
59   	  	 * 
60  		 *   
61  		 *     @param Success 
62  			If we have successfully used the factory.
63  		
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param Reason 
68  			If success is false, the reason why we couldn't use a factory will be here.
69  		
70  		 *   
71  		 * 
72  		 */
73  		public FactoryUsed(
74  			boolean Success,  String Reason
75  		) {
76  			
77  					this.Success = Success;
78  				
79  					this.Reason = Reason;
80  				
81  		}
82      
83      	/**
84  		 * Cloning constructor from the full message.
85  		 *
86  		 * @param original
87  		 */
88  		public FactoryUsed(FactoryUsed original) {		
89  			
90  					this.Success = original.isSuccess()
91   	;
92  				
93  					this.Reason = original.getReason()
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 			If we have successfully used the factory.
121 		 
122          */
123         protected
124          boolean Success =
125        	false;
126 	
127  		/**
128          * 
129 			If we have successfully used the factory.
130 		 
131          */
132         public  boolean isSuccess()
133  	 {
134     					return Success;
135     				}
136     			
137     	
138 	    /**
139          * 
140 			If success is false, the reason why we couldn't use a factory will be here.
141 		 
142          */
143         protected
144          String Reason =
145        	null;
146 	
147  		/**
148          * 
149 			If success is false, the reason why we couldn't use a factory will be here.
150 		 
151          */
152         public  String getReason()
153  	 {
154     					return Reason;
155     				}
156     			
157  		
158  	    public String toString() {
159             return
160             	super.toString() + "[" +
161             	
162 		              			"Success = " + String.valueOf(isSuccess()
163  	) + " | " + 
164 		              		
165 		              			"Reason = " + String.valueOf(getReason()
166  	) + " | " + 
167 		              		
168 				"]";           		
169         }
170  	
171  		
172  		public String toHtmlString() {
173  			return super.toString() + "[<br/>" +
174             	
175 		              			"<b>Success</b> = " + String.valueOf(isSuccess()
176  	) + " <br/> " + 
177 		              		
178 		              			"<b>Reason</b> = " + String.valueOf(getReason()
179  	) + " <br/> " + 
180 		              		
181 				"<br/>]";     
182 		}
183  	 
184  	    public String toJsonLiteral() {
185             return "FactoryUsed(null, "
186             		
187                    + ")";
188         }
189  	
190  		
191  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
192         	
193 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
194 		
195 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
196 	        
197 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
198  	
199 		}
200