Improved list code.
This commit is contained in:
parent
688d5f0a88
commit
00f0c356af
@ -20,7 +20,6 @@
|
|||||||
package fr.imirhil.april.hebdobot.review;
|
package fr.imirhil.april.hebdobot.review;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class CollectiveTopic extends Topic
|
public class CollectiveTopic extends Topic
|
||||||
{
|
{
|
||||||
private final List<Message> messages = new LinkedList<Message>();
|
private final Messages messages = new Messages();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new collective topic.
|
* Instantiates a new collective topic.
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
package fr.imirhil.april.hebdobot.review;
|
package fr.imirhil.april.hebdobot.review;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -30,7 +28,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class IndividualTopic extends Topic
|
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.
|
* Instantiates a new individual topic.
|
||||||
@ -52,7 +50,7 @@ public class IndividualTopic extends Topic
|
|||||||
final String author = message.getAuthor();
|
final String author = message.getAuthor();
|
||||||
if (!this.messages.containsKey(author))
|
if (!this.messages.containsKey(author))
|
||||||
{
|
{
|
||||||
this.messages.put(author, new LinkedList<Message>());
|
this.messages.put(author, new Messages());
|
||||||
}
|
}
|
||||||
this.messages.get(author).add(message);
|
this.messages.get(author).add(message);
|
||||||
}
|
}
|
||||||
@ -64,7 +62,7 @@ public class IndividualTopic extends Topic
|
|||||||
* the author
|
* the author
|
||||||
* @return the messages
|
* @return the messages
|
||||||
*/
|
*/
|
||||||
public List<Message> getMessages(final String author)
|
public Messages getMessages(final String author)
|
||||||
{
|
{
|
||||||
return this.messages.get(author);
|
return this.messages.get(author);
|
||||||
}
|
}
|
||||||
|
37
src/main/java/fr/imirhil/april/hebdobot/review/Messages.java
Normal file
37
src/main/java/fr/imirhil/april/hebdobot/review/Messages.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
@ -58,7 +58,7 @@ public class Review
|
|||||||
this.participants = new HashSet<String>();
|
this.participants = new HashSet<String>();
|
||||||
this.individualTopics = new LinkedList<IndividualTopic>();
|
this.individualTopics = new LinkedList<IndividualTopic>();
|
||||||
this.collectiveTopics = new LinkedList<CollectiveTopic>();
|
this.collectiveTopics = new LinkedList<CollectiveTopic>();
|
||||||
this.messages = new LinkedList<Message>();
|
this.messages = new Messages();
|
||||||
|
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user