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