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 AirBase building.
10   * 
11   * @author Radek 'Black_Hand' Pibil
12   *
13   */
14  public enum AirBaseState implements IState {
15  	
16  	FIGHTER_LAUNCH(JBot.STATE_AIRBASEFIGHTERLAUNCH),
17      BOMBER_LAUNCH(JBot.STATE_AIRBASEBOMBERLAUNCH);
18  	
19  	private static Map<Integer, AirBaseState> states = new HashMap<Integer, AirBaseState>();
20  	
21  	public static AirBaseState getState(int stateId) {
22  		return states.get(stateId);
23  	}
24  	
25  	static {
26  		for (AirBaseState state : AirBaseState.values()) {
27  			states.put(state.getStateId(), state);
28  		}
29  	}
30  
31  	private AirBaseState(int id) {
32  		this.id = id;		
33  	}
34  
35  	public final int id;
36  
37  	@Override
38  	public int getStateId() {
39  		return id;
40  	}
41  
42  	@Override
43  	public Enum<? extends IState> getEnum() {
44  		return this;
45  	}
46  
47  }