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