View Javadoc

1   package cz.cuni.amis.pogamut.multi.agent.impl;
2   
3   import java.util.UUID;
4   
5   import com.google.inject.Inject;
6   import com.google.inject.name.Named;
7   
8   import cz.cuni.amis.pogamut.base.agent.impl.AgentId;
9   import cz.cuni.amis.pogamut.base.utils.guice.AgentScoped;
10  import cz.cuni.amis.pogamut.multi.agent.ITeamId;
11  import cz.cuni.amis.pogamut.multi.agent.ITeamedAgentId;
12  
13  @AgentScoped
14  public class TeamedAgentId extends AgentId implements ITeamedAgentId{
15  	
16  	private TeamId teamId;
17  
18  	public TeamedAgentId() {
19  		super();
20  		this.teamId = new TeamId(new UUID(random.nextLong(), random.nextLong()).toString());
21  	}
22  	
23  	@Inject
24  	public TeamedAgentId(@Named(AGENT_NAME_DEPENDENCY) String agentName) {
25  		super(agentName);
26  	}
27  	
28  	public TeamedAgentId(String agentName, String teamId) {
29  		super(agentName);
30  		this.teamId = new TeamId(teamId);
31  	}
32  
33  	@Override
34  	public ITeamId getTeamId() {
35  		return teamId;
36  	}
37  	
38  	@Override
39  	public String toString()
40  	{
41  		return "TeamedAgentId[" + super.getName().getFlag() + " | " + String.valueOf(teamId) + "]";
42  	}
43  
44  	public void setTeamId(TeamId teamId) {
45  		this.teamId = teamId;
46  	}
47  	
48  }