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;
82 * お気に入り取得の際に利用するタイマーID生成
86 public static String createFavoriteID(String screenName) {
87 return "FAV:" + screenName;
94 public static String createTimelineID() {
102 public static String createMentionID() {
110 public static String createDirectMessageID() {
111 return "DIRECTMESSAGE";
118 public static String createSendDirectMessageID() {
119 return "SENDDIRECTMESSAGE";
127 public static String createUserTimelineID(long userID) {
128 return "USERTIMELINE:" + userID;
132 * 指定したユーザのタイムラインIDを生成
136 public static String createUserTimelineID(String screenName) {
137 return "USERTIMELINE:" + screenName;
146 public static String createUserListID(String username, long listID) {
147 return "LIST:" + username + ":" + listID;