1 package cz.cuni.amis.pogamut.base.component.controller; 2 3 import cz.cuni.amis.pogamut.base.agent.IAgentId; 4 import cz.cuni.amis.pogamut.base.component.IComponent; 5 import cz.cuni.amis.pogamut.base.component.ISharedComponent; 6 import cz.cuni.amis.pogamut.base.component.lifecyclebus.ILifecycleBus; 7 import cz.cuni.amis.utils.token.IToken; 8 9 /** 10 * The component controller is meant for simple {@link ISharedComponent} NOT {@link IComponent}s (for them, use {@link IComponentController} instead). 11 * <p><p> 12 * It is suitable for controlling lifecycle of one component inside one component bus. It provides methods for 13 * querying components the controlled component is depending on. 14 * 15 * @author Jimmy 16 */ 17 public interface ISharedComponentController<COMPONENT extends ISharedComponent> extends IComponentControllerBase<COMPONENT>, ISharedComponent { 18 19 /** 20 * Tells whether the agent identified by 'agentId' is currently using the controlled component, i.e., this component controller 21 * registers the component to agent's {@link ILifecycleBus} and is watching it for auto start/stop/pause/resume/... 22 * 23 * @param agentId 24 * @return 25 */ 26 public boolean isUsedBy(IAgentId agentId); 27 28 /** 29 * Whether the controlled component is dependent on component (identified by 'componentId') of the agent identified 30 * by 'agentId'. 31 * <p><p> 32 * Note that two {@link IComponent} belonging to different agents may have the same 'componentId'. 33 * 34 * @param agentId 35 * @param componentId 36 * @return 37 */ 38 public boolean isDependent(IAgentId agentId, IToken componentId); 39 40 /** 41 * Whether the controlled component is dependent on 'component' of the agent identified by 'agentId'. 42 * 43 * @param component 44 * @return 45 */ 46 public boolean isDependent(IAgentId agentId, IComponent component); 47 48 }