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 possible votes for {@link SendVote} command.
10   * 
11   * @author Radek 'Black_Hand' Pibil
12   *
13   */
14  public enum Vote {
15  	
16  	UNKNOWN(JBot.VoteUnknown),
17  	YES(JBot.VoteYes),
18  	NO(JBot.VoteNo),
19  	ABSTAIN(JBot.VoteAbstain);
20  	
21  	private static Map<Integer, Vote> enums = new HashMap<Integer, Vote>();
22  	
23  	public static Vote getEnum(int id) {
24  		return enums.get(id);
25  	}
26  	
27  	static {
28  		for (Vote item : Vote.values()) {
29  			enums.put(item.id, item);
30  		}
31  	}
32  	
33  	public final int id;
34  	
35  	private Vote(int id) {
36  		this.id = id;
37  	}
38  
39  }