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 PONG.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  Response to the PING command.
24           */
25   	public class Pong 
26    				extends InfoMessage
27      			implements IWorldEvent, IWorldChangeEvent
28      			
29  	    {
30   	
31      	/** Example how the message looks like - used during parser tests. */
32      	public static final String PROTOTYPE =
33      		"PONG {Time 0} ";
34      
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public Pong()
41  		{
42  		}
43  	
44      	
45      	
46      	
47      	/**
48  		 * Creates new instance of the message Pong.
49  		 * Response to the PING command.
50  		 * Corresponding GameBots message
51  		 *   
52  		 *   is
53  		 *   PONG.
54  		 * 
55   	  	 * 
56  		 *   
57  		 *     @param Time Timestamp from the GameBots.
58  		 *   
59  		 * 
60  		 */
61  		public Pong(
62  			double Time
63  		) {
64  			
65  					this.Time = Time;
66  				
67  		}
68      
69      	/**
70  		 * Cloning constructor from the full message.
71  		 *
72  		 * @param original
73  		 */
74  		public Pong(Pong original) {		
75  			
76  					this.Time = original.getTime()
77   	;
78  				
79  			this.SimTime = original.getSimTime();			
80  		}
81  		
82  	   		
83  			protected long SimTime;
84  				
85  			/**
86  			 * Simulation time in MILLI SECONDS !!!
87  			 */	
88  			@Override
89  			public long getSimTime() {
90  				return SimTime;
91  			}
92  						
93  			/**
94  			 * Used by Yylex to slip correct time of the object or programmatically.
95  			 */
96  			protected void setSimTime(long SimTime) {
97  				this.SimTime = SimTime;
98  			}
99  	   	
100     	
101 	    /**
102          * Timestamp from the GameBots. 
103          */
104         protected
105          double Time =
106        	0;
107 	
108  		/**
109          * Timestamp from the GameBots. 
110          */
111         public  double getTime()
112  	 {
113     					return Time;
114     				}
115     			
116  		
117  	    public String toString() {
118             return
119             	super.toString() + "[" +
120             	
121 		              			"Time = " + String.valueOf(getTime()
122  	) + " | " + 
123 		              		
124 				"]";           		
125         }
126  	
127  		
128  		public String toHtmlString() {
129  			return super.toString() + "[<br/>" +
130             	
131 		              			"<b>Time</b> = " + String.valueOf(getTime()
132  	) + " <br/> " + 
133 		              		
134 				"<br/>]";     
135 		}
136  	
137  	    public String toJsonLiteral() {
138             return "pong( "
139             		+
140 								    String.valueOf(getTime()
141  	)									
142 								
143                    + ")";
144         }
145  	
146  		
147  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
148         	
149 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
150 		
151 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
152 	        
153 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
154  	
155 		}
156