View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.bot.params;
2   
3   import cz.cuni.amis.pogamut.base.agent.IAgentId;
4   import cz.cuni.amis.pogamut.base.agent.params.IAgentParameters;
5   import cz.cuni.amis.pogamut.base.agent.params.IRemoteAgentParameters;
6   import cz.cuni.amis.pogamut.base.communication.connection.IWorldConnectionAddress;
7   import cz.cuni.amis.pogamut.ut2004.agent.params.UT2004AgentParameters;
8   
9   public class UT2004BotParameters extends UT2004AgentParameters {
10  
11  	private Integer team;
12  
13  	/**
14  	 * If you need to populate the parameters after instantiation, use setters available in this
15  	 * class: {@link UT2004BotParameters#setAgentId(IAgentId)}, {@link UT2004BotParameters#setWorldAddress(IWorldConnectionAddress)}, {@link UT2004BotParameters#setTeam(int)}.
16  	 */
17  	public UT2004BotParameters() {
18  		super();
19  	}
20  	
21  	@Override
22  	public UT2004BotParameters setAgentId(IAgentId agentId) {
23  		super.setAgentId(agentId);
24  		return this;
25  	}
26  	
27  	@Override
28  	public UT2004BotParameters setWorldAddress(IWorldConnectionAddress address) {
29  		super.setWorldAddress(address);
30  		return this;
31  	}
32  
33  	/**
34  	 * Preferred team. If illegal or no team provided, one will be
35  	 * provided for you. Normally a team game has team 0 and team 1. 
36  	 * In BotDeathMatch, team is meaningless.
37  	 * 
38  	 * @return
39  	 */
40  	public Integer getTeam() {
41  		return team;
42  	}
43  
44  	/**
45  	 * Preferred team. If illegal or no team provided, one will be
46  	 * provided for you. Normally a team game has team 0 and team 1. 
47  	 * In BotDeathMatch, team is meaningless.
48  	 * 
49  	 * @param team
50  	 * @return
51  	 */
52  	public UT2004BotParameters setTeam(Integer team) {
53  		this.team = team;
54  		return this;
55  	}
56  	
57  	@Override
58  	public void assignDefaults(IAgentParameters defaults) {
59  		super.assignDefaults(defaults);
60  		if (defaults instanceof UT2004BotParameters) {
61  			if (team == null) {
62  				team = ((UT2004BotParameters)defaults).getTeam();
63  			}
64  		}
65  	}
66  	
67  }