View Javadoc

1   package cz.cuni.amis.pogamut.multi.communication.translator.event;
2   
3   import cz.cuni.amis.pogamut.multi.communication.worldview.object.ISharedProperty;
4   import cz.cuni.amis.utils.NullCheck;
5   
6   /**
7    * Interface for results returned by ISharedPropertyUpdatedEvent .
8    * @author srlok
9    */
10  public interface ISharedPropertyUpdateResult {
11  	
12  	public static enum Result {
13  		
14  		CREATED,
15  		UPDATED,
16  		SAME,
17  		DESTROYED;
18  		
19  	}
20  	
21  	public Result getResult();
22  	
23  	public ISharedProperty getProperty();
24  
25  	public static class SharedPropertyUpdateResult implements ISharedPropertyUpdateResult {
26  
27  		private Result result;
28  		private ISharedProperty property;
29  
30  		public SharedPropertyUpdateResult(Result result, ISharedProperty property) {
31  			this.result = result;
32  			NullCheck.check(this.result, "result");
33  			this.property = property;
34  			if (result != Result.DESTROYED) {
35  				NullCheck.check(this.property, "object (result != DESTROYED)");
36  			}
37  		}
38  		
39  		@Override
40  		public ISharedProperty getProperty() {
41  			return property;
42  		}
43  
44  		@Override
45  		public Result getResult() {
46  			return result;
47  		}
48  
49  	}
50  }