Ejemplo n.º 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;
  }
Ejemplo n.º 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;
   }
 }
Ejemplo n.º 3
0
 public synchronized boolean isChatroomExisting(String chatroomName) {
   checkNotNull(chatroomName);
   return chatrooms.containsKey(chatroomName);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
0
 public synchronized boolean containsUser(String user) {
   return takenUsernames.containsKey(user);
 }