Improved code.

This commit is contained in:
Christian P. MOMON 2017-12-26 01:18:36 +01:00
parent 7e0c4ab4ed
commit f983bc3f74
4 changed files with 56 additions and 7 deletions

View File

@ -137,8 +137,8 @@ public class HebdobotCLI
logger.info("Aliases file loading… ({}).", aliasFile.getAbsolutePath());
UserAliases aliases = new UserAliases(aliasFile);
logger.info("Aliases file loaded (" + aliases.size() + " aliases).");
logger.info("Alias liste:\n" + aliases.toString());
System.exit(0);
if (config.isValid())
{
logger.info("Bot configuring…");

View File

@ -91,6 +91,17 @@ public class UserAliases extends HashMap<String, String>
}
}
/**
* Instantiates a new user aliases.
*
* @param source
* the source
*/
public UserAliases(final UserAliases source)
{
super(source);
}
/**
* Gets the real name.
*
@ -143,7 +154,7 @@ public class UserAliases extends HashMap<String, String>
String result;
StringList buffer = new StringList();
for (String nick : this.keySet())
for (String nick : new StringList(this.keySet()).sort())
{
buffer.appendln(getRealName(nick));
}

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 org.april.hebdobot.review;
import java.util.ArrayList;
/**
* The Class MessageLinkedList.
*/
public class MessageList extends ArrayList<Message>
{
private static final long serialVersionUID = -5568763770640883452L;
/**
* Instantiates a new messages.
*/
public MessageList()
{
super();
}
}

View File

@ -23,13 +23,14 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.model.UserAliases;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import fr.devinsy.util.strings.StringSet;
/**
* The Class Review.
*/
@ -37,11 +38,11 @@ public class Review
{
private static final int LENGTH = 80;
private final Set<String> participants;
private final StringSet participants;
private final List<IndividualTopic> individualTopics;
private final List<CollectiveTopic> collectiveTopics;
private Topic currentTopic;
private final List<Message> messages;
private final MessageList messages;
private final String owner;
private final UserAliases aliases;
@ -53,10 +54,10 @@ public class Review
*/
public Review(final String owner, final UserAliases aliases)
{
this.participants = new HashSet<String>();
this.participants = new StringSet();
this.individualTopics = new LinkedList<IndividualTopic>();
this.collectiveTopics = new LinkedList<CollectiveTopic>();
this.messages = new Messages();
this.messages = new MessageList();
this.owner = owner;
this.aliases = aliases;