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=shared]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=shared]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the shared part of the GameBots2004 message NAV.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message - however only NavPoints marking item pickup locations are exported synchronously. Other NavPoints are not exported synchronously at all, even if the bot can actually see them (but note that ALL NavPoints are exported in the handshake between bot and the server). Exporting NavPoints synchronously took a lot of UT server resources with limited information gain (in Pogamut there is now available visibility matrix holding static information which points can be seen from other points). NavPoint carries information about UT navigation point - location, paths and some additional information are stored there (if it is an ambush point, or sniper point, etc.).
25  	
26           */
27   	public abstract class NavPointShared 
28    						extends InfoMessage
29    						implements ISharedWorldObject
30    						
31  	    		,ILocated
32  	    		,ILocomotive
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public NavPointShared()
41  		{
42  		}
43  		
44  				// abstract definition of the shared-part of the message, no more constructors is needed
45  			
46  	   		
47  			protected long SimTime;
48  				
49  			/**
50  			 * Simulation time in MILLI SECONDS !!!
51  			 */	
52  			@Override
53  			public long getSimTime() {
54  				return SimTime;
55  			}
56  						
57  			/**
58  			 * Used by Yylex to slip correct time of the object or programmatically.
59  			 */
60  			protected void setSimTime(long SimTime) {
61  				this.SimTime = SimTime;
62  			}
63  	   	
64  	    						public static final Token LocationPropertyToken = Tokens.get("Location");
65  	    					
66  	    						public static final Token VelocityPropertyToken = Tokens.get("Velocity");
67  	    					
68  	    						public static final Token ItemSpawnedPropertyToken = Tokens.get("ItemSpawned");
69  	    					
70  	    						public static final Token DoorOpenedPropertyToken = Tokens.get("DoorOpened");
71  	    					
72  	    						public static final Token InvSpotPropertyToken = Tokens.get("InvSpot");
73  	    					
74  	    						public static final Token PlayerStartPropertyToken = Tokens.get("PlayerStart");
75  	    						
76  							
77  							public static final Set<Token> SharedPropertyTokens;
78  	
79  							static {
80  								Set<Token> tokens = new HashSet<Token>();
81  								
82  									tokens.add(LocationPropertyToken);
83  								
84  									tokens.add(VelocityPropertyToken);
85  								
86  									tokens.add(ItemSpawnedPropertyToken);
87  								
88  									tokens.add(DoorOpenedPropertyToken);
89  								
90  									tokens.add(InvSpotPropertyToken);
91  								
92  									tokens.add(PlayerStartPropertyToken);
93  								
94  								SharedPropertyTokens = Collections.unmodifiableSet(tokens);
95  							}
96  	    				
97  	    			
98  	    				@Override
99  		    			public abstract 
100 		    			NavPointShared clone();
101 		    			
102 						@Override
103 						public Class getCompositeClass() {
104 							return NavPoint.class;
105 						}
106 	
107 						
108 		    			
109  		/**
110          * 
111 			A unique Id of this navigation point assigned by the game.
112 		 
113          */
114         public abstract UnrealId getId()
115  	;
116 		    			
117  		/**
118          * Location of navigation point. 
119          */
120         public abstract Location getLocation()
121  	;
122 		    			
123  		/**
124          * 
125 			Velocity of the navigation point (if the navigation point is
126 			currently moving). Not sent at the moment.
127 		 
128          */
129         public abstract Velocity getVelocity()
130  	;
131 		    			
132  		/**
133          * 
134             True if the item is spawned at the point. Not sent if point is not an inventory spot. 
135          
136          */
137         public abstract boolean isItemSpawned()
138  	;
139 		    			
140  		/**
141          * 
142             True if this NavPoint is a Door and door is opened. Not sent if point is not a door.
143          
144          */
145         public abstract boolean isDoorOpened()
146  	;
147 		    			
148  		/**
149          * 
150 			If this is an inventory spot (item is respawned at this point).
151 		 
152          */
153         public abstract boolean isInvSpot()
154  	;
155 		    			
156  		/**
157          * 
158 			If this is a player start (players and/or bots are respawned at this point).
159 		 
160          */
161         public abstract boolean isPlayerStart()
162  	;
163 		    			
164  		
165  	    public String toString() {
166             return
167             	super.toString() + "[" +
168             	
169 		              			"Id = " + String.valueOf(getId()
170  	) + " | " + 
171 		              		
172 		              			"Location = " + String.valueOf(getLocation()
173  	) + " | " + 
174 		              		
175 		              			"Velocity = " + String.valueOf(getVelocity()
176  	) + " | " + 
177 		              		
178 		              			"ItemSpawned = " + String.valueOf(isItemSpawned()
179  	) + " | " + 
180 		              		
181 		              			"DoorOpened = " + String.valueOf(isDoorOpened()
182  	) + " | " + 
183 		              		
184 		              			"InvSpot = " + String.valueOf(isInvSpot()
185  	) + " | " + 
186 		              		
187 		              			"PlayerStart = " + String.valueOf(isPlayerStart()
188  	) + " | " + 
189 		              		
190 				"]";           		
191         }
192  	
193  		
194  		public String toHtmlString() {
195  			return super.toString() + "[<br/>" +
196             	
197 		              			"<b>Id</b> = " + String.valueOf(getId()
198  	) + " <br/> " + 
199 		              		
200 		              			"<b>Location</b> = " + String.valueOf(getLocation()
201  	) + " <br/> " + 
202 		              		
203 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
204  	) + " <br/> " + 
205 		              		
206 		              			"<b>ItemSpawned</b> = " + String.valueOf(isItemSpawned()
207  	) + " <br/> " + 
208 		              		
209 		              			"<b>DoorOpened</b> = " + String.valueOf(isDoorOpened()
210  	) + " <br/> " + 
211 		              		
212 		              			"<b>InvSpot</b> = " + String.valueOf(isInvSpot()
213  	) + " <br/> " + 
214 		              		
215 		              			"<b>PlayerStart</b> = " + String.valueOf(isPlayerStart()
216  	) + " <br/> " + 
217 		              		
218 				"<br/>]";     
219 		}
220  	
221  		
222  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
223         	
224 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
225 		
226 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---
227 	        
228 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---        	            	
229  	
230 		}
231