Beispiel #1
0
  public synchronized boolean addUserClient(String username, ClientThread clientThread) {
    checkNotNull(username);
    checkNotNull(clientThread);
    if (takenUsernames.containsKey(username)) return false;

    takenUsernames.put(username, clientThread);
    return true;
  }
Beispiel #2
0
 @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;
   }
 }
Beispiel #3
0
 public synchronized boolean isChatroomExisting(String chatroomName) {
   checkNotNull(chatroomName);
   return chatrooms.containsKey(chatroomName);
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 public synchronized boolean containsUser(String user) {
   return takenUsernames.containsKey(user);
 }