View Javadoc

1   package cz.cuni.amis.pogamut.defcon.consts.state;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import javabot.JBot;
7   
8   /**
9    * Contains all states for Carriers.
10   * 
11   * @author Radek 'Black_Hand' Pibil
12   *
13   */
14  public enum CarrierState implements IState {
15  	
16  	FIGHTER_LAUNCH(JBot.STATE_CARRIERFIGHTERLAUNCH),
17  	BOMBER_LAUNCH(JBot.STATE_CARRIERBOMBERLAUNCH),
18  	ANTISUB(JBot.STATE_CARRIERANTISUB);
19  	
20  	private static Map<Integer, CarrierState> states = new HashMap<Integer, CarrierState>();
21  	
22  	public static CarrierState getState(int stateId) {
23  		return states.get(stateId);
24  	}
25  	
26  	static {
27  		for (CarrierState state : CarrierState.values()) {
28  			states.put(state.getStateId(), state);
29  		}
30  	}
31  	
32  	public final int id;
33  	
34  	private CarrierState(int id) {
35  		this.id = id;
36  	}
37  
38  	@Override
39  	public int getStateId() {
40  		return id;
41  	}
42  
43  	@Override
44  	public Enum<? extends IState> getEnum() {
45  		return this;
46  	}
47  
48  }