com.ircclouds.irc.api.domain.IRCChannel Maven / Gradle / Ivy
package com.ircclouds.irc.api.domain;
import java.util.*;
/**
* The IRC channel object that will be returned when an asynchronous joinChannel succeeds.
*
* The object stores the channel name, topic, channel modes, and a mapping of all channel users and their statuses.
*
* @author [email protected]
*
*/
public class IRCChannel
{
private String name;
private IRCTopic topic;
private Map> users = new LinkedHashMap>();
private List chanModes = new ArrayList();
public IRCChannel()
{
this("");
}
public IRCChannel(String aName)
{
name = aName;
}
public String getName()
{
return name;
}
public void setName(String aName)
{
name = aName;
}
public Set addUser(IRCUser aUser, Set aStatus)
{
return users.put(aUser, aStatus);
}
public Set removeUser(IRCUser aUser)
{
return users.remove(aUser);
}
public IRCTopic getTopic()
{
return topic;
}
public void setTopic(IRCTopic aTopic)
{
topic = aTopic;
}
public Map> getUsers()
{
return users;
}
public void setUsers(Map> aUsers)
{
users = aUsers;
}
public List getModes()
{
return chanModes;
}
@Override
public boolean equals(Object aObject)
{
if (aObject != null)
{
if (aObject instanceof IRCChannel)
{
return ((IRCChannel)aObject).getName().equals(name);
}
else if (aObject instanceof String)
{
return aObject.equals(name);
}
}
return false;
}
@Override
public int hashCode()
{
return name.hashCode();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy