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 DomPointControllerPropertyToken = Tokens.get("DomPointController");
73  	    						
74  							
75  							public static final Set<Token> SharedPropertyTokens;
76  	
77  							static {
78  								Set<Token> tokens = new HashSet<Token>();
79  								
80  									tokens.add(LocationPropertyToken);
81  								
82  									tokens.add(VelocityPropertyToken);
83  								
84  									tokens.add(ItemSpawnedPropertyToken);
85  								
86  									tokens.add(DoorOpenedPropertyToken);
87  								
88  									tokens.add(DomPointControllerPropertyToken);
89  								
90  								SharedPropertyTokens = Collections.unmodifiableSet(tokens);
91  							}
92  	    				
93  	    			
94  	    				@Override
95  		    			public abstract 
96  		    			NavPointShared clone();
97  		    			
98  						@Override
99  						public Class getCompositeClass() {
100 							return NavPoint.class;
101 						}
102 	
103 						
104 		    			
105  		/**
106          * 
107 			A unique Id of this navigation point assigned by the game.
108 		 
109          */
110         public abstract UnrealId getId()
111  	;
112 		    			
113  		/**
114          * Location of navigation point. 
115          */
116         public abstract Location getLocation()
117  	;
118 		    			
119  		/**
120          * 
121 			Velocity of the navigation point (if the navigation point is
122 			currently moving). Not sent at the moment.
123 		 
124          */
125         public abstract Velocity getVelocity()
126  	;
127 		    			
128  		/**
129          * 
130             True if the item is spawned at the point. Not sent if point is not an inventory spot. 
131          
132          */
133         public abstract boolean isItemSpawned()
134  	;
135 		    			
136  		/**
137          * 
138             True if this NavPoint is a Door and door is opened. Not sent if point is not a door.
139          
140          */
141         public abstract boolean isDoorOpened()
142  	;
143 		    			
144  		/**
145          * Exported if this NavPoint is a DominationPoint (for BotDoubleDomination game) - which team controls this point. 
146          */
147         public abstract int getDomPointController()
148  	;
149 		    			
150  		
151  	    public String toString() {
152             return
153             	super.toString() + "[" +
154             	
155 		              			"Id = " + String.valueOf(getId()
156  	) + " | " + 
157 		              		
158 		              			"Location = " + String.valueOf(getLocation()
159  	) + " | " + 
160 		              		
161 		              			"Velocity = " + String.valueOf(getVelocity()
162  	) + " | " + 
163 		              		
164 		              			"ItemSpawned = " + String.valueOf(isItemSpawned()
165  	) + " | " + 
166 		              		
167 		              			"DoorOpened = " + String.valueOf(isDoorOpened()
168  	) + " | " + 
169 		              		
170 		              			"DomPointController = " + String.valueOf(getDomPointController()
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>Location</b> = " + String.valueOf(getLocation()
184  	) + " <br/> " + 
185 		              		
186 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
187  	) + " <br/> " + 
188 		              		
189 		              			"<b>ItemSpawned</b> = " + String.valueOf(isItemSpawned()
190  	) + " <br/> " + 
191 		              		
192 		              			"<b>DoorOpened</b> = " + String.valueOf(isDoorOpened()
193  	) + " <br/> " + 
194 		              		
195 		              			"<b>DomPointController</b> = " + String.valueOf(getDomPointController()
196  	) + " <br/> " + 
197 		              		
198 				"<br/>]";     
199 		}
200  	
201  		
202  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
203         	
204 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
205 		
206 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---
207 	        
208 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---        	            	
209  	
210 		}
211