View Javadoc

1   package cz.cuni.amis.pogamut.defcon.consts;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import javabot.JBot;
7   
8   /**
9    * List of all possible type of polls.
10   * Used in {@link SendVote}.
11   * 
12   * @author Radek 'Black_Hand' Pibil
13   *
14   */
15  public enum VoteType {
16  	
17  	INVALID(JBot.VoteTypeInvalid),
18  	JOIN_ALLIANCE(JBot.VoteTypeJoinAlliance),
19  	KICK_PLAYER(JBot.VoteTypeKickPlayer),
20  	LEAVE_ALLIANCE(JBot.VoteTypeLeaveAlliance);
21  	
22  	private static Map<Integer, VoteType> enums = new HashMap<Integer, VoteType>();
23  	
24  	public static VoteType getEnum(int id) {
25  		return enums.get(id);
26  	}
27  	
28  	static {
29  		for (VoteType item : VoteType.values()) {
30  			enums.put(item.id, item);
31  		}
32  	}
33  	
34  	public final int id;
35  	
36  	private VoteType(int id) {
37  		this.id = id;
38  	}	
39  
40  }