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=composite]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=composite]+classtype[@name=impl] END
15      
16   		/**
17           *  
18              		Composite implementation of the ENT abstract message. It wraps Local/Shared/Static parts in single object
19              		allowing to presenting a nice facade for users.
20              	
21           *
22           *  <p></p><p></p>
23           *  Complete message documentation:               
24           *  
25  		Generic physical entity that may be present in the world. Works as a hook for custom objects, such as new items from EmohawkRPG extension.
26  	
27           */
28   	public class EntityCompositeImpl 
29    				extends Entity
30  	    {
31   	
32      	
33      	
34      	/**
35      	 * Parameter-less contructor for the message.
36      	 */
37  		public EntityCompositeImpl()
38  		{
39  		}
40  	
41  		
42  		/**
43  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
44  		 *
45  		 * @param partLocal local-part of the message
46  		 * @param partShared shared-part of the message
47  		 * @param partStatic static-part of the message
48  		 */
49  		public EntityCompositeImpl(
50  			EntityLocalImpl partLocal,
51  			EntitySharedImpl partShared,
52  			EntityStaticImpl partStatic
53  		) {
54  			this.partLocal  = partLocal;
55  			this.partShared = partShared;
56  			this.partStatic = partStatic;
57  		}
58  		
59  		/**
60  		 * Cloning constructor.
61  		 *
62  		 * @param original		 
63  		 */
64  		public EntityCompositeImpl(EntityCompositeImpl original) {
65  			this.partLocal = partLocal;
66  			this.partShared = partShared;
67  			this.partStatic = partStatic;
68  		}
69      
70     				
71     				@Override
72     				public void setSimTime(long SimTime) {
73  					super.setSimTime(SimTime);
74  				}
75     			
76      			
77      			protected 
78      			EntityStaticImpl
79      			partStatic;
80      			
81      			@Override
82  				public EntityStatic getStatic() {
83  					return partStatic;
84  				}
85      			
86      			protected
87      			EntityLocalImpl
88      			partLocal;
89      	
90      			@Override
91  				public EntityLocal getLocal() {
92  					return partLocal;
93  				}
94  			
95      			EntitySharedImpl
96      			partShared;
97      			
98  				@Override
99  				public EntityShared getShared() {
100 					return partShared;
101 				}
102 			
103 				
104   				
105   					@Override
106     				
107  		/**
108          * 
109 			Unique Id of the item. This Id represents some entity in the world.
110 		 
111          */
112         public  UnrealId getId()
113  	 {
114     					return 
115     						
116     								partStatic.
117     							getId()
118  	;
119     				}
120     			
121   					@Override
122     				
123  		/**
124          * 
125 			If the item is in the field of view of the bot.
126 		 
127          */
128         public  boolean isVisible()
129  	 {
130     					return 
131     						
132     								partLocal.
133     							isVisible()
134  	;
135     				}
136     			
137   					@Override
138     				
139  		/**
140          * Location of the item. 
141          */
142         public  Location getLocation()
143  	 {
144     					return 
145     						
146     								partShared.
147     							getLocation()
148  	;
149     				}
150     			
151   					@Override
152     				
153  		/**
154          * Rotation of the item. 
155          */
156         public  Rotation getRotation()
157  	 {
158     					return 
159     						
160     								partShared.
161     							getRotation()
162  	;
163     				}
164     			
165   					@Override
166     				
167  		/**
168          * Velocity of the item. 
169          */
170         public  Velocity getVelocity()
171  	 {
172     					return 
173     						
174     								partShared.
175     							getVelocity()
176  	;
177     				}
178     			
179   					@Override
180     				
181  		/**
182          * Type (category) of the entity. 
183          */
184         public  String getType()
185  	 {
186     					return 
187     						
188     								partStatic.
189     							getType()
190  	;
191     				}
192     			
193   					@Override
194     				
195  		/**
196          * Type (category) of the entity. 
197          */
198         public  String getEntityClass()
199  	 {
200     					return 
201     						
202     								partStatic.
203     							getEntityClass()
204  	;
205     				}
206     			
207  		
208  	    public String toString() {
209             return
210             	super.toString() + "[" +
211             	
212             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
213             		
214 				"]";           		
215         }
216  	
217  		
218  		public String toHtmlString() {
219  			return super.toString() + "[<br/>" +
220             	
221             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
222             		
223 				"<br/>]";     
224 		}
225  	
226  		
227  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
228         	
229 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
230 		
231 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
232 	        
233 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
234  	
235 		}
236