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 MOV.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Movers can be doors, elevators, or any
25  		other chunk of architecture that can move. They generally need
26  		to be either run into, or activated by shooting or pressing a
27  		button. We are working on ways to provide bots with more of the
28  		information they need to deal with movers appropriately.
29  	
30           */
31   	public abstract class MoverShared 
32    						extends InfoMessage
33    						implements ISharedWorldObject
34    						
35  	    		,ILocated
36  	    		,ILocomotive
37  	    {
38   	
39      	
40      	
41      	/**
42      	 * Parameter-less contructor for the message.
43      	 */
44  		public MoverShared()
45  		{
46  		}
47  		
48  				// abstract definition of the shared-part of the message, no more constructors is needed
49  			
50  	   		
51  			protected long SimTime;
52  				
53  			/**
54  			 * Simulation time in MILLI SECONDS !!!
55  			 */	
56  			@Override
57  			public long getSimTime() {
58  				return SimTime;
59  			}
60  						
61  			/**
62  			 * Used by Yylex to slip correct time of the object or programmatically.
63  			 */
64  			protected void setSimTime(long SimTime) {
65  				this.SimTime = SimTime;
66  			}
67  	   	
68  	    						public static final Token LocationPropertyToken = Tokens.get("Location");
69  	    					
70  	    						public static final Token VelocityPropertyToken = Tokens.get("Velocity");
71  	    					
72  	    						public static final Token StatePropertyToken = Tokens.get("State");
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(StatePropertyToken);
85  								
86  								SharedPropertyTokens = Collections.unmodifiableSet(tokens);
87  							}
88  	    				
89  	    			
90  	    				@Override
91  		    			public abstract 
92  		    			MoverShared clone();
93  		    			
94  						@Override
95  						public Class getCompositeClass() {
96  							return Mover.class;
97  						}
98  	
99  						
100 		    			
101  		/**
102          * 
103 			A unique Id of this mover assigned by the game.
104 		 
105          */
106         public abstract UnrealId getId()
107  	;
108 		    			
109  		/**
110          * Location of the mover. 
111          */
112         public abstract Location getLocation()
113  	;
114 		    			
115  		/**
116          * Velocity vector. 
117          */
118         public abstract Velocity getVelocity()
119  	;
120 		    			
121  		/**
122          * Name of the state Mover is currently in. Can be used to determine the type of the mover.  
123          */
124         public abstract String getState()
125  	;
126 		    			
127  		
128  	    public String toString() {
129             return
130             	super.toString() + "[" +
131             	
132 		              			"Id = " + String.valueOf(getId()
133  	) + " | " + 
134 		              		
135 		              			"Location = " + String.valueOf(getLocation()
136  	) + " | " + 
137 		              		
138 		              			"Velocity = " + String.valueOf(getVelocity()
139  	) + " | " + 
140 		              		
141 		              			"State = " + String.valueOf(getState()
142  	) + " | " + 
143 		              		
144 				"]";           		
145         }
146  	
147  		
148  		public String toHtmlString() {
149  			return super.toString() + "[<br/>" +
150             	
151 		              			"<b>Id</b> = " + String.valueOf(getId()
152  	) + " <br/> " + 
153 		              		
154 		              			"<b>Location</b> = " + String.valueOf(getLocation()
155  	) + " <br/> " + 
156 		              		
157 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
158  	) + " <br/> " + 
159 		              		
160 		              			"<b>State</b> = " + String.valueOf(getState()
161  	) + " <br/> " + 
162 		              		
163 				"<br/>]";     
164 		}
165  	
166  		
167  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
168         	
169 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
170 		
171 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---
172 	        
173 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---        	            	
174  	
175 		}
176