View Javadoc

1   package cz.cuni.amis.pogamut.multi.agent.impl;
2   
3   import cz.cuni.amis.pogamut.base.utils.guice.AgentTeamScoped;
4   import cz.cuni.amis.pogamut.multi.agent.ITeamId;
5   import cz.cuni.amis.utils.token.Token;
6   import cz.cuni.amis.utils.token.Tokens;
7   
8   @AgentTeamScoped
9   public class TeamId implements ITeamId {
10  
11  	private Token token;
12  
13  	public TeamId(String teamIdentifier) {
14  		this.token = Tokens.get(teamIdentifier);
15  	}
16  	
17  	@Override
18  	public int hashCode() {
19  		return token.hashCode();
20  	}
21  	
22  	@Override
23  	public String toString()
24  	{
25  		return token.getToken();
26  	}
27  	
28  	@Override
29  	public boolean equals(Object obj) {
30  		if (obj == null) return false;
31  		if (!(obj instanceof TeamId)) return false;
32  		return token.equals(((TeamId)obj).token);
33  	}
34  	
35  }