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 BEG.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Begin message signalizes start of
25  		synchronous batch. In the batch are send information about
26  		visible navpoints, game status, items and so on.
27  	
28           */
29   	public class BeginMessage 
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      		"BEG {Time 0}  {VisUpdate False} ";
38      
39      	
40      	
41      	/**
42      	 * Parameter-less contructor for the message.
43      	 */
44  		public BeginMessage()
45  		{
46  		}
47  	
48      	
49      	
50      	
51      	/**
52  		 * Creates new instance of the message BeginMessage.
53  		 * 
54  		Synchronous message. Begin message signalizes start of
55  		synchronous batch. In the batch are send information about
56  		visible navpoints, game status, items and so on.
57  	
58  		 * Corresponding GameBots message
59  		 *   
60  		 *   is
61  		 *   BEG.
62  		 * 
63   	  	 * 
64  		 *   
65  		 *     @param Time Timestamp form the GameBots.
66  		 *   
67  		 * 
68  		 *   
69  		 *     @param VisUpdate Sent only if new synchronous batch procotol is used (NewSelfBatchProtocol attribute in INIT message). If true it means this sync. batches contains also visiblity information - PLR, INV, PRJ messages... If false, it means that only SELF message is in this synchronous batch.
70  		 *   
71  		 * 
72  		 */
73  		public BeginMessage(
74  			double Time,  boolean VisUpdate
75  		) {
76  			
77  					this.Time = Time;
78  				
79  					this.VisUpdate = VisUpdate;
80  				
81  		}
82      
83      	/**
84  		 * Cloning constructor from the full message.
85  		 *
86  		 * @param original
87  		 */
88  		public BeginMessage(BeginMessage original) {		
89  			
90  					this.Time = original.getTime()
91   	;
92  				
93  					this.VisUpdate = original.isVisUpdate()
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          * Timestamp form the GameBots. 
120          */
121         protected
122          double Time =
123        	0;
124 	
125  		/**
126          * Timestamp form the GameBots. 
127          */
128         public  double getTime()
129  	 {
130     					return Time;
131     				}
132     			
133     	
134 	    /**
135          * Sent only if new synchronous batch procotol is used (NewSelfBatchProtocol attribute in INIT message). If true it means this sync. batches contains also visiblity information - PLR, INV, PRJ messages... If false, it means that only SELF message is in this synchronous batch. 
136          */
137         protected
138          boolean VisUpdate =
139        	false;
140 	
141  		/**
142          * Sent only if new synchronous batch procotol is used (NewSelfBatchProtocol attribute in INIT message). If true it means this sync. batches contains also visiblity information - PLR, INV, PRJ messages... If false, it means that only SELF message is in this synchronous batch. 
143          */
144         public  boolean isVisUpdate()
145  	 {
146     					return VisUpdate;
147     				}
148     			
149  		
150  	    public String toString() {
151             return
152             	super.toString() + "[" +
153             	
154 		              			"Time = " + String.valueOf(getTime()
155  	) + " | " + 
156 		              		
157 		              			"VisUpdate = " + String.valueOf(isVisUpdate()
158  	) + " | " + 
159 		              		
160 				"]";           		
161         }
162  	
163  		
164  		public String toHtmlString() {
165  			return super.toString() + "[<br/>" +
166             	
167 		              			"<b>Time</b> = " + String.valueOf(getTime()
168  	) + " <br/> " + 
169 		              		
170 		              			"<b>VisUpdate</b> = " + String.valueOf(isVisUpdate()
171  	) + " <br/> " + 
172 		              		
173 				"<br/>]";     
174 		}
175  	
176  	    public String toJsonLiteral() {
177             return "beginmessage( "
178             		+
179 								    String.valueOf(getTime()
180  	)									
181 								+ ", " + 
182 								    String.valueOf(isVisUpdate()
183  	)									
184 								
185                    + ")";
186         }
187  	
188  		
189  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
190         	
191 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
192 		
193 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
194 	        
195 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
196  	
197 		}
198