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 MUT.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Info batch message. Starts with SMUT message, ends with EMUT
25  		message. Hold information about current mutators active
26  		on the server.
27  	
28           */
29   	public class Mutator 
30    				extends InfoMessage
31      			implements IWorldEvent, IWorldChangeEvent
32      			
33  	    	,cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IMutator
34  	    {
35   	
36      	/** Example how the message looks like - used during parser tests. */
37      	public static final String PROTOTYPE =
38      		"MUT {Id unreal_id}  {Name text} ";
39      
40      	
41      	
42      	/**
43      	 * Parameter-less contructor for the message.
44      	 */
45  		public Mutator()
46  		{
47  		}
48  	
49      	
50      	
51      	
52      	/**
53  		 * Creates new instance of the message Mutator.
54  		 * 
55  		Info batch message. Starts with SMUT message, ends with EMUT
56  		message. Hold information about current mutators active
57  		on the server.
58  	
59  		 * Corresponding GameBots message
60  		 *   
61  		 *   is
62  		 *   MUT.
63  		 * 
64   	  	 * 
65  		 *   
66  		 *     @param Id 
67  			Id of the mutator. 
68  		
69  		 *   
70  		 * 
71  		 *   
72  		 *     @param Name 
73  			Name of the mutator. 
74  		
75  		 *   
76  		 * 
77  		 */
78  		public Mutator(
79  			UnrealId Id,  String Name
80  		) {
81  			
82  					this.Id = Id;
83  				
84  					this.Name = Name;
85  				
86  		}
87      
88      	/**
89  		 * Cloning constructor from the full message.
90  		 *
91  		 * @param original
92  		 */
93  		public Mutator(Mutator original) {		
94  			
95  					this.Id = original.getId()
96   	;
97  				
98  					this.Name = original.getName()
99   	;
100 				
101 			this.SimTime = original.getSimTime();			
102 		}
103 		
104 	   		
105 			protected long SimTime;
106 				
107 			/**
108 			 * Simulation time in MILLI SECONDS !!!
109 			 */	
110 			@Override
111 			public long getSimTime() {
112 				return SimTime;
113 			}
114 						
115 			/**
116 			 * Used by Yylex to slip correct time of the object or programmatically.
117 			 */
118 			protected void setSimTime(long SimTime) {
119 				this.SimTime = SimTime;
120 			}
121 	   	
122     	
123 	    /**
124          * 
125 			Id of the mutator. 
126 		 
127          */
128         protected
129          UnrealId Id =
130        	null;
131 	
132  		/**
133          * 
134 			Id of the mutator. 
135 		 
136          */
137         public  UnrealId getId()
138  	 {
139     					return Id;
140     				}
141     			
142     	
143 	    /**
144          * 
145 			Name of the mutator. 
146 		 
147          */
148         protected
149          String Name =
150        	null;
151 	
152  		/**
153          * 
154 			Name of the mutator. 
155 		 
156          */
157         public  String getName()
158  	 {
159     					return Name;
160     				}
161     			
162  		
163  	    public String toString() {
164             return
165             	super.toString() + "[" +
166             	
167 		              			"Id = " + String.valueOf(getId()
168  	) + " | " + 
169 		              		
170 		              			"Name = " + String.valueOf(getName()
171  	) + " | " + 
172 		              		
173 				"]";           		
174         }
175  	
176  		
177  		public String toHtmlString() {
178  			return super.toString() + "[<br/>" +
179             	
180 		              			"<b>Id</b> = " + String.valueOf(getId()
181  	) + " <br/> " + 
182 		              		
183 		              			"<b>Name</b> = " + String.valueOf(getName()
184  	) + " <br/> " + 
185 		              		
186 				"<br/>]";     
187 		}
188  	 
189  	    public String toJsonLiteral() {
190             return "Mutator(null, "
191             		
192                    + ")";
193         }
194  	
195  		
196  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
197         	
198 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
199 		
200 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
201 	        
202 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
203  	
204 		}
205