View Javadoc

1   package cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects;
2   
3   import cz.cuni.amis.pogamut.base.communication.worldview.object.WorldObjectId;
4   import cz.cuni.amis.pogamut.multi.agent.ITeamId;
5   import cz.cuni.amis.pogamut.multi.communication.translator.event.ICompositeWorldObjectUpdatedEvent;
6   import cz.cuni.amis.pogamut.multi.communication.translator.event.ILocalWorldObjectUpdatedEvent;
7   import cz.cuni.amis.pogamut.multi.communication.translator.event.ISharedWorldObjectUpdatedEvent;
8   import cz.cuni.amis.pogamut.multi.communication.translator.event.IStaticWorldObjectUpdatedEvent;
9   import cz.cuni.amis.pogamut.multi.communication.worldview.object.ICompositeWorldObject;
10  import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.IGBViewable;
11  
12  public abstract class TestCompositeViewableObject implements ICompositeWorldObject, IGBViewable {
13  
14  	protected WorldObjectId id;
15  	
16  	protected TestCompositeViewableObject(WorldObjectId id)
17  	{
18  		this.id = id;
19  	}
20  	
21  	@Override
22  	public WorldObjectId getId() {
23  		return this.id;
24  	}
25  	
26  	public abstract String getLocalString();
27  	public abstract long getLocalLong();
28  	
29  	public abstract String getStaticString();
30  	public abstract long getStaticLong();
31  	
32  	public abstract String getSharedString();
33  	public abstract long getSharedLong();
34  
35  
36  	public ICompositeWorldObjectUpdatedEvent createUpdateEvent(long time, ITeamId teamId) {
37  		return new TestCompositeViewableObject.TestCompositeViewableObjectUpdatedEvent(this, time, teamId);
38  	}
39  	
40  	public static class TestCompositeViewableObjectUpdatedEvent implements ICompositeWorldObjectUpdatedEvent
41  	{
42  
43  		private TestCompositeViewableObject data;
44  		private long time;
45  		private ITeamId teamId;
46  		
47  		public TestCompositeViewableObjectUpdatedEvent( TestCompositeViewableObject data, long time, ITeamId teamId)
48  		{
49  			this.data = data;
50  			this.time = time;
51  			this.teamId = teamId;
52  		}
53  		
54  		@Override
55  		public long getSimTime() {
56  			return time;
57  		}
58  
59  		@Override
60  		public WorldObjectId getId() {
61  			return data.getId();
62  		}
63  
64  		@Override
65  		public ILocalWorldObjectUpdatedEvent getLocalEvent() {
66  			return new TestLocalViewableObject.TestLocalViewableObjectUpdatedEvent( (TestLocalViewableObject)data.getLocal() , time);
67  		}
68  
69  		@Override
70  		public ISharedWorldObjectUpdatedEvent getSharedEvent() {
71  			return new TestSharedViewableObjectImpl.TestSharedViewableObjectUpdatedEvent((TestSharedViewableObject)data.getShared(), time, teamId);
72  		}
73  
74  		@Override
75  		public IStaticWorldObjectUpdatedEvent getStaticEvent() {
76  			return new TestStaticViewableObject.TestStaticViewableObjectUpdatedEvent((TestStaticViewableObject)data.getStatic(), time);
77  		}
78  		
79  	}
80  	
81  }