public synchronized boolean addUserClient(String username, ClientThread clientThread) { checkNotNull(username); checkNotNull(clientThread); if (takenUsernames.containsKey(username)) return false; takenUsernames.put(username, clientThread); return true; }
@Override public FieldDefinition getField(final String fieldName) { if (fields.containsKey(fieldName)) { return fields.get(fieldName); } else if (priorityField != null && priorityField.getName().equals(fieldName)) { return priorityField; } else { return null; } }
public synchronized boolean isChatroomExisting(String chatroomName) { checkNotNull(chatroomName); return chatrooms.containsKey(chatroomName); }
public synchronized Chatroom getChatroomByName(String chatroom) throws ChatroomNotFoundExeption { checkNotNull(chatroom); if (chatroom.equals(defaultChatName)) return defaultChat; if (!chatrooms.containsKey(chatroom)) throw new ChatroomNotFoundExeption(chatroom); return chatrooms.get(chatroom); }
public synchronized boolean containsUser(String user) { return takenUsernames.containsKey(user); }