hebdobot/src/org/april/hebdobot/bot/review/Messages.java

65 lines
1.6 KiB
Java

/**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
*
* 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 <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
import java.util.LinkedList;
import org.apache.commons.lang3.StringUtils;
/**
* The Class MessageLinkedList.
*/
public class Messages extends LinkedList<Message>
{
private static final long serialVersionUID = -4092193002518826252L;
/**
* Instantiates a new messages.
*/
public Messages()
{
super();
}
/**
* Gets the by author.
*
* @param author
* the author
* @return the by author
*/
public Messages getByAuthor(final String author)
{
Messages result;
result = new Messages();
for (Message message : this)
{
if (StringUtils.equals(message.getAuthor(), author))
{
result.add(message);
}
}
//
return result;
}
}