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