Improved list code.

This commit is contained in:
Christian P. MOMON 2017-12-14 17:04:44 +01:00
parent 688d5f0a88
commit 00f0c356af
4 changed files with 42 additions and 8 deletions

View File

@ -20,7 +20,6 @@
package fr.imirhil.april.hebdobot.review;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@ -29,7 +28,7 @@ import java.util.Set;
*/
public class CollectiveTopic extends Topic
{
private final List<Message> messages = new LinkedList<Message>();
private final Messages messages = new Messages();
/**
* Instantiates a new collective topic.

View File

@ -20,8 +20,6 @@
package fr.imirhil.april.hebdobot.review;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -30,7 +28,7 @@ import java.util.Set;
*/
public class IndividualTopic extends Topic
{
private final Map<String, List<Message>> messages = new HashMap<String, List<Message>>();
private final Map<String, Messages> messages = new HashMap<String, Messages>();
/**
* Instantiates a new individual topic.
@ -52,7 +50,7 @@ public class IndividualTopic extends Topic
final String author = message.getAuthor();
if (!this.messages.containsKey(author))
{
this.messages.put(author, new LinkedList<Message>());
this.messages.put(author, new Messages());
}
this.messages.get(author).add(message);
}
@ -64,7 +62,7 @@ public class IndividualTopic extends Topic
* the author
* @return the messages
*/
public List<Message> getMessages(final String author)
public Messages getMessages(final String author)
{
return this.messages.get(author);
}

View File

@ -0,0 +1,37 @@
/**
* Copyright (C) 2017 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 fr.imirhil.april.hebdobot.review;
import java.util.LinkedList;
/**
* The Class MessageLinkedList.
*/
public class Messages extends LinkedList<Message>
{
private static final long serialVersionUID = -4092193002518826252L;
/**
* Instantiates a new messages.
*/
public Messages()
{
super();
}
}

View File

@ -58,7 +58,7 @@ public class Review
this.participants = new HashSet<String>();
this.individualTopics = new LinkedList<IndividualTopic>();
this.collectiveTopics = new LinkedList<CollectiveTopic>();
this.messages = new LinkedList<Message>();
this.messages = new Messages();
this.owner = owner;
}