2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
8 import java.util.HashSet;
15 public class TimerID {
17 private static TimerID timerID;
19 private Set<String> idList;
25 idList = new HashSet<String>();
32 public static synchronized TimerID getInstance() {
33 if( timerID == null ) {
34 timerID = new TimerID();
44 public boolean contains(String id) {
45 return idList.contains(id);
51 * @throws ExistTimerIDException 既に指定したタイマーIDが存在している
53 public void addID(String id) throws ExistTimerIDException {
54 if( contains(id) == true ) {
55 throw new ExistTimerIDException("既にそのIDは存在しています");
58 throw new NullPointerException();
66 * @return idがそもそも存在していたかどうか 存在していた場合trueを返す
68 public boolean removeID(String id) {
69 return this.idList.remove(id);
73 * 情報検索の際に利用するタイマーのIDを生成
77 public static String createSearchTimerID(String searchWord) {
78 return "SEARCH:" + searchWord;
85 public static String createTimelineID() {
93 public static String createMentionID() {
101 public static String createDirectMessageID() {
102 return "DIRECTMESSAGE";
109 public static String createSendDirectMessageID() {
110 return "SENDDIRECTMESSAGE";