View Javadoc

1   package cz.cuni.amis.pogamut.ut3.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=local]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=local]+classtype[@name=impl] END
15      
16   		/**
17           *  
18              				Implementation of the local part of the GameBotsUT3 message EMP.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24           */
25   	public class EmptyLocalImpl 
26    						extends
27    						EmptyLocal
28  	    {
29   	
30      	
31      	
32      	/**
33      	 * Parameter-less contructor for the message.
34      	 */
35  		public EmptyLocalImpl()
36  		{
37  		}
38  	
39      	/**
40  		 * Cloning constructor from the full message.
41  		 *
42  		 * @param original
43  		 */
44  		public EmptyLocalImpl(Empty original) {		
45  			
46  			this.SimTime = original.getSimTime();			
47  		}
48  		
49  		/**
50  		 * Cloning constructor from the full message.
51  		 *
52  		 * @param original
53  		 */
54  		public EmptyLocalImpl(EmptyLocalImpl original) {		
55  			
56  			this.SimTime = original.getSimTime();
57  		}
58  		
59  			/**
60  			 * Cloning constructor from the message part.
61  			 *
62  			 * @param original
63  			 */
64  			public EmptyLocalImpl(EmptyLocal original) {
65  				
66  			}
67  		
68  						
69  						public UnrealId getId() {						
70  							return cz.cuni.amis.pogamut.ut3.communication.messages.gbinfomessages.Empty.EmptyId;
71  						}
72  					
73     				
74     				@Override
75     				public void setSimTime(long SimTime) {
76  					super.setSimTime(SimTime);
77  				}
78     			
79  	    				@Override
80  	    				public 
81  	    				EmptyLocalImpl clone() {
82  	    					return new 
83  	    					EmptyLocalImpl(this);
84  	    				}
85  	    				
86  	    				
87      	
88      	
89      	
90      	
91      	public EmptyLocalImpl getLocal() {
92  			return this;
93      	}
94  		public ISharedWorldObject getShared() {
95  		 	throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
96  		}
97  		public IStaticWorldObject getStatic() {
98  		    throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
99  		}
100  	
101 		public static class EmptyLocalUpdate
102      implements ILocalWorldObjectUpdatedEvent, IGBWorldObjectEvent
103 		{
104 			protected long time;
105 			
106 			protected EmptyLocal data = null; //contains object data for this update
107 			
108 			public EmptyLocalUpdate
109     (EmptyLocal moverLocal, long time)
110 			{
111 				this.data = moverLocal;
112 				this.time = time;
113 			}
114 			
115 			@Override
116 			public IWorldObjectUpdateResult<ILocalWorldObject> update(
117 					ILocalWorldObject object) 
118 			{
119 				if ( object == null)
120 				{
121 					data = new EmptyLocalImpl(data); //we always return Impl object
122 					return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
123 				}
124 				if ( object instanceof EmptyLocalImpl )
125 				{
126 					EmptyLocalImpl toUpdate = (EmptyLocalImpl)object;
127 					
128 					boolean updated = false;
129 					
130 					// UPDATING LOCAL PROPERTIES
131 					
132 					
133 					data = toUpdate; //the updating has finished
134 					
135 					if ( updated )
136 					{
137 						toUpdate.SimTime = this.time;
138 						return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, data);
139 					}
140 					
141 					return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
142 				}
143 				throw new PogamutException("Unsupported object type for update. Expected EmptyLocalImpl for object " + object.getId() +", not object of class " + object.getClass().getSimpleName() + ".", this);
144 			}
145 	
146 			/**
147 			 * Simulation time in MILLI SECONDS !!!
148 			 */
149 			@Override
150 			public long getSimTime() {
151 				return this.time;
152 			}
153 	
154 			@Override
155 			public IWorldObject getObject() {
156 				return data;
157 			}
158 	
159 			@Override
160 			public WorldObjectId getId() {
161 				return data.getId();
162 			}
163 			
164 		}	
165  	
166  		
167  	    public String toString() {
168             return
169             	super.toString() + "[" +
170             	
171 				"]";           		
172         }
173  	
174  		
175  		public String toHtmlString() {
176  			return super.toString() + "[<br/>" +
177             	
178 				"<br/>]";     
179 		}
180  	
181  		
182  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
183         	
184 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
185 		
186 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=local+classtype[@name=impl]) ---
187 	        
188 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=local+classtype[@name=impl]) ---        	            	
189  	
190 		}
191