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 ALIVE 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  		Synchronous message. Alive message are for confirmation, that
26  		the connection is still working. They are sent periodically with
27  		usual period of one second (this can change depending on the
28  		configuration of ControlServer)
29  	
30           */
31   	public class AliveMessageCompositeImpl 
32    				extends AliveMessage
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public AliveMessageCompositeImpl()
41  		{
42  		}
43  	
44  		
45  		/**
46  		 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
47  		 *
48  		 * @param partLocal local-part of the message
49  		 * @param partShared shared-part of the message
50  		 * @param partStatic static-part of the message
51  		 */
52  		public AliveMessageCompositeImpl(
53  			AliveMessageLocalImpl partLocal,
54  			AliveMessageSharedImpl partShared,
55  			AliveMessageStaticImpl partStatic
56  		) {
57  			this.partLocal  = partLocal;
58  			this.partShared = partShared;
59  			this.partStatic = partStatic;
60  		}
61  		
62  		/**
63  		 * Cloning constructor.
64  		 *
65  		 * @param original		 
66  		 */
67  		public AliveMessageCompositeImpl(AliveMessageCompositeImpl original) {
68  			this.partLocal = partLocal;
69  			this.partShared = partShared;
70  			this.partStatic = partStatic;
71  		}
72      
73  						
74  						public UnrealId getId() {						
75  							return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.AliveMessage.AliveMessageId;
76  						}
77  					
78     				
79     				@Override
80     				public void setSimTime(long SimTime) {
81  					super.setSimTime(SimTime);
82  				}
83     			
84      			
85      			protected 
86      			AliveMessageStaticImpl
87      			partStatic;
88      			
89      			@Override
90  				public AliveMessageStatic getStatic() {
91  					return partStatic;
92  				}
93      			
94      			protected
95      			AliveMessageLocalImpl
96      			partLocal;
97      	
98      			@Override
99  				public AliveMessageLocal getLocal() {
100 					return partLocal;
101 				}
102 			
103     			AliveMessageSharedImpl
104     			partShared;
105     			
106 				@Override
107 				public AliveMessageShared getShared() {
108 					return partShared;
109 				}
110 			
111 				
112   				
113   					@Override
114     				
115  		/**
116          * 
117 			Game time when this message was send.
118 		 
119          */
120         public  double getTime()
121  	 {
122     					return 
123     						
124     								partLocal.
125     							getTime()
126  	;
127     				}
128     			
129  		
130  	    public String toString() {
131             return
132             	super.toString() + "[" +
133             	
134             			"Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
135             		
136 				"]";           		
137         }
138  	
139  		
140  		public String toHtmlString() {
141  			return super.toString() + "[<br/>" +
142             	
143             			"Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
144             		
145 				"<br/>]";     
146 		}
147  	
148  		
149  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
150         	
151 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
152 		
153 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
154 	        
155 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---        	            	
156  	
157 		}
158