/** * Copyright (C) 2017-2018 Christian Pierre MOMON * Copyright (C) 2011-2013 Nicolas Vinot * * This file is part of (April) Hebdobot. * * Hebdobot is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Hebdobot is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Hebdobot. If not, see */ package org.april.hebdobot.bot.review; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * The Class IndividualTopic. */ public class IndividualTopic extends Topic { private final Map messages; /** * Instantiates a new individual topic. * * @param title * the title */ public IndividualTopic(final String title) { super(title); this.messages = new HashMap<>(); } /* (non-Javadoc) * @see org.april.hebdobot.review.Topic#add(org.april.hebdobot.review.Message) */ @Override public void add(final Message message) { final String author = message.getAuthor(); if (!this.messages.containsKey(author)) { this.messages.put(author, new Messages()); } this.messages.get(author).add(message); } /** * Gets the messages. * * @param author * the author * @return the messages */ public Messages getMessages(final String author) { Messages result; result = this.messages.get(author); // return result; } /* (non-Javadoc) * @see org.april.hebdobot.review.Topic#getParticipants() */ @Override public Set getParticipants() { Set result; result = this.messages.keySet(); // return result; } /** * Checks for participant. * * @param participant * the participant * @return true, if successful */ public boolean hasParticipant(final String participant) { boolean result; result = this.messages.containsKey(participant); // return result; } }